Add file to Custom Property

Bill Vlahos bvlahos at mac.com
Thu Mar 18 17:04:21 EDT 2010


So I'm getting close on this. The "Save file" button script seems to work fine. The custom property looks to be encrypted.

Button "Save File"
on mouseUp
   answer file "Please select a file..."
   put it into lFileToRead
   set the itemDelimiter to "/"
   answer the last item of lFileToRead
   -- Read the binary contents of a file into a variable
   open file lFileToRead for binary read
   read from file lFileToRead until end
   close file lFileToRead
   put it into vFile
   encrypt it using "blowfish" with "biff" at "128" bit
   set the uFileStore of me to it
   set the uFileName of me to the last item of lFileToRead
end mouseUp

The following script doesn't actually save the file but I'm not sure why.
Button "Save and open file"
on mouseUp
   ask file "Save file to;" with  the uFileName of button "Save File"
   put the uFileStore of button "Save File" into vEncryptedFile
   decrypt vEncryptedFile using "blowfish" with "biff" at "128" bit
   put vEncryptedFile into URL ("binfile:" & it)
   set the filetype to ""
   launch document it
end mouseUp

Bill Vlahos



More information about the use-livecode mailing list