I’m confused about the role of JavaScript vs AppleScript when it comes to automating application functions, especially with respect to Bike. Can someone give or refer to a brief overview?
Thanks.
Bob
I’m confused about the role of JavaScript vs AppleScript when it comes to automating application functions, especially with respect to Bike. Can someone give or refer to a brief overview?
Thanks.
Bob
Jesse has implemented an osascript
Automation interface for Bike.
osascript
interfaces can be used by AppleScript or JavaScript
In Script Editor, for example, there is a language selector at top left, and, similarly in the:
Script Editor > File > Open Dictionary > Bike
osascript library browser, you can view the interface either in AS or JS – there’s a language selector at upper right:
To run scripts from the shell, see
man osascript
The osascript
command accepts an -l
switch to specify the language with, either:
osascript -l AppleScript ...
or
osascript -l JavaScript ...
As for the choice, I personally prefer to use JavaScript most of the time, simply because it has various things like:
built in, and because AppleScript’s record/dictionary type is very hard to work with (we can’t ask it what keys it has, and it errors, stopping the script, if we try to use one that it lacks).
For macOS automation examples in AppleScript and JavaScript, see Apple’s:
Thanks–that’s really helpful.