Creating a Queue Manager and Pause Until Limitation?


I have a macro that copies files to various locations based on variables and user input (Date, media type, etc...).

I want to be able to submit the copy macro as many times as needed (usually no more than 6-7 times in the queue at any moment), but because of drive speed limitations I can only run 2 instances at a time.

I currently have a macro that counts and calculates how many times it's been submitted so that there are only 2 running at a time, so that part I have working. I have the Pause Until variable set to continue when running instances is <= 1.

However, with the Pause Until action, it will wait until at least one of the first two are done, then continues with the script. This seems to be the the correct function for the Pause Until action but I want to queue 6-7 copies then let it run but only two at a time.

With it as it stands, I can have two running and one queued, but the 4th one waits until the 3rd one runs, and the 5th waits till the 4th one executes, etc, etc...

Is there a better or different way to create a queue to execute the same macro multiple times, but only have two instances running at a time?

I’ve always used the KM Semaphore actions to control multiple simultaneous executions of the same macro. You can find info on it here action:Semaphore Lock [Keyboard Maestro Wiki]

By default it maintains a queue and permits one instance to run at a time, so you might need to rethink your desire to run 2 at a time. On the other hand you might be able to weave it into your already-existing logic somehow.


If you are writing to, or reading from, the same volume you might find that even only two parallel ops are slower than two sequential. Try @tiffle's suggestion and see how you get on.

1 Like