I would like to have some sort of window that displays in real time the value of a variable.
I recently wrote a simple script to mute my microphone, then displays the input level (0% or 100%), but sometimes I might forget it it's currently muted or not. Therefore I'd like to see that value without running the macro again.
Any ideas?
FWIW the variable I would like to display is called "Microphone Level".
Yea I'm aware I can access them there. I actually have another macro that pops up a list of a lot of my most often used variables and allows me to change them. But I would like to incorporate this into two other macros that way it will pop up once a particular macro has run and disappear once another macro runs.
Sorry, I'm not clear on what you first macro is doing, or how you want to use it in other macros.
The KM Preferences > Variables Panel is the only way to make KM display Variable values dynamically as they are changed. An, of course, it requires that you have the Keyboard Maestro.app open.
IAC, here is an UN-TESTED idea:
Write a simple macro that only displays in a Display Text action the Variables of interest.
Call this macro (which I refer to as a "Sub-Macro") from any other Macro using the Execute a Macro action
Close the KM Display Window using AppleScript UI scripting when you are done.
I'll stop here until you confirm this is what you want and need further help.
Thanks for the quick responses. I'll give you a breakdown of what I'm trying to accomplish so it makes more sense.
I do telephonic interpreting. I have a macro that answers my incoming calls for, pulls up my work windows etc. I have another macro that hangs up the call and closes my work windows etc.
I recently wrote an Apple Script to mute/unmute my microphone that I run from Keyboard Maestro that way I can quickly mute the microphone in case I have to cough or something. It's an "all in one" script in the sense that if the mic level is 100 it sets it to 0, but if it's 0 it sets it to 100. Very simple; works great. Through Keyboard Maestro it saves the result (0 or 100, the current level of the mic) to a variable called Microphone Level.
What I would like to accomplish is write a sub-macro that will display that variable in realtime that way I can always see if it's muted or not. I would embed this sub-macro into my "answer call" that way once I answer a call it will run and constantly show me the microphone status. Then once I run my "disconnect call" macro it will close that window showing me the microphone status.
KM will only display a static value of a Variable at the time of execution.
So I would simply Display the Mute Status in the Mute Toggle macro when the mute is toggled ON.
Remember that you can use rich text in the Display Text action, so you can make it as big and bright as you like:
One thing you will have to do after the Display, is to set focus to some other window so you don't accidently press RETURN and close the window.
@peternlewis,
Then that really won't help us that much. We desperately need a dynamic display that is callable in a Macro.
What would really be great is a display of either a list of variables, or all variables with a given prefix. And this needs to work with Local and Instance variables, as well as a Dictionary (show all keys), or Dictionary.key list.