Is there a way to trigger a macro when all of several conditions are met? For instance, I want to connect to a VPN when my work WLAN is connected AND the fileserver is disconnected. The trigger configuration now only triggers when ANY of the conditions are met.
This could work. Main trigger checks for the WLAN and the if/then condition checks for the volume mount. You could flip the conditions, or nest more, if you need to fine tune the macro's response to how the conditions occur in the real world.
Yep, this works well. I have used this pattern often.
From a performance POV, you want to put the event least likely to happen as the actual Macro trigger, so that your macro does not waste time in the other IF conditions.
Just to be clear, what you are asking doesn’t really make sense.
Triggers are events. They happen at a specific time. So the macro triggers at that specific time.
They are not states - they do not continue to be.
So the trigger is “the Mac just connected to wifi X”. That happens at a specific time when the Mac connects. After that the Mac may well remain connected to the network, but that is a state, not a triggering event.
So two events don’t happen at the same time. The wifi is not connected at the same instant the file server is disconnected.
So you may need to trigger on both events and then determine which state you are in as to whether you want to trigger. And you may need to remember what the previous state was in order to determine whether you should trigger again or not.
It depends on exactly what you are trying to do.
But you have to understand that triggers are events/changes, not states, so you can plan your macro appropriately.
Peter, I think the intent of the OP's question does make sense.
Yes, the KM trigger is fired when something changes, and event.
But several events could have happened, producing certain states, that are all required before one wants to execute a KM macro.
So that is why I stated that the actual trigger should be the event which happens the least often. Then the macro can check for the other states needed before executing the meat of the macro.
I wasn't saying that the question doesn't make sense per se, just that the concept of the title of the topic, basically the concept of and'ing triggers, does not make sense in itself.
You can make a trigger (event happening) conditional on a state (which is what Macro Groups do), or you can have your macro detect state and behave differently (or not at all) after being triggered. But you can't have triggers and'ed together per se.
Sure. But triggers do not imply ongoing state. The fact that the wifi connected trigger fired does not actually mean you are still connected to that wifi. Triggers define events.
Depending on what the OP wants to do, that may well be the best course.
But if the OP wants to detect when the wifi is connected (only if the volume is mounted) as well as when the volume is mounted (only if the wifi is connected) then they would need to trigger on both wifi connected and volume mounted. Triggering on just the less frequent occurrence would not accomplish the task.
I get it.
That's why I said the "intent" of the OP. You are responding from a very technical POV, which uses need to understand. I'm responding from a "how to solve the problem" POV.
Perhaps a better title would be: "How to trigger a macro when multiple conditions are met?"
I know macros are triggered on events, when things change, but what if you need multiple events to happen before the macro is triggered?
Each event causes a change in state.
OK, so in that case the macro would need to be triggered if either of these events occurred, and then the macro would check to ensure that both states are currently in place.
KM is designed to trigger a macro if ANY of the triggers are encountered. So this should work fine.