Can't Decompress

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Can't Decompress

William Marriott
I created a new stack with a single field and two buttons:

Button 1
--------
on mouseUp
  put "D:\Desktop\Put It Here" into saveFolder
  put "My Data File.xyz" into saveFileName
  put "binfile:" & saveFolder & "\" & saveFileName into saveURL
  answer saveURL
  put fld 1 into URL saveURL
 put compress(URL saveURL) into URL saveURL
end mouseUp

Button 2
--------
on mouseUp
  put "D:\Desktop\Put It Here" into loadFolder
  put "My Data File.xyz" into loadFileName
  put "binfile:" & saveFolder & "\" & loadFileName into loadURL

  put decompress(URL loadURL) into URL loadURL
  put URL loadURL into fld 1
end mouseUp

I've put the stack up on RevOnline for you to try. User MerryOtter.

Clicking Button 1 saves a file that is compressed properly. (I can even
extract it with 7zip). Clicking Button 2 gives me the error:

Type: decompress: string is not compressed data
Object: Button 2
Line: put decompress(URL loadURL) into URL loadURL

What am I doing wrong? No matter what I do I can't get decompress to work.
Rev 2.6.1 on Windows XP. (I hope I'm not missing something basic like I did
with my last post...)



_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Can't Decompress

xtalkprogrammer
Hi Bill,

Is saveFolder defined, in the script of button 2?

Best,

Mark

--

Economy-x-Talk
Consultancy and Software Engineering
http://economy-x-talk.com
http://www.salery.biz

Salery is the easiest way to get your own web store on-line: http://
www.salery.biz/salery.html



Op 29-apr-2006, om 20:49 heeft Bill Marriott het volgende geschreven:

<snip>

> Button 2
> --------
> on mouseUp
>   put "D:\Desktop\Put It Here" into loadFolder
>   put "My Data File.xyz" into loadFileName
>   put "binfile:" & saveFolder & "\" & loadFileName into loadURL
>
>   put decompress(URL loadURL) into URL loadURL
>   put URL loadURL into fld 1
> end mouseUp
>
> I've put the stack up on RevOnline for you to try. User MerryOtter.
>
> Clicking Button 1 saves a file that is compressed properly. (I can  
> even
> extract it with 7zip). Clicking Button 2 gives me the error:
>
> Type: decompress: string is not compressed data
> Object: Button 2
> Line: put decompress(URL loadURL) into URL loadURL
>
> What am I doing wrong? No matter what I do I can't get decompress  
> to work.
> Rev 2.6.1 on Windows XP. (I hope I'm not missing something basic  
> like I did
> with my last post...)

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Kind regards,

Drs. Mark Schonewille

Economy-x-Talk Consultancy and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
Facebook: http://facebook.com/LiveCode.Beginner
KvK: 50277553
Reply | Threaded
Open this post in threaded view
|

Re: Can't Decompress

William Marriott
That was a typo when I prepared the email...

Actual button script says

put "binfile:" & loadFolder & "\" & loadFileName into loadURL

(see the RevOnline stack)

- Bill

"Mark Schonewille"
> Is saveFolder defined, in the script of button 2?

>> Button 2
>> --------
>> on mouseUp
>>   put "D:\Desktop\Put It Here" into loadFolder
>>   put "My Data File.xyz" into loadFileName
>>   put "binfile:" & saveFolder & "\" & loadFileName into loadURL
>>
>>   put decompress(URL loadURL) into URL loadURL
>>   put URL loadURL into fld 1
>> end mouseUp



_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Can't Decompress

Sarah Reichelt-2
In reply to this post by William Marriott
On 4/30/06, Bill Marriott <[hidden email]> wrote:

> I created a new stack with a single field and two buttons:
>
> Button 1
> --------
> on mouseUp
>   put "D:\Desktop\Put It Here" into saveFolder
>   put "My Data File.xyz" into saveFileName
>   put "binfile:" & saveFolder & "\" & saveFileName into saveURL
>   answer saveURL
>   put fld 1 into URL saveURL
>  put compress(URL saveURL) into URL saveURL
> end mouseUp
>
> Button 2
> --------
> on mouseUp
>   put "D:\Desktop\Put It Here" into loadFolder
>   put "My Data File.xyz" into loadFileName
>   put "binfile:" & saveFolder & "\" & loadFileName into loadURL
>
>   put decompress(URL loadURL) into URL loadURL
>   put URL loadURL into fld 1
> end mouseUp
>
> I've put the stack up on RevOnline for you to try. User MerryOtter.
>
> Clicking Button 1 saves a file that is compressed properly. (I can even
> extract it with 7zip). Clicking Button 2 gives me the error:
>
> Type: decompress: string is not compressed data
> Object: Button 2
> Line: put decompress(URL loadURL) into URL loadURL
>
> What am I doing wrong? No matter what I do I can't get decompress to work.
> Rev 2.6.1 on Windows XP. (I hope I'm not missing something basic like I did
> with my last post...)


Hi Bill,

Using your demo stack, I couldn't even get the save to work, but I
finally got both working. You had left a few typos in so that the path
names didn't include the file name and mixed loadFolder & saveFolder,
but I think the main problem was that you were using Windows style "\"
(back slashs) for you path dividers, while Rev uses Unix style "/".

Another problem may be avoided by using 2 files: one for the plain
text and one for the compressed text. Unless you need the plain text
version as well, I would compress & decompress the field data without
using an intermediate text file.


This is on Mac OS  X, not WIndows, but try these scripts:

Compress button:

on mouseUp
    put specialFolderPath("Desktop") & "/Put It Here" into saveFolder
    put "My Data File.xyz" into saveFileName
    put "binfile:" & saveFolder & "/" & saveFileName into saveURL

    put compress(fld 1) into URL saveURL
end mouseUp

Decompress button:

on mouseUp
    put specialFolderPath("Desktop") & "/Put It Here" into loadFolder
    put "My Data File.xyz" into loadFileName
    put "binfile:" & loadFolder & "/" & loadFileName into loadURL

    put decompress(URL loadURL) into fld 1
end mouseUp

HTH,
Sarah
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution