Feature Request: Enable|Disable|Toggle Macro - Variable

Background - I use a persistent palette, for Microsoft Outlook, that has a large number of filing and task macros that save a ton of time. Each macro files the appropriate email into the appropriate folder. Since I manage over 350 products, I only use the active products in my palette. As a practice, the other products/macros, that haven't been used within the last month or have closed out until the next release, I disable so they don't show in the palette.

Anyway, I've tried to find and create an AppleScript solution to toggle the macro (enable/disable) but I failed. I have a KM macro to actually perform this work but it opens the KM editor. I'd like to perform this in the background using the KM Engine instead of opening the KM editor. If someone has this AppleScript, I'd love to use it. :slight_smile:

Here is the solution that I'm requesting if it's possible.

I'd like to be able to use the Enable|Disable|Toggle Macro with a variable in lieu of creating a macro for each product.

Is it possible, in a future KM version, to add a variable so that we can use a user prompt?

So instead of 350 different macros like the image below (or 1 macro with 350 switch case scenarios):

Can a variable condition/selection be added, since I would know the name or product, I could do this via a prompt:

Let me know if I'm asking for too much, if this doesn't make since or if anyone has a more efficient way to do this?

Thanks much for listening!

KC

This AppleScript should toggle the enabled status of the macro name included in the macName variable. It does require that the KM editor be running, but it doesn't bring it to the foreground. You could try using it in place of the Toggle Macro action.

tell application "Keyboard Maestro Engine"
	set MacroName to getvariable "macName"
end tell

tell application "Keyboard Maestro"
	if enabled of macro MacroName is true then
		setMacroEnable MacroName without enable
	else
		setMacroEnable MacroName with enable
	end if
end tell

But since the macro name has to be exact, or it won't work, I'd recommend something like this that lists all of your macros with a list prompt and lets you type to select the one you want, which should eliminate the need to type it exactly yourself:

Choose Macro to Toggle from List.kmmacros (3.0 KB)

It lists every macro by default, but you can filter it down further to only show macros from a specific group if you want by modifying the initial AppleScript like this:

tell application "Keyboard Maestro"
	set MacroList to name of every macro in macro group "Global Macro Group"
end tell
5 Likes

Gabe,

Brilliant! Thank you so much for this solution and your valuable time. This is so much better than what I asked for. Very much appreciated!

:slight_smile:

KC

1 Like