Howdy folks, I am running into an issue that seems like should be straightforward but I am unable to get it to work. Basically I want to use AppleScript to enable certain macro groups according to which client I am working with on the phone.
Initially I would run this AppleScript at the beginning of my workday as part of my initial work flow and then all client macro groups would be enabled, and any time I needed to open a palette they would appear right away.
More recently I wanted to use AppleScript to enable each macro groups only when I am on a call with that specific client instad of having them all enabled throughout my entire workday. So I added an AppleScript to enable each clients macro group and placed it just before the action to open their palette(s) but the palettes do not open unless I run the macro a second time (once the macro groups have already been enabled).
I have tried adding a pause between the AppleScript that enables the macro group and the show palette function, as much as 2 seconds but it just doesn’t work. Is there something I’m doing wrong or any reason why a palette is not available to show immediately after the macro group has been enabled?
Attached is a screenshot of the troublesome part of the macro. Thanks for any help you can provide.
Only affects the Mac the macro is running on, whereas enable/disable will cause the KM Sync file to update and cause other Macs that use this sync to change.
Use the above KM Action rather than AppleScript
Here you say "activates" but above you say "enables". which is it?
If you make the suggested changes above I suspect it will fix this problem.
If not, please upload your macro file and image. If you continue to use the script, you will also need to upload it.
So I tried that but it doesn’t actually disable the macros in said macro groups. What I would like is to have those macros completely disabled so as to not accidentally trigger them.
Sorry, meant to say enable; not activate. I'll edit my original post to show the correct terminology.
But regardless, activating/deactivating the macro group doesn’t prevent the macros inside from triggering from what I can tell (unless I'm doing something wrong still).
I didn't post the entire macro because portions of it contain confidential info. But I copied the relevant portion into a new macro and used the one you linked to to upload it here. Awesome macro you made btw! Attached is also the AppleScript I used to enable the macro groups.
tellapplication "Keyboard Maestro" set enabled ofmacro group "Notes - LB DHS General" totrue set enabled ofmacro group "Notes - LB DHS-ICE" totrue set enabled ofmacro group "Notes - LB DHS-USCIS Country: Colombia" totrue set enabled ofmacro group "Notes - LB DHS-USCIS Country: Cuba" totrue set enabled ofmacro group "Notes - LB DHS-USCIS Country: Ecuador" totrue set enabled ofmacro group "Notes - LB DHS-USCIS Country: El Salvador" totrue set enabled ofmacro group "Notes - LB DHS-USCIS Country: Guatemala" totrue set enabled ofmacro group "Notes - LB DHS-USCIS Country: Honduras" totrue set enabled ofmacro group "Notes - LB DHS-USCIS Country: Mexico" totrue set enabled ofmacro group "Notes - LB DHS-USCIS Country: Nicaragua" totrue set enabled ofmacro group "Notes - LB DHS-USCIS Country: Venezuela" totrue set enabled ofmacro group "Notes - LB DHS-USCIS Forms" totrue endtell
No need to actually "disable" every macro.
When the Macro Group is "deactivated", it is NOT possible for any of its Macros to be triggered.
See Macro Activation .
Wrong. See my above comments.
Instead of a script that enables each macro, just do this:
Deactivate all Macro Groups whose Macros you do NOT want to be triggered
Show Macro Group and Show Palette for desired MG
Below is just an example written in response to your request. You will need to use as an example and/or change to meet your workflow automation needs.
I like what you're trying to do. It seems like a good contribution to "contextual computing". I might steal it - as I, too, have multiple customers on the go in the same timeframe.
Thank you for your continuing help! I made a test macro that would deactivate a specific macro group. However, I was still able to trigger macros from inside it even though it was supposed to be deactivated. I get the feeling it may have to do with the macro group's settings, because I have them set to "Always activated" as can be seen in the screenshot. Does it need to be set to something else for the activate/deactivate action to work properly?
EDIT: Never mind, I adjusted those settings (setting it to Activated/deactivated when) and it works great! The thing I did like about enabling and disabling however was the visual effect of the groups being grayed out which allowed me to quickly see which ones were enabled/disabled. I have about 30 different clients, so a lot of different groups and it can be helpful to see very quickly if the right ones are enabled or not. Is there some way to mimic this with activation/deactivation?
Edit 2: I just now noticed that while this works for the most part, if I switch out of Notes to another app that these macro groups are not available in, when I go back to Notes the palettes do not reappear even though the macros themselves are still activated and able to be triggered. Any idea why the palettes only appear initially and then do not reappear if I leave and come back to Notes?
EDIT 3: Well I seem to have figured that out too though I'm not certain why it works this way. When the macro groups were set to "Always activated" the palettes would appear initially upon triggering the "Show palette" action. But as I mentioned, when switching out of Notes they would disappear (which is normal as I have them set to only show up in Notes), but then not reappear when switching back to Notes which is how they worked before. But now changing the macro groups' settings to "Shows/hides a palette when" they now appear when I use the activate macro group action and reappear whenever I switch back into Notes until I deactivate them. Seems strange but it's working like I want so I'm just gonna roll with it.
Thanks again for your help, you always come through for me even though I'm certain my questions are quite rookie in nature