Jump to content
Macro Express Forums

Challenge: a hotkey to enable and disable Macro Express Pro scripts

Recommended Posts

I constantly disable and re-enable scripts in the Macro Express Explorer. For example, in the screen below, the top four scripts are enabled, and the last one is disabled. The first four scripts are active, and the last one is inactive.







I disable and enable often enough that I realized, at some point, that a hotkey would be the most efficient way to do this. But there is no built-in hotkey. So I used Macro Express to produce my own. I chose Alt + B because B appears in both words, "Disable" and "Enable." But choose whatever hotkey you want!


Here are some of the many non-hotkey ways to disable and enable a script:


- Choose a command from the "Macro" menu

- Right-click the script and choose a command from the context menu

- Open a script's "Properties" and check/uncheck a box

- Open the script, navigate to the "Miscellaneous" tab, and check/uncheck a box.


While experimenting with different methods, I realized some methods work better than others. Some methods work a lot better! Although I think I finally settled on a reliable solution -- which I'll share -- I'm curious how others might crack this puzzle.


The reason I'm posing this challenge is because a reliable solution can probably be generalized when automating other tasks in Macro Express Explorer.

Link to comment
Share on other sites

It is pretty straightforward if you routinely enable / disable one particular macro or set of macros.  For example, the snippet below toggles the state of a single macro and briefly displays a text box confirming which action is being taken.   


If Macro "11_keep_computer_awake" is disabled
  Text Box Display: Information [enabling]
  Macro Enable: 11_keep_computer_awake
  Text Box Display: Information [disabling]
  Macro Disable: 11_keep_computer_awake
End If
Delay: 3 seconds
Macro Return  


To do this for any macro, highlighted in Macro Explorer, I think I would
-- ENTER to open the macro in the Editor,
-- use keystrokes to navigate to the Nickname,
-- copy Nickname into clipboard,
-- save Nickname in a variable,
-- close the Editor, and
-- use the variable in the Enable and Disable commands.  


I disable / enable just often enough that the clumsiness irritates me every time I have to do it.  Now that you have inspired me perhaps I will finally generalize the snippet above and add it to my toolbox.  Or I will adopt your message after you share it. 



Link to comment
Share on other sites

My first effort sent keystrokes to activate "Disable" or "Enable" on the "Macro" menu... something like this:


Alt+M    // Key sequence to activate the "Macro" menu

B           //  Accelerator key to activate Disa_b_le and Ena_b_le


But for reasons I don't remember, this macro sometimes failed. My recollection (which may be faulty) is that another menu item sometimes appeared that also used "B" as its accelerator.


The clunky workaround: Once the script opened the Macro menu, the script outputted <UP ARROW> six or eight times to reach Disable/Enable. 


Alt+M    // Key sequence to activate the "Macro" menu

Up         // Navigate to Disable/Enable. (Can't use Down: the order of the menu changes)









The latest incarnation of the macro is simpler. It relies on the fact that Enable/Disable also appears on the context menu when the focused script name is right-clicked. The keyboard shortcut to right-click is Shift+F10. Then "B" toggles Disable and Enable.


Then I noticed the "Misc Keys" button in the "Text Type" window:




One of the many options is <APP>, which is the equivalent of a right click.


So here's the script to Enable/Disable a script:


Text Type (Simulate Keystrokes): <APP>b


Although this works reliably on my computer, on some systems, you might have to do this:


Text Type (Simulate Keystrokes): <APP>
Delay: 100 milliseconds
Text Type (Simulate Keystrokes): b


Link to comment
Share on other sites

Well, you have gone through al most every method! 


Interesting about the "Misc Keys".  I have rarely looked at them, but now I notice there is a <BROWSERBACK> which seems to work in Firefox the way BackSpace used to work, to take you to the previous web screen.  Firefox discontinued BackSpace some months ago, so I wrote a macro triggered by INSERT instead, to click the browser back arrow.  It seems I can change my macro to use <BROWSERBACK>, or ALT + LeftArrow, which should be simpler and more reliable.  


But what I really want to know is, how did you know that <APP> is equivalent to a right-click?  It is not intuitively obvious ...😮 


