do shell script to call automator to run workflow...

Hi all.

Today I was doing little research what is possible with AppleScript.

So i made this AppleScript to call 'Automator Workflow" from AppleScript.

So I made a Automator workflow with only 1 action “Website Pop-up”

To try this AppleScript you need to have a Automator workflow with Website Pop-up action.
saved on desktop of your computer.

It’s very slow… so my question would it be possible to make it faster??.. Shane ;)…

set thisURL to "https://www.apple.com"

set theWorkflow to POSIX path of (path to desktop as text) & "webPopUp.workflow"

do shell script "automator -i " & thisURL & space & theWorkflow

Thanks.

You can do it via ASObjC – I don’t know whether that’s faster. It’s best done on the main thread, so it’s a little more complicated, but still simple enough:

use AppleScript version "2.5" -- macOS 10.11 or later
use framework "Foundation"
use framework "Automator"
use scripting additions
property theResult : missing value
property theError : missing value

on runWorkflow:theObject
	set {theURL, theInput} to theObject as list
	set {my theResult, my theError} to current application's AMWorkflow's runWorkflowAtURL:(theURL) withInput:theInput |error|:(reference)
end runWorkflow:

set thePath to "/Users/shane/Desktop/Sample.workflow"
set theURL to current application's NSURL's fileURLWithPath:thePath
my performSelectorOnMainThread:"runWorkflow:" withObject:{theURL, missing value} waitUntilDone:true
if theError is not missing value then error theError's localizedDescription() as text
return theResult as list

Thanks.

It was not faster on apple website, but I guess Apple have not update Automator for long time
so I didn’t expect miracle.