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.
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 completely human readable. A lot of the commands are made to be read. Here are some examples:
- To declare a loop, it is a
- To break out of the loop, it is a
- To check if something is not equal
if varA is not "20" then -- Do something here else -- Do something else end if
- To make an application do something, use the
To me, these are very human readable.
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.
Lots of Mac apps support AppleScript. I have created a Keynote presentation that counts down from 1 hour all the way to 00:00:00, about 3300 slides, in maybe 15 minutes. I made a show control setup that fades down and pauses Spotify and also another one that fades up, skips to the next track, and plays the track at the same time.
Those were my quick observations. If you have any tips about AppleScript, let me know in the comments!
If you enjoyed this post and want more, please consider subscribing to my Patreon and checking out my other posts!