.sdef
file with the script command definitions,Info.plist
, andInfo.plist
as well..sdef
. It usually has the same name as your app, but you can pick whatever you want. For TableFlip, this file would be TableFlip.sdef
, for The Archive I picked TheArchive.sdef
.touch
from the Terminal or your favorie text editor and drag the file into your project later.title
with the name of your app plus the word “Terminology”. That appears to be a convention..sdef
file.Info.plist
in Xcode and add two new rows:NSAppleScriptEnabled
(will become “Scriptable”) and the value to YES
(it’s a boolean Xcode will recognize)..sdef
file exposes available commands. Set the key to OSAScriptingDefinition
(will become “Scripting definition file name”) and the value to the file name of your .sdef
, e.g. “TableFlip.sdef
”. No need to specify a path.<dictionary>
element, there is a <suite>
element that contains many <command>
elements..sdef
can only have 1 root level <dictionary>
element, only one!, but that can contain multiple suited to group different purposes.<suite>
until the closing </suite>
into your .sdef
file. Note that you will want to have a look at each command and change it so it fits your app. Not everything from the CocoaStandard.sdef
makes sense.CocoaStandard.sdef
file, you’ll see this (broken onto multiple lines to preserve space):<parameter>..</parameter>
node. .sdef
looks like this afterwards:.sdef
, too. Save the file, build the project, then drag the app bundle onto Script Editor again. It does not auto-update just because the underlying bundle did change during compilation.THE APP NAME
with your app’s name. It appears to work well with the product name. In my case, that’ll be The Archive
with a space, or TableFlip
without one.CocoaStandard.sdef
to fit your app..sdef
will actually not disable them. The app still responds to the standard messages; apparently, these are inherited and the suite with the same name and identifier can be overridden. So the commands just don’t show up in the Script Editor terminology view..sdef
file first and don’t actually implement any functionality. Instead, you write test scripts in Script Editor and hit the “Compile” button. That’ll verify the syntax and show errors if you mistyped the invokation in the script, or botched the definition in you .sdef
file. <suite>
…</suite>
node, with a unique name and a unique 8-character identifier. Whatever that is for, and why-ever that is limited to 8 characters. Legacy, I guess. We’ll have a look at custom command creation in another post./Application
folder. Run your app from Xcode to make this debug version occupy the name and receive the AppleScript events.