Difference between Group enable/disable vs. activate/deactivate

Hi, I have the following problem with a macro, that flips a state in variable, then switches the group and finally shows the result:

Macro: “modeswitch”

  1. Disable group ‘A’
  2. Hide a palette that indicated that state ‘A’
  3. Enable group ‘B’
  4. Show a palette tht indicates that state ‘B’

Now the problem:

The palette in step 4. shows only for a little moment and than disapears.

If I ‘deactive’ instead of ‘disable’ the group, than the palette persists.

Questions:

Can somebody explain me the difference between disabling and deactivating a group?

Is there an explanation why the pallete disapears with ‘disabling/enabling’ of groups?

Thank you.

The primary difference between enable/disable and activate/deactivate is that the former is a semi-permanent, editor visible, syncable change. The latter is a transient change, a change of state of the engine.

Essentially, the concept of Enable/Disable stems from enabling and disabling groups/macros/actions in the editor, while the concept of activate/deactivate stems from macro groups being active or not in a specific application.

The reason for the different behaviour described probably relates to the macro reloading that will occur in an enable/disable case (especially if the editor is running).

Thank you very much for this explanation.
As a side note: Maybe this could added to the manual?.
Regards Ben

So really trying to wrap my head around the use cases of deactiivate versus disable for the past few days and experimenting with behaviors of deactivate since I hadn't really ever used that action and trying to understand what I don't know.

When I use deactivate as you said it is not syncable and only happens on one machine where as if I disable as always it will also be disabled on all the machines that sync my macros. If I switch between applications and come back to the application that Keyboard Maestro only executes macros in based on the diactivate that I did earlier Keyboard Maestro will persist in it being deactivated which makes sense.

As I think you are stating here the group only becomes reenabled after I restart the engine.

The following behaviors seem counter-intitutive and I am not sure if they are by design but if it is hopefully that can be updated and stated in the Wiki.

  1. If i I reenable a macro group that has been deactivated (not disabled) then the deactivated group becomes activated without having to shut down the engine. So reenable over rides disable though they are two different things.

  2. If that is by design then it would make sense if you have Display Toggle checked that when you reenabled a macro group that it also pops up the display to let you know that the group has also be reactivated.
    image

  3. I can not just press run from Keyboard Maestro (Editor) and have a group toggle activated or deactivated or just choose deactivate and have that work. I have to use the keyboard shortcut for that to work.

It seems worth noting in the wiki that enabled state always over rides activate state of a macro group. It seems like it would be rare instances that you would use deactivate but could help for a temporary use case to disable and if you want it to always come back on in case you forget when you restart the engine or you computer Deactivate would be the action of choice.

This is probably obveous but also worth stating that you can not have a toggle macro Activate/Deactivate in a group that deactivates itself just like the enable/disable or you can not reenable it.

There was some interesting behavior when moving a macro that deactivated a macro group that it was in when dragging to another macro group that was active for the same application made it so I couldn't actually run the macro again though it wasn't in that macro group anymore and in an active one until I restarted the engine. That of course is an edge case scenero and probably not worth addressing.

It seems reasonable to show a little red dot in the editor for macros that have been disabled in the engine with this action as a visual. If you restarted the engine if Keyboard Maestro saw it was restarted then would just remove all red dots next to macro groups since that is the behavior. With this request I acnowlege there may be something here I am missing and of course recognize that when you toggle away from applications you wouldn't want to see red dots in all the applications that are not "active" based on their group preferences. I am just requesting that if you explicetly run a deactivate and that pop-up happens that the engine also put a red dot in the editor next to the macro group.

I don't totally understand the second paragraph though I have read it several times.

I think "overrides the Groups activation criterion" means overrides the disabled state of the macro group, which is not true if that is what it means. But overall it seems that Activate/Deactivate was meant to be more lightweight then Enable/Disable.

They aren't different things -- they're a hierarchy, and evaluated in the order shown in the Group settings.

When you fire off a trigger the Engine looks at:

? Is the Group "Enabled":
   1. If "Disabled", STOP HERE -- DO NOT TRIGGER
   2. If "Enabled":
      ? Is the Group "Available" in the current application context
         1. If "No", STOP HERE -- DO NOT TRIGGER
         2. If "Yes":
            ? Is the Group "Available" for the current focused window
               1. If "No", STOP HERE -- DO NOT TRIGGER
               2. If "Yes":
                  ? Is this Group currently "Activated"
                  1. If "No", STOP HERE -- DO NOT TRIGGER
                  2. If "Yes", HURRAH!-- TRIGGER MACRO