Incidentally, I have noticed that the Macro Run command will successfully run a disabled macro -- unless that has been changed in later versions of ME. 

Link to comment
Share on other sites

3 minutes ago, rberq said:

But what I really want to know is, how did you know that <APP> is equivalent to a right-click?  It is not intuitively obvious ...😮 


I'm not sure how I know this. My guess: Around 1996, when I bought my first GUI computer (a PC clone running Windows 95), I didn't have a mouse. Within a few days, I had figured out how to do almost everything via keyboard. Around that time, keyboard makers were releasing "Windows-95 compatible" keyboards; they featured a Windows key (which is equivalent to clicking "Start") and an "application" key (which is the equivalent to right-clicking, or pressing Shift+F10).


Maybe I had a dim memory of the application key, and transferred that knowledge to Macro Express?


BTW, modern keyboards still have an application key, although I doubt one person in a thousand ever notices it. It's usually on the bottom row, right side, near the Alt and Ctrl keys. But sometimes it's somewhere totally different.


I don't think you can assign the application key as a Macro Express hotkey, but you can assign its equivalent, Shift + F10. I recently learned that Macro Express supports assigning the right-mouse button as a hotkey.

Link to comment
Share on other sites

2 hours ago, acantor said:

BTW, modern keyboards still have an application key, although I doubt one person in a thousand ever notices it. It's usually on the bottom row, right side, near the Alt and Ctrl keys.


Yes!  My right-side Ctrl key has a little "list" symbol in the corner.  When I press it along with the Function key, it acts as a right-click.  I'm one of the 999 in a thousand who never noticed it before.  Or if I did, I assumed it was a misprint.

Link to comment
Share on other sites

Whoever designed the Windows-compatible keyboard must have been a magician. Magicians are experts at distraction and misdirection. The designers placed a key in a conspicuous part of the keyboard, and gave it a memorable label, but nobody notices the key -- even though it's directly in front of our faces, and it's been there, for decades!


I studied magic for a while. The first time I performed a mind-reading trick, I did something innocent-looking to distract the audience so that I could quickly glance at the answer I was about to reveal. To my surprise, the audience spent five or more seconds glancing around the room, oblivious to the fact that I had distracted them. I had caused time to disappear from their lives. In that moment I realized that if I continued the study of magic, I might be able to hide the Statue of Liberty via distraction!


I realize the above has nothing to do with macros, or with Macro Express! :)

Link to comment
Share on other sites

 Speaking of nothing to do with macros, or with ME -- more about dinosaurs. 😋


Go to before the Windows-compatible keyboard, and before the PC, and read about the key functions on IBM bi-sync cathode-ray-tube terminals.  Some keys would transmit all the data on the screen back to the central computer.  Some keys, if I recall correctly, would transmit only fields that had been changed, with changeable fields defined by what had been transmitted originally FROM the central computer.  Some keys would transmit no screen data at all, only a one-byte "attention" indicator.  Network speeds were so excruciatingly slow that it was an important programming consideration how to reduce character transmission to the bare minimum. 


As for magicians, I KNOW I am being misdirected but I NEVER detect how it is done.  I'm a wonderful, gullible audience! 



Link to comment
Share on other sites

Here's a misdirection I've used -- without giving away the trick: When I need the audience to stop paying attention, I ask if someone might be willing to volunteer.


It's how the magician poses the question that produces a few seconds of general distraction. I can't reveal more, lest I be drummed out of the Society of Totally Amateur Magicians!

Link to comment
Share on other sites

  • 2 weeks later...

Late to this. I've never had a need to enable and disable macros. Typically scope and other things will suffice. I've often wondered why people would use it. 

I have had some things like this for a few clients. But instead of disabling, I'd add logic to the start of a macro. It would either check for the condition, that you are using in your brain, and decide to continue or not. Or I would control it with a Boolean registry setting.

Link to comment
Share on other sites

I sometimes clone a macro so that I can test different versions. All macros have the same activation. I test one version several times, disable it, enable another, test it, and so on. Then I delete the ones that work less well.


And sometimes I disable macros because I suspect they are causing mischief, e.g., conflicting with a program feature or another macro. Disabling and re-enabling is a quick way to check.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...