Ok, I’ve got an app that I want to add scripting capabilities to and I’m just seeking opinions/suggestions for which engine to use, XojoScript or AppleScript. It is a macOS only program.
XojoScript seems to be a bit easier to do, but AppleScript is more of a standard. I don’t want to do both, at least not right now.
Does making it scriptable via AppleScript affect MAS submission?
Right now I’m leaning towards AppleScript, but that if very much subject to change.
Apples or Oranges ?
If you asked me, I never would say that. But this is just me.
Not sure about MAS, but I’d go with AppleScript if cross platform is not an issue. You won’t need an internal editor in that case either.
Thomas Tempelman developed a framework for adding AppleScript support. I don’t think that this is easy to do on you own. I can’t find it right now where he mentioned it on the forum but you can always ask him.
As far as I remember you could also add Lua support with an Einhugur plugin.
I use XojoScript for automation inside of the app and AppleScript to send data to external apps, like Microsoft Word. For anybody who has used VBA with Excel etc, XojoScript is easier to learn than AppleScript.
XojoScript seams to be much faster and easier integratable with a Xojo app than AppleScript. And there are lots of sample projects available.
Using XojoScript inside a macOS app
The core issue is the workflow. Normally, you want to integrate different apps. And for this you - unfortunately - need AppleScript.
I may miss a Getting Started with XojoScript that will start with the basis
whre to put code :(.
For those who want to read examples, they are here:
Advanced --> XojoScript -->
Edit:Added code tags.
an xDev article is available here : old, but you got an idea of how to create a set of plugins (stored ina pluhgin folder).
Its a simple file manager application that i want to allow users to create their own custom buttons. Not meant to allow sharing of data between applications but they could certainly do that with AppleScript.
I see pros and cons for both approaches.
I have done both:
iClip is applescriptable, using my own written framework that’s based on Apple’s Cocoa Applescript API. It works very well and stable.
iBored and Arbed use XojoScript. Works well, too (both apps run on Mac, Win and Linux).
AppleScript has the advantage that there are nice code editors available, even a very good debugger (Script Debugger), and you can use all sorts of extensions.
OTOH, XojoScript is x-platform and lets you control what the user can do at all. But that also means that the user is very limited. E.g, if he wants to interact with files on his disk, you have to provide functions for that.
To choose one or the other, consider what you want to let the user do with scripting:
- If you want to let the user access your app’s data and interact with other programs, then AppleScript is the best choice for that, provided you only do macOS.
- If you just want to let the user write custom operations that run solely in your own app, then either is good, with XojoScript even being more efficient and giving you more control).