-
-
Notifications
You must be signed in to change notification settings - Fork 4
Applescript
Applescript was a great invention, almost a 'speakable' language, maybe a bit too much ahead of its time.
It has great taste and many innovations.
Such promising concepts such as 'on …' event listeners could have been taken to a new level.
Unfortunately Applescript was restricted to narrow use cases and never felt like a first class citizen even on Mac OS.
But it also had serious internal issues hindering its wider adoption:
Applescripts bindings to the underlying objects (system / objective C) were often hit and miss, ill defined or buggy.
Being closed source and Apple only ment that bug fixing, evolution and adoption of the language was slow.
The communication via Apple events was not embraced by other languages so that connecting custom components was hard. Scripting Additions were cumbersome. AppleScriptObjC and ScriptingBridge are ugly and poorly documented. Script Libraries have restricted locations(?).
The IDE was very lackluster (and bizarrely replaced source code with compiled code.)
While application Scripting Dictionaries are fantastic for discoverability, they seem not to be integrated with the IDE. Even after enabling code completion (needs explicit enabling in settings!?!) nothing appears when typing in the editor.
set x to "Hello, world"
x. # now what?
The general beauty was mixed with hideous syntax such as
changeCaseOfText("scripting is awesome!", "upper")
Which is of cause impossible to find within the IDE (luckily so).
Unexpected and in contrast to the welcoming syntax, batteries were not included:
To split and trim text one had to look up and copy little functions:
https://developer.apple.com/library/archive/documentation/LanguagesUtilities/Conceptual/MacAutomationScriptingGuide/ManipulateText.html
The extension "scptd" is offputting ;)
In any case Applescript is more beautiful than JavaScript for Automation (JXA).
Given that it is still evolving it might see a revival: It has finally sane comment syntax ('#' instead of '--').
characters of "Hello" # 'H' 'e' 'l' 'l' 'o'
length of "Hello" # 5
offset of "el" in "Hello" # 2
get the clipboard
set xyz to the clipboard
display alert (xyz as text)
set myFile to (do shell script "find … | head")
text 1 thru 2 of "xyz" is equivalent to
items 1 thru 2 of "xyz" as string.
set list to {1,2,3}
set myMap to {key:"value", myCount:2}
if item myCount of myMap is in list then return true
We want to learn from the mistakes of Applescript, which failed for the above reasons.