I think Peter is saying that, unlike "Enable/Disable", activation state is not saved -- it is held in the Engine's "runtime memory". Quit and relaunch the Engine (or force a reload some other way) and the Group's settings are reevaluated, and so you lose any change you made with the "Activate/Deactivate" action. Which is also why this:

...happens. When you enable the Group the Group's settings are read back into the Engine again and activation is again dependant on the Group's activation condition rather than your "temporary" change.

Please stop conflating "disabled" and "deactivated" -- they really are different things! And, as I hope you can see from the above, having an indicator for "Activated/Deactivated" would require the Engine to be constantly sending update messages to an open Editor -- because even your "Deactivate this Macro Group" action's results are transient, and an incorrect indication of state in the UI would be worse than no indication at all.

No -- it means exactly what it says. If you have a Group that is "Activated for one action when:" and with no "when" set, you can use the "Activate for one action" Action to override that Group setting and programmatically make the Group available for one action.

I've asked before and I'll ask again -- why do you want to know if a Group is active or inactive? As a transient state that can't be relied on, wouldn't it be better to either test and verify when required or to always explicitly set the state to what you want?

Or, and maybe better, not use it? It does feel that you are trying to use "Activation/Deactivation" when "Enable/Disable" is the better option -- they are different things, so have different use-cases.

It's not that it overrides the state, it is that a disabled macro group does not have any activation state - it is disabled.

Activation is a state of an enabled macro group.

Activation state is optionally shown in the toggle display because it is a transient state.

Basically, enable/disable is something you do in the editor. It is designed to be more or less permanent. So it is not something that is shown with a toggle, because it should not generally be changing. You can change the enable state from the engine, but it is still something that is designed to be more or less permanent.

I don't understand what you mean.

You use deactivate activate implicitly all the time - every time you switch between applications, the macro groups that are application-specific activate/deactivate.

Yes, it does seem fairly intentional that if you disable or deactivate a macro group, then macros in that group will not be able to run to re-activate or re-enable it.

I have no idea what you mean.

If you move a macro from one group to another, then the engine will reload the macros, and if the macro is now in an enabled and active macro group, and is itself enabled, then it will be available to be triggered.

I presume you mean deactivated. If they are disabled, then the editor show that.

The editor does not show engine state.

My appoligies on the delay to reply here. I wanted to really dive in and give these replies proper time and to digest them.

Absolutly, I think I typed the wrong word in but not what you quoted there.

Yes, that is what I meant. Sounds like the editor will never show the engine state and that is by design.

I think I am understanding how the engine works a little better and I wasn't requesting this for when you switch between applications that enable macros to show when they are run but only when you choose to specifically deactivate (not disable) a macro group or macro. It would happen only when that is run to deactivate or activate in the editor (not at all a constant thing).

Because it is not transient. It is only transient as long as you have the Keyboard Maestro Engine Active and then when you quit it and run it again does the group become active. I do not want to see macros that are inactive because the current application is not in the front because of the group settings, only Macro Groups and Macros that are explictly called on by the Activate/Deactivate macro. I hope that is more clear now and thanks for your patience with me in trying to understand what I am after.

Yes, I think for the most part I will probably just stick with "Enabled/Disabled" and only use the "Activate/Deactivate" if I always want to make sure that I want that on the current computer I am working on and not on a syncing macro file on another computer. Also if I don't want to have to remember to reenable it but for the most part I would figure that out quickly just looking in Keyboard Maestro.

That makes sense to me and I am understanding the hierarchy better.

That makes sense so not worth bothering programing a visual in the Keyboard Maestro Editor. When in doubt restart and quit the engine and all would be back to normal.

It is working now but at the time I had clicked the Run button on the Activate/Deactivate macro and it wouldn't work and would only work if I pressed the key command assigned to the action.

Yes, totally have that one down now thank you and of course doesn't hurt to say this just incase. I am really only talking about using the action to deactivate a group or macro.
image

All good and no worries about spending any time with this one. I think as I moved the macro in and out of a macro group I was deactivating that made it so the run button didn't work as mentioned up above. Not worth spending anytime on, just some things I noticed as I spent a while learning about the use of the Activate/Deactivate action.

