Cancel/Abort Just This Macro

In the Cancel_This_Macro action, I find the distinction between "Cancel this macro" and "Cancel just this macro" to be extremely useful. I'd love to be able to make that same distinction in other cancel/abort contexts, such as action timeout, action failure, and prompts for user input. The work-around is clear (don't abort/cancel but instead test for success after the action) but tedious. Am I overlooking some option? Or is this a Feature Request?

I'm just an average guy here. But nobody answered you so I'll try.

As for the Prompt action you refer to, getting such a feature added to that action might be a tough sell since it can be easily done the same way with the following action after the Prompt action:


And as for the other actions you allude to, I think they can be done almost equally easily using this statement to follow them:


Maybe you can confirm that these two statements represent the functionality you are looking for. Is this the equivalent to what you are asking for? Or do I misunderstand?

Your examples use exactly the work-around I mentioned: Test for success after the action rather than relying on the action's own built-in cancel/abort option.

Note, though, that the work-around would use "Cancel Just This Macro" rather than "Cancel All Macros", as in:

If what I wanted were "Cancel All Macros" (as in your images), I could just do this:

simply using the "Cancel Macro" checkbox with no post-action test required. The point is that the "Cancel Macro" option on the Prompt action implements "Cancel All Macros" and I instead want "Cancel Just This Macro". Similarly, the gearwheel specifications "Timeout Aborts Macro" and "Failure Aborts Macro" also implement "Cancel All Macros" and I want "Cancel Just This Macro". So, yes, I can get what I want by using a post-action test, but since the actions already offer one version of Cancel I'm asking that the the other versions of Cancel also be offered.

Hope that clarifies.

I think I may know why we are arguing. Because you definition of "macro" doesn't include the parent macros which called the macro that contains the "Prompt" action, while mine does. I'll bet (99 to 1 odds) that that's what you are thinking. That would seem to reconcile the verbal aspect of this discussion.

That also explains why you thought my example should have been modified to make sense. But under my definition of the word, my example actually makes sense.

So if the verbal issue has been resolved, now we have to discuss the technical issue. Maybe we both should compromise by clarifying our terms. If we both clarify our respective terms, my term could be "Macro Stack" and yours could be "Bottom Macro." I suspect you are asking for an option that cancels only the "bottom macro." Right now it cancels the "macro stack", but it certainly does NOT cancel "all macros." If your definition was right then KM would have to rename the action that says "Cancel all Macros" because according to your definition that would cancel only the macros in the current stack, not all the macros in the entire Engine (which is what it currently does.) What do you think the Editor should name the action currently called "Cancel all Macros", keeping in mind that it does NOT just cancel all the macros in the current stack.

I think the official term for "macro stack" that I've been using here is "Instance." So you want "Cancel all Macros" to means "Cancel Instance", and you want "Cancel Just this macro" to mean the "Bottom macro" only.

I can see what you want, and when I want what you want I solve the problem a different way. I typcially do it with this action:


Depending on my code, that can give me the same thing that you are asking for. Did you consider using this?

You're right that there's some terminology confusion. The terminology in my initial post was exactly what I intended, referring to "Cancel this macro" and "Cancel just this macro". The screen-shot in your reply used "Cancel all macros", which I had not mentioned, injecting a confusion which I failed to pick up on and then made worse in my reply. Apologies for that. So let's start from scratch.

The relevant terminology is here:

Cancel This Macro — Cancel this macro and any macros that executed this macro.
Cancel Just This Macro — Cancel just this macro, continue executing the macro that executed this macro.

In addition to the Cancel action itself, described on the Wiki page just quoted, there are several other ways to cancel macros. One is the Cancel checkbox associated with the Prompt for User Input action. A second is the gearwheel option "Timeout Aborts Macro". And a third is the gearwheel option "Failure Aborts Macro". As currently implemented, each of these three act as "Cancel This Macro" (as defined in the Wiki). I want the ability instead to specify "Cancel Just This Macro" in those three cases.

Now, beyond terminology, your "Break from Loop" reference makes me think we're not connecting at a more basic level, so here's another shot at that.

As a result of executing a KM action, it may be desired to cancel a macro. One way to do this is to include a subsequent action that tests what just happened, and on that basis determine whether and how to do the cancellation. This is what I called a clear work-around in my first post and which you used as your examples in your first reply. Works fine, I use it all the time.

But another way to cancel a macro is to use the capability built into the Prompt action itself and also into most other actions. For Prompt, it's the "Cancel Macro" checkbox. For other actions it's the Timeout and Failure gearwheel options ("Timeout Aborts Macro" and "Failure Aborts Macro", respectively). It's a lot easier and more straightforward to use those built-in capabilities rather than adding a post-action test. But the only cancellation functionality provided by the built-in capabilities is what's described in the above Wiki text as "Cancel This Macro". I simply want the option to choose "Cancel Just This Macro" in those built-in features.

Quick example: Suppose Action X might fail. If, as a result of that failure, I want to "cancel this macro and any macros that executed this macro", I simply make sure to check "Failure Aborts Macro" in the Action X gearwheel. Done! But if, instead, as a result of the failure of Action X, I want to "cancel just this macro, continue executing the macro that executed this macro," now I have to make sure that "Failure Aborts Macro" is not checked in the Action X gearwheel and then add an If/Then action testing the result of Action X and, if it failed, executing a "Cancel Just This Macro" action.

Are we reaching clarity at least of what I'm asking for, whether or not you'd find the capability of use?

Yes, so I was right, you just want an option that cancels the bottom macro in the current stack (and I was right about the word "instance," because in the web page you cited, it refers to a macro stack as a "macro instance.") I understood you completely.

There is nothing wrong with your request, as far as I can see. It's a perfectly valid thing to request.

When I want to "cancel just this macro" I often find that the statement "Break from Loop" meets my needs. If it doesn't meet your needs, I can't dispute that, but it certainly meets some of my needs whenever I want to end only the bottom macro in the instance.

Your wishes are clear. Your logic is valid. I fully understood your "Quick Example." But I'm not sure if it will persuade "The Architect." I've suggested many things to him, and only a few of my ideas made it into KM. It needs to be a good argument, and it may help if you show some code that does something real instead of just making an argument from a functional description. I'm just trying to help you, not argue with you.

I remember asking for years that the Execute Shell Script action needed to have a way to send it input from (and output to) a variable. It was years before that was implemented, and now I use that feature about 50 times per day. I think I also begged for an OCR action, and eventually we got that too. Maybe I was just one of many people asking for a feature.

Personally, I think that putting those options into that cogwheel was a mistake. I think it should have been visible in the body of the action for all to see. And with even more options in the cogwheel, as your idea may require, that's even more reason to get rid of the cogwheel.

OK, I think we're in synch. Still confused about


Is there some reason to prefer "Break from Loop" over "Cancel Just This Macro" or are you simply noting that there are two ways to accomplish the task? In either case a separate action must be used (versus the action-option that I'm suggesting be added to KM).

I could argue that if you want to cancel a macro, then "Cancel Just This Macro" is a clearer indication to someone else reading the code than "Break from Loop", since, with the latter, the reader must look to see if there is, in fact, a loop that's being terminated vs the entire macro. I could argue that, but I won't. :slightly_smiling_face:

The true and correct answer to your question is that I just picked the first solution that came to my attention. I didn't need a second method. Another way of looking at it is that I lack intelligence.

I'm not even sure if I've ever used "Cancel Just This Macro." I want to search my macros to see if I've ever used it, then make sure I wasn't expecting that code to cancel the entire instance.