Member-only story
Apple Script Observations
This post is going to cover some observations about using AppleScript.
This is going to be a fairly informal post since it’s my thoughts and observations.
Variables… where are they declared?
I was a bit confused because variables are not declared any one.
In Swift, variables are always declared before they are used.
var name: String // or use type inferencing
var name = "Maegan"
In AppleScript to declare a variable the command is set var_name to "var_value"
. I realized I wanted all my variables to be declared in a central place while working in AppleScript, but I couldn't really do that.
AppleScript is very human readable
AppleScript is completely human readable. A lot of the commands are made to be read. Here are some examples:
- To declare a loop, it is a
repeat
command. - To break out of the loop, it is a
exit repeat
command. - To make an application do something, use the
tell
command
To me, these are very human readable.
There are no brackets!
While the commands are human readable, the nesting of code is not as human readable. There are no brackets and ScriptEditor.app does not have guides so the nesting can be hard to follow.