Yeah maybe just an ID10T error on my part.

Thank you both for your help on getting my head wrapped around when I would use Enable/Disable vs Activate/Deactivate. I will again likely just stick with the former for the visual in the Keyboard Maestro Editor.

It is transient. Transient is the opposite of "persistent". Compare activation with enablement -- activation state is a property held in working memory of the Keyboard Maestro Engine (transient), enablement is written to the plist and stored (persistent).

Sorry -- I don't understand this. Can you explain what you are trying to do?

Toggling "is active" isn't a guaranteed method of determining whether or not a macro executes. And not just because the state might change after Engine reload -- you can still execute a macro in a "deactivated" Group via the Editor's Run button or with an "Execute a macro" action, for example.

That said -- you could create your own "activation state monitor". For known macros/Groups you could use an "If" with the "Macro" Condition. You might even be able to set things up so that running a macro to deactivate A also started a monitor of A, with eg a refreshing HTML prompt as a reminder that A is currently manually deactivated...

Got it I see where our terminology forked and you are right. So I guess what I was really saying is that showing an icon in the editor that a group has been deactivated (transient). That would mean the editor would also need to show transient behavior by getting from RAM what is in the Keyboard Maestro Engine on the computer you are working on. Otherwise it would show on other computers that use your syncing macros and not be an accurate depiction that the group has been deactivated on another computer syncing to those macros.

See above.

Aboslutly and yes, yes to that. Other than the little glitch I ran into where I couldn't run a macro group that I had moved while also deactivating a macro (not worth perusing that issue) I couldn't press the run button but the trigger for the macro worked. Anyway, yes you are right and I am solid on this point I think, I have understood that with Enable/Disable (other than until a while ago that you could still call on macros that are in disabled group and apparently deactivated groups from another macro other than calling on it through AppleScript).

That is a pretty bright idea I like it. I love that for so many issues or things requested for Keyboard Maestro Keyboard Maestro seems to solve its own requests through ideas like this. Thanks for that.

Nope, sorry, still not seeing it.

Perhaps you mean "I would like to temporarily stop this macro from running on this machine but still have it execute on others, which 'Disabled' won't do because that syncs to the other machines"?

It's all good, I don't need to spin your wheels anymore. Here are two other ways of wording what I meant.

  • "I should use 'Activate/Deactivate' only when I want to ensure that the setting applies specifically to the computer I'm currently working on, rather than affecting a synced macro file across multiple machines."
  • "I’ll use 'Activate/Deactivate' only when I need the setting to apply exclusively to my current computer, avoiding any unintended changes on a synced macro file shared with another device."

You don't need to read this but just to finish it out. The reason I said "see above" is because I was refereing to this statement of what I was originally after of seeing some indicator that a macro action deactivate was explictly run to display a red dot (or some other indicator) in the Keyboard Maestro editor macro or macro group depending on what was deactivated.

Anyway, in short I am good and thank you for all your help and sticking with me on this, you are a trooper!

Not a problem -- it's cold and raining and it's either this or do some (unpaid) overtime... This is way more fun!

The reason to trying to clarify is that I think we've got tied up in the details and it would be good to go back to what you're actually trying to achieve.

And the reason for that is that there's a difference between "I don't want anything in this Group to trigger on this machine" and "I don't want this particular macro to do anything on this machine".

The for the first -- if you haven't played with the Group Settings "Disabled on this Mac" option, give it a go. If I'm understanding your use-case I think it does just what you want, including showing the Group in the grey-ed out "Disabled" state in the Editor of appropriate machines.

If it's the second, where you're considering individual macros within a Group, I think you'll have to settle for "doesn't do anything". That's relatively easy -- start the macro with a test against %MacUUID% and insta-cancel the macro if true. You could write a macro that added/removed that kill switch for currently-selected macros, and include particular text to use in a Smart Group so you could always see which macros are currently killed.

3 Likes

Haha, well thank you! I am grateful that at least you are having some fun.

Yes, absolutely, and my apologies if I made it sound like I thought otherwise.

Yes, thank you I absolutely love that feature and have been using it for years and have several macro groups for that purpose.

This is very smart and absolutely leads me on a good path. Thank you for those suggestions and ideas. I'll add that to my to do list!