Let’s say I have macro A and B. Both triggers on new file in their folders A & B.
Let’s say macro A has triggered and will be running for about 1min.
While macro A is running I don’t want macro B to start, even if it’s triggered. Instead B should wait in line til A is finished and begin to run only when A is finished.
Easy fix for this?
The background problem is that multiple files are dropped in folders which triggers macros that do mouse movements on screen, running all macros at once creates caos.
I see at least two way you could design this:
- One macro triggered by both events
- Evalute the trigger value to determine what actions to take
- Use a Semaphore_Lock action (KM Wiki) to prevent the start of a second trigger while the first is still processing
- Set a KM Variable in each Macro that stores the status of the Macro.
- IF Macro_A_Status = “Running”, then Macro B will pause until it is “Not Running”
- Same approach for Macro A.
- Each Macro sets the status at the start and finish of the macro
This is exactly what a Semaphore is for.
Have both macros use the Semaphore Lock with the same name and they will go in sequence.