Implementing if then else logic for actions

Hi :slight_smile:
I was wondering if there was a way to implement some basic scripting logic for an action.
For example:
I have a drawing gesture that when I trigger it, I want it to trigger action Move Left a Space if it's on the right space , and trigger Move Right a Space if it's on the left space..
Is it at all possible ?
As a side note - it would be nice to implement Move to last used space action. (If possible)

For such kind of logic. I would suggest to use applescript widget.

It's a bit complicated. You can assign the "Run Apple Script" action and then call various named triggers you defined from that script, however you'd need to determine the current mouse position in the script and then trigger the "named trigger" based on that.

This is an example (old UI, but works the same now) of how to trigger named triggers via Apple Script Toggle mousedown & mouseup

Problem would be how to get the current mouse position in the Apple Script.

I also am looking for a way to toggle between spaces with a single trigger. My current workaround is just to use one trigger for "move right a space", and then to use another trigger for CMD-Tab to switch to the previous application. It works okay. But if anyone has figured out a way to "move to last used space", or if there's a chance this might be implemented, please let me know. Thanks :smile:

Edit: I figured out a solution that works if you only use two spaces. By attaching "move right a space" AND "move left a space" to the same trigger, you can effectively toggle between those two spaces. The reason seems to be that switching spaces takes enough time, that only one action has an effect.

I'm looking to implement an "if Mission Control is open" perform X-Y-Z, but I always forget where the option is.

1 Like

More specifically, I forget where the "As if opened" option is.