How can I use a switch in KM?

I’m assuming it has to be in an Applescript or shell script. Can you point me in the right direction?

1 Like

What kinds of switch? A switch statement like in C? Or a switch UI element?

Switch statement like in C.

There is currently no support for anything like a switch statement (it is on the potential plan for 7.0). The only option is an If Then Else action. So your choice is either:

If variable is A
    Do stuff
    Cancel [Just] This Macro
If variable is B
    Do stuff
    Cancel [Just] This Macro
If variable is C
    Do stuff
    Cancel [Just] This Macro

or

If variable is A
    Do stuff
Else
    If variable is B
        Do stuff
    Else
        If variable is C
            Do stuff

or use an external script to perform the action.

3 Likes