Add AppleScript scripts to a workflow in Automator on Mac
Automator lets you create automation without scripting, but you’re not limited to just the actions available in the Library. You can use the Run AppleScript action to add AppleScript scripts to your Automator workflow.
The AppleScript script can interact with the other actions in your workflow. It can receive input from the previous action, and return results to the following action.
Click Actions in the top-left corner of the Automator window, then select Utilities in the Library.
Drag the Run AppleScript 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.