scowby
December 14, 2016, 2:21am
1
I’m trying to do something very simple:
I want to create a variable ‘x’ and set it to the value of 5. I want to add 5 to that variable, and then set the clipboard to this value.
I have a "Set Variable ‘x’ to Text ‘5’ action.
I then created a "Set Variable ‘x’ to Calculation ‘x+5’ action.
I’m trying to output the value of the variable ‘x’ to the System Clipboard but cannot figure that part out.
Guidance appreciated!
scowby
December 14, 2016, 2:46am
2
I believe I figured it out:
In order to reference the actual variable I need to enclose it with percent signs, so what I ended up with was:
Set Clipboard to Text ‘%x%’
One note, on keyboard maestro 7, when you click the “try” button it is NOT executing the full macro. It is only executing ONE SPECIFIC ACTION - the one you have highlighted. This tripped me up for a moment.
Try this:
Regarding the "try" button, it works on all selected actions. So you could select all actions before using it.
As an alternative, try this macro - I use it constantly:
MACRO: Run Current Macro
UPDATED v1.2.1 2016-08-10: Increased timeout
UPDATED v1.2: If you run this macro when the Keyboard Maestro Editor is not the active application, you will be asked if you want to continue or not. Also, the TriggerValue prompt now includes the name of the macro, Thanks to @JMichaelTX for his suggestions and code examples,.
Run Current Macro v1.2.1.kmmacros (44.8 KB)
This is quickly becoming one of my favorite macros, and I just wrote it this morning!
Assign a hotk…
1 Like
scowby
December 14, 2016, 3:17am
4
Great thank you.
Interesting that you used:
%Variable%x%
instead of just
%x%
. For me, the latter one worked. Why use the former?
The latter (%x%) is a short form, which will work fine right up until I add a token named x and then that will take precedence over your variable.
I probably wont ever make a token named “x” (well, I suppose it could have the current mouse X coordinate…), but generally the long form is preferred.
1 Like