I agree, the "natural" syntax is awful. Worst of both worlds. Terrible for experienced programmers because the syntax is so bad; terrible for beginners because it pretends to be natural but isn't.
Fortunately they offer a (barely documented) JavaScript alternative these days.
At first it seemed cool, but I quickly found it to be perverse and incomprehensible.
These samples are from Apple's Guide:
set numClowns to 5
--result: 5
set myList to { 1, 2, "four" }
--result: {1, 2, "four"}
tell application "TextEdit"
end tell--result: some word
"DUMPtruck" is equal to "dumptruck" --result: true
considering case "DUMPtruck" is equal to "dumptruck" end considering --result: false
I DID NOT MAKE THIS UP
on raiseToTheNth(x, power)
end raiseToTheNthThe good news is that you can control an app as if you are interacting with its GUI and all the features are in there somewhere, somehow.
tell application "Finder"
end tellThe bad news is a syntax from hell and how do you discover the available idioms?
The facility can be turned into an abomination when you interface from a shell using the osascript shim.
It's so bad that if I have to use it I can't help but fall in with it love because a working script seems like a minor miracle to be recorded in a religious tome of divine encounters.