Run AppleScript
Runs an arbitrary AppleScript snippet in the context of the selected browser.
In your script, set the variable RETURN_VALUE
to your return value, it'll be returned as JSON-encoded string.
Returns
A pretty-printed JSON string containing the data your script stored in the variable RETURN_VALUE
. I know that this means the sky's the limit, but please don't go overboard and keep it simple. 😅
When the variable RETURN_VALUE
could not be JSON-encoded, an error will be raised.
Parameters
AppleScript
A string containing an AppleScript which will be run in the context of the selected browser.
Browser
Lets you select from the list of supported browsers. Accepts a browser reference as input.
Example
Here, we set up a native "Text" action containing a simple AppleScript snippet which will return the current window count for the selected browser and a timestamp string as a list:
set RETURN_VALUE to [count of windows, (current date) as text]
We use the result of this action as the AppleScript input parameter for the "Run AppleScript" action, and select Brave Browser. When run, the action will take RETURN_VALUE
and convert its contents to JSON. The output of the action is:
[
9,
"Friday, 6. October 2023 at 18:50:38"
]
Screenshot: