Page 1 of 1

Single Threading - GUI Scripting

PostPosted: 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.

Re: Single Threading - GUI Scripting

PostPosted: 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.

Re: Single Threading - GUI Scripting

PostPosted: 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.