Binary files inconsistency
Bill Vlahos
bvlahos at mac.com
Tue May 25 01:44:02 EDT 2010
The next version of InfoWallet will support attaching files that are compressed and encrypted when stored. I've noticed that it works correctly with some files but not others.
The script below takes a binary file, compresses it, decompresses it, and then saves it back to disk. I've skipped the encryption part for this recipe because it behaves the same way. It works correctly with .jpg, pdf, and .doc files but not .pages or keynote. Make a new stack and put the following script in a button.
on mouseUp
answer file "Select a file:"
if it is not empty then
put it into lFileToRead
put URL ("binfile:" & lFileToRead) into vFile
put compress(vFile) into vFile
set the itemdelimiter to tab
ask file "Select destination to save file:" with the last item of lFileToRead
if it is not empty then
put it into vFilePath
put decompress(vFile) into vFile
put vFile into URL ("binfile:" & vFilePath)
set the filetype to ""
end if
end if
end mouseUp
The saved Pages or Keynote files have zero length. Why is that and how do I make this work with any file?
Bill Vlahos
_________________
InfoWallet (http://www.infowallet.com) is about keeping your important life information with you, accessible, and secure.
More information about the use-livecode
mailing list