Use scripts with Automator on Mac
Automator lets you create automation without scripting, but you can extend the power of Automator by integrating shell commands, AppleScript or JavaScript scripts, or by controlling Automator with scripts.
Use a shell script action in an Automator workflow
You can string several bash shell commands together to perform complex tasks.
Drag the Run Shell Script action (in the Utilities category) into your workflow.
Click the Shell pop-up menu, then choose the shell environment.
Enter your shell commands in the command field.
Test your workflow before saving it.
Add AppleScript or JavaScript scripts to an Automator workflow
In Automator, you’re not limited to just the actions available in the Library—you can also add AppleScript or JavaScript scripts to your workflow.
Click Actions in the top-left corner of the Automator window, then select Utilities in the Library.
Drag the Run AppleScript action or Run JavaScript action into your workflow.
You can edit, compile, and test your script right in the action, or you can develop your script in Script Editor.
Control Automator with scripts on Mac
Automator is a “scriptable” application and can be controlled by AppleScript and JavaScript for Automation commands. You can execute workflows, create new workflows, add actions to workflows, get the values that are set within actions, and much more.
To see Automator commands available to scripts, use Script Editor, included with macOS.
In the Finder, open the Utilities folder in the Applications folder.
The Script Editor icon appears in the Utilities folder.
Open another Finder window, then open the Applications folder.
The Automator icon appears in the Applications folder.
Drag the Automator icon onto the Script Editor icon to open the Script Editor dictionary for Automator.
To learn more about AppleScript and how to use scripting terms, go to AppleScript Language Guide.