AppleScript-Cocoa classes v1.0 released

Announcing AppleScriptable Cocoa classes for Xojo

If you want to make your macOS app scriptable by AppleScript (or even JXA / JavaScript), there is now a powerful set of Xojo classes (no plugins) available:

Though it uses the Cocoa layer for AppleScript (instead of the low-level AppleEvents API), these classes are even more powerful over those for Objective C because they (optionally) use Introspection to make your Xojo classes properties AppleScript-accessible.

Another ability (independent of making your app scriptable) is that you can invoke an AppleScript’s various handlers (functions) individually - something that Xojo’s own AppleScript calling does not allow (there, you can only call the main run handler).

To use these classes, you will have to learn how to write a scripting dictionary (.sdef), though, and I won’t teach you that. The project comes with a complex demo showing off all its abilities, though, and if you’re smart enough, you can deduct all the functionaliry, including how the sdef works, from it.

Once you have understood how this works (basically, you make your data classes subclasses of “Scriptable.ObjectProxy” or you write proxy classes that mediate between the script calls and your existing data model), it’ll be very easy and quick to add new scripting accessors.

Note that this code is currently not free. It’s open source, and while you may play with it to explore the capabilities, you must contact me to get permission to use it in software that you plan to release to others. I think of making it available for free and charge for support, but I haven’t made up my mind, yet. It all depends on how much interest and need exists for this at all.

That’s really neat Thomas. Not sure I have any use for it myself right now, but I certainly would have used it in the past for some projects I would have liked to make scriptable.

" if you’re smart enough" :slight_smile: