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 ScriptEditor dictionary for Automator.
To learn more about AppleScript and how to use scripting terms, go to AppleScript Language Guide.