Re: Generating applescript files
Re: Generating applescript files
- Subject: Re: Generating applescript files
- From: "Marc K. Myers" <email@hidden>
- Date: Thu, 16 May 2002 11:33:13 -0400
- Organization: [very little]
>
Date: Thu, 16 May 2002 02:40:22 +0100
>
To: email@hidden
>
From: Alex Robinson <email@hidden>
>
Subject: Generating applescript files
>
>
Is it possible to generate a file that can then be run as a compiled
>
applescript?
>
>
I tried the following:
>
>
set scriptName to "blech"
>
>
tell application "Finder"
>
set theScript to "-- text of script goes here"
>
set theFile to ("HardDisk:Users:sgp:Desktop:" & scriptName)
>
set the openFile to open for access file theFile with write permission
>
set eof of the openFile to 0
>
write theScript to the openFile starting at eof
>
close access the openFile
>
set theFile to file theFile
>
set creator type of theFile to "ToyS"
>
set file type of theFile to "osas"
>
end tell
>
>
But when trying to open the file, I get:
>
>
"Could not read the file because of a scripting-system (OSA) error"
>
>
Which I suppose is fair enough seeing that I've basically made a
>
straightforward text file and then just changed the types.
>
>
So what do I actually need to do or is this kind of thing only possible if
>
using a scriptable editor like Script Debugger?
You can use the "store script" command and store your script as a script
object in a file that is already a compiled script (or an applet). I've
done this with applets, using the existing applet as the template.
Using the Finder I duplicate the applet and then store the new script
object in the copy.
Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074
[5/16/02 11:32:55 AM]
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.