Control Automator with scripts
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.