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.
You’ll see the Script Editor icon.
Open another Finder window, then open the Applications folder.
You’ll see the Automator icon.
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.
To learn more about AppleScript, go to the AppleScript website.