Page 1 of 1

Custom file extensions

Posted: Wed Dec 31, 2008 2:18 pm
by gyroscope
Hi, I'm sure I saw the solution to the following prob some time ago but can't find it:

My first project lets users save certain output to a simple .txt file, as well as read in a .txt file.

Ideally I would like some script to change the extension for the saved and read-in file to .isg, for instance. Still a text file of course, but hopefully (although not absolutely necessary) unable to be read by word processors, Mac TextEdit etc; but more importantly, my app, once the new extension is added, to only show and only recognise files with the .isg extension but still bring it in as a normal plain text file.

Has anyone the script for this please :?:

:)

Posted: Wed Dec 31, 2008 2:38 pm
by BvG

Code: Select all

put textData into url ("file:" & pathToFile & "filename.isg")

Code: Select all

answer file "specify file" with type "ISG Files|isg|ISGT"
if it <> "" then
  put url ("file:" & it) into field 1
end if

Posted: Wed Dec 31, 2008 2:46 pm
by Mark
Hi gyroscope,

Usually I make a special file format. For example something like

<app>My App Name</app><version>1.0</version><data>thisIsSomeCompressedOrEncryptedDataInBinaryForm</data>

Using these tags, I can quickly check the format of the file.

The following script will help you to create a script that opens files from the finder. If you check the file format, you don't really need to check the file type.

http://runrev.info/Open%20File%20from%20Finde.htm

Best,

Mark

Posted: Wed Dec 31, 2008 2:48 pm
by gyroscope
Thank you, BvG and Mark, exactly what's needed!

Thanks also for your swift replies.

:)