I have a bunch of AppleScript scripts in a directory that I want to be able to build as apps without having to go into each one and manually save as application.
I’ve already created a “build script” that used to work, but for some reason it doesn’t work anymore. So I’m able to iterate through the scripts, open them in the AppleScript Editor, create the output directory, but the save command doesn’t do anything anymore. Here’s the relevant part:
on makeApp(sourcedir, outputdir, curFile)
tell application "Finder" to set outName to name of curFile
tell application "AppleScript Editor"
set outNameRoot to my remove_extension(outName)
set outAppName to outNameRoot & ".app"
set outFileName to ((outputdir as string) & outAppName as string)
set scriptFile to open curFile
save scriptFile as "application" in outFileName
--display dialog outFileName
--close scriptFile
end tell
end makeApp
The line that fails is:
save scriptFile as "application" in outFileName
This was working around September. The only thing I can think of is that I’ve upgraded to Lion. So my question is:
- Does anyone know why that would fail (silently)?
- Is there another way to accomplish what I’m trying to do?
Thanks
The open command is supposed to return a document, but it returns missing value on my machine. You should be able to just save document 1, since the newly opened script will be in front. Another option would be to use osacompile – you don’t get a bunch of script documents popping up that way.