Due to a CDrom with alot of files, I now have these 700 applescripts that need to be compiled. Is there any way to automate this process?
Would save me so much troubles guys
Thanks advance!
Due to a CDrom with alot of files, I now have these 700 applescripts that need to be compiled. Is there any way to automate this process?
Would save me so much troubles guys
Thanks advance!
This may depend.
I supposse these are plain text containing AS-statements?
If one of these call, eg, “Mail”, most probably “Mail” will be launched at compile-time, so the AppleScript component can check its terminology. This may happen with several apps, such as Mail, TextEdit, QuarkXPress… So, if could be problematic?
Anyway, there is an easy way to do this task.
If you can run OS-X, this is the way to follow:
osacompile -o /path/to/outputCompiled.scpt /path/to/inputText.txt
(see “man osacompile” for more options)
If not, you can read every file, then compile it on-the-fly using the “store script” command. Eg:
set x to (read alias "path:to: inputText.txt") --> read file
--> compile code
set compiledX to (run script "return my foo" & return & ¬
"script foo" & return & ¬
x & return & ¬
"end script")
--> store compiled script
store script compiledX in file "path:to:outputCompiled.scpt"
If you wish speed, I recommend “store script”. However, “osacompile” allows more flexibility, such as storing in different resources, including fork, compile as run-only, etc.