Add JavaScript scripts to a workflow in Automator on Mac
In addition to AppleScript, Automator supports JavaScript for Automation, which lets you create automations using JavaScript. You can use the Run JavaScript action to add JavaScript to your Automator workflow.
The JavaScript 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 JavaScript action into your workflow.
You can edit, compile, and test your script right in the action, or you can develop your JavaScript in Script Editor.
To learn more about JavaScript for Automation, go to JavaScript for Automation.