Cancel a different macro?

I have a macro that copies items from a website, and it's set up in a until loop. There's a pause for keys at the end of the loop that allows me to wait until I want to copy a new page.

I'm trying to cancel the copying macro hen the pasting macro is used and I don't know how to reflect that.

I thought "Cancel a Specific Macro" would be what I was looking for but it's not for that i've now seen. I tried setting up the copying actions in a while loop and put the keybinds of the pasting macro as the condition that breaks the loop but that didn't work either. What's the best way to do this?

If I understand your question correctly, you might want to try setting a variable in the one macro, that the other macro checks during its loop to see if it should quit. Does that make sense?

Have you seen this:

It may or may not be what you want.

But another way of telling another macro to cancel is for Macro B (the macro to be cancelled) to be in a While action loop that checks a Global Variable (say "CancelNow") for a specific value. So While "CancelNow" is not "YES" continue the loop.

In Macro A, when you want to cancel Macro B, set "CancelNow" to "YES".

Make sense?

I suppose another solution to this requirement is to send a signal to the other process using a semaphore. That is, to force another macro (macro B) to terminate you could lock a semaphore in macro A then inside macro B wherever the processing might be occurring (eg, in a loop) you try to lock the same semaphore and if the semaphore is already locked you simply abort the macro. Seems like a clean solution to me. I guess it works a lot like Dan's idea, but using semaphores instead of variables.

Thanks Guys! Dan's suggestion ended up being the easiest for me to implement but the other two solutions definitely would work and exploring them I've been able to learn a bit more about the program and could see how they will be useful in other cases

1 Like