Hello, I'm new to KM.so Pardon my noobness. I've been using Autohotkey for windows. I wanted to have a similar function in KM and M1MacPro.
Basically what I want is a mouse get and mouse move action
Is it possible to add an apple script instead of using the Mouse move actions? That When I use the CONTROL Modifier and with the trigger, it gets the mouse coordinate and saves the x,y, in the action. And when pressed without the Control modifier mouse move at the saved x,y coordinate.
ie...press Control+F1 = saves the current mouse coordinate where the mouse pointer is
press F1 = moves the mouse to the x,y coordinate.
Yes, there is a Mouse Action but I don't want to setup manually. All I want is to use modifier +the trigger to get the Mouse x,y.
I will be grateful to those who can help me. Thank you.
The first one has the trigger ⌃F1 and saves the coordinates of the current mouse to a Variable (I named the Variable "SAVED__Mouse" but you can name the Variable what you want).
The second Macro has the trigger F1 and uses the coordinates saved in that same Variable to move the mouse to that coordinate.
To break down what is going on. In the first Macro, %CurrentMouse% is a Keyboard Maestro Token that will always be the coordinates of where the mouse currently is. Notice the greyed out numbers at the bottom of the first action - they show what the Variable SAVED__Mouse is currently storing and what it will store if you ran the Macro now. If you have the Macro open in the Editor and move the mouse around you will see the second set of numbers changing depending on where the mouse is.
So, 1753,932 is the current mouse x,y location.
And in the second Macro those coordinates (which were grabbed in a kind of snapshot when the first Macro was run and stored in the Variable) can be used to restore the mouse location.
ANd Is it possible to Put both Assign and restore mouse in One Macro? say Pressing a MIDI Key to Save coordinate and pressing another MIDI key to restore but put in a singe macro? Color.kmmacros (17.8 KB)
When you use something to trigger a Macro in Keyboard Maestro that "trigger value" is known to Keyboard Maestro in a Token %TriggerValue%
So, you can set up a Macro to fire with two triggers (eg Channel 1, Note 1 and Channel 2, Note 1) and do different things depending on what was actually pressed (the value stored in %TriggerValue%).
I don't have a Midi device hooked up right now but from the Keyboard Maestro manual it says that the Values stored when Midi Keys are used as Triggers are a comma separated list:
So you can use this information to set up a Macro that does two different things depending on what was actually pressed. Something like this, (where the Green Actions would be replaced by saving and restoring the mouse position).
Going forward, you can also directly see what values are held in %TriggerValue% by making a simple test Macro that displays them, something like the below (this would display the value ⌘A when triggered by pressing ⌘A)