1

I have a binary that I want wrapped up as an Application, so I thought this was a good use case for AppleScript.

I want to automate how Script Editor lets you export an AppleScript as a .app bundle. This is what I have so far, I'm confused about how to read the libraries dictionary for the script editor.

tell application "Script Editor"

set command to "do shell script " & "\"APP_PATH\""
set innard to {contents: command}
set Tallgeese to make new document with properties innard
save Tallgeese as "application"

end tell
1

You must specify the full path where you want to save this application.

Here is an example that saves it in the "Applications" folder of the user.

set appName to "someAppName"
set thePath to (path to applications folder from user domain as string with folder creation) & appName & ".app"
tell application "Script Editor"
    set command to "do shell script " & "\"/bin/ls\""
    set innard to {contents:command}
    set Tallgeese to make new document with properties innard
    compile Tallgeese
    save Tallgeese as "application" in thePath
    close document 1 -- close the document
    -- quit ---- quit the editor
end tell
  • I get " Script Editor got an error: Can’t get document "someAppName". (-1728)" with this (just changed app_path to /bin/ls) – Edgar Aroutiounian Sep 19 '15 at 15:31
  • Try the edited script – jackjr300 Sep 19 '15 at 15:50
  • Yes! Dude you are awesome! Also is there an easy way in Apple Script to add an image for the icon or I can just add that in the app folder with icns. – Edgar Aroutiounian Sep 19 '15 at 15:53
  • Also, when this app crashes as it will since I'm developing it, where does the debug log or exception information go? Currently I'm not seeing anything on stdout or console's logs – Edgar Aroutiounian Sep 19 '15 at 17:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .