JXA: Checkout the StandardAdditions Dictionary

###JXA: Checkout the StandardAdditions Dictionary

Well, I did discover one very helpful thing in my search for "console.log( )"

This dictionary really helps you to translate the AppleScript commands you know and love into the corresponding JXA syntax. To make it easy to search and read, I copied it all and pasted into an Evernote Note.

For any scripting newbees, to see this,
goto ***Script Editor > File > Open Dictionary...***, and then choose the "ScriptingAdditions.osax"

To use any of these commands, you will need an app reference, like this:

var app = Application.currentApplication()
app.includeStandardAdditions = true

app.displayAlert("Hello world")

1 Like

I'm not sure the StandardAdditions.osax is in the Script Editor's Library by default; you may have to add it manually.

The lazy can just run this from the Script Editor.app to open the StandardAdditions.osax sdef (script dictionary).

set stdAddOsax to alias ((path to scripting additions folder from system domain as text) & "StandardAdditions.osax")
tell application "Script Editor" to open stdAddOsax

-Chris

I think it must be there by default, cause I don't remember adding it.

Thanks for your tip on opening it by script.

I just added this script to my Scripts folder, so it is now always just one click away. :smile: