Newbie looking for an explanation on the use of the Execute command to run a script targeting Script Editor in vs. 2.11.
I have read some dated material about an Execute command that can be used in a script that creates a macro (script) and then compiles and runs it. The Execute command returns an error.
I looked in dictionary for Script Editor and don’t see an Execute command so that makes sense. I just guessed the command might have been changed to Run and that worked, but I don’t see Run in Script Editor’s dictionary either. Does anyone know why Run works if it’s not in the application’s dictionary? Here is the script.
The features of macOS, AppleScript, and Script Editor also change as the versions go by.
In macOS 10.14, the “execute” command has been removed from the AppleScript dictionary in the Script Editor. On later macOS, the execute command is not available.
And there is no such thing as a “run” command.
Instead, there is a command called “run script”. In this case, it is better to use the run script command.
In the tell block of the Script Editor, you can not only use the commands of the Script Editor. You can also use AppleScript’s built-in commands.
“run script” is one of AppleScript’s many built-in commands.
Your script will be modified to…
run script "say (date string of (current date))"
AppleScript programs do not work as expected by the user unless the user specifies the priority of expression evaluation in detail. You presented one was exactly that, and it didn’t work as it was. It is important to enclose the functions and commands you want to interpret in parentheses.
The execute command has been removed from the Script Editor, but the Script Debugger still has the execute command in the AppleScript Dictionary. Give it a try and you’ll be able to do what you want.
Thanks so much @Piyomaru for the detailed explanation, and for your advice on specifying priority in expressions. This was very helpful and I’ll give it a try. J