Single Threading - GUI Scripting

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Single Threading - GUI Scripting Mon Sep 04, 2017 12:06 pm • by jsturtridge
I want to call an MacOS application from Hazel but I can only use AppleScript GUI scripting for that application (i.e. it doesn't support native scripting ... grrr).

I want Hazel to call the application once for each file. I've written the AppleScript to call the app via its GUI and it works fine.

My question is:
How can I guarantee that Hazel is only going to execute the rules serially when they match my file criteria? If Hazel noticed that there were three files that met the criteria, I wouldn't want Hazel launching three instances of my AppleScript at the same time. Since, if there's a single instance of the other application, I should only be simulating one set of button and menu clicks at a time.

Many thanks indeed in advance.
jsturtridge
 
Posts: 3
Joined: Mon Sep 12, 2011 6:32 pm

Re: Single Threading - GUI Scripting Tue Sep 05, 2017 11:01 am • by Mr_Noodle
Hazel processes files serially. That said, depending on the AppleScript and how it is implemented in the app, control may return to Hazel before the other app finishes performing the actions.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Single Threading - GUI Scripting Tue Sep 05, 2017 11:10 am • by jsturtridge
Thank you, Mr Noodle! :D I'll be sure to put some delays in there to give the other app a chance to finish processing before I launch a new set of keypresses against it.
jsturtridge
 
Posts: 3
Joined: Mon Sep 12, 2011 6:32 pm


Return to Support