FAQ  •  Register  •  Login

Is action order guaranteed?

Moderator: MiRai

<<

Finney

Posts: 81

Joined: Fri Jul 05, 2013 8:49 am

Post Mon Jan 08, 2018 11:09 am

Is action order guaranteed?

I did a quick search and didn't find this answer.

When we enter actions in a step of a mapped key, do those actions always occur in the order we put them, or can they theoretically occur in any order?

I ask because, out of habit, when appropriate I've always put the "disable this step" action at the bottom of the list. But when I forget to do that, it doesn't seem to hurt the step. That has me questioning whether order matters for actions in a step.

Now I'm in a situation where I'm creating a click bar with a set of mutually exclusive buttons. What I want to happen is the clicked button to change color to show it's active, and the rest of the buttons to go back to their normal color. I have 10 buttons. I could add 10 actions to each mapped key (one to highlight the current button; 9 to un-highlight the rest) but I would rather create a separate mapped key to un-highlight all the buttons, call that mapped key, and then create one action to highlight the one I care about.

(I'm getting wary about how big my profile XML size is getting. I just did a major cleanup to shrink it from 8MBs down to 6MBs. ISBoxer is straining under the load a bit. I'd rather not add ~100 actions if I can get away with ~20.)

Thanks.
<<

lax

User avatar

Site Admin

Posts: 7301

Joined: Tue Nov 17, 2009 9:32 pm

Post Mon Jan 08, 2018 11:27 am

Re: Is action order guaranteed?

It mostly depends the Target for each Action.

Consider what is happening for like. .. Click Bar State Action -> self, vs Click Bar State Action -> all. Actions processed by "self" can be processed immediately, synchronously, in the order given from top to bottom. However, the Action sent to "all" is sending a message to all of windows including itself, and then it gets processed when that message is received. All of those messages sent from the same Step will get sent from top to bottom (with few exceptions for certain Actions -- Send Next Click Action comes to mind) in order and then processed in that same order as received.

So if you have a Step full of Actions that mix between "self" and any non-self Target, the "self" Actions are basically all guaranteed to execute immediately, and then followed by all of the non-self Actions. Sometimes that can be important, because if you want an immediate effect in the current window you may need to split one "all" action into one for "self" and one for "all other".



As far as "disable this step", as you've discovered this does not abort the Step currently in progress. Whether the order of this Action matters or not depends on what you're doing after it (for example, if you were to have a Do Mapped Key Action that executes this Mapped Key again, it would be forced to either do nothing or a different Step), and yes the order can be guaranteed as described above. :)
<<

Finney

Posts: 81

Joined: Fri Jul 05, 2013 8:49 am

Post Mon Jan 08, 2018 1:17 pm

Re: Is action order guaranteed?

Excellent info. Thanks for the quick answer!

Return to Key Maps

Who is online

Users browsing this forum: No registered users and 0 guests