Hello, wise KM community. Since updating the latest version, I've seen a behavior change in how I pass Variables to the Select Menu Item Action. Here's an example:
This action would previously correctly categories this calendar event as "Personal" (or whatever). Now the text "%Variable%Category%" itself is being passed, and the action failing as a result.
I see some 2014 and 2015 posts where this was discussed but again, it seemed to be working as expected just yesterday on v11.0.3. I would appreciate anyone pointing me in the right direction. Thanks,
I tried with a simple sub-menu in Keyboard Maestro and it worked ... what happens if you replace the variable with a category name—does that work (just as a debugging step)?
If that's what's happening, then the percent character delimiters aren't being acted upon. So what I would do is look very carefully in the third text box in your action. Of course, since you didn't upload your action or your macro, I can't investigate that. I'm concerned that you might have some hidden characters in there.
Another possibility is that your variable named "Category" actually contains the string "%Variable%Category%" which seems unlikely but you should check the contents of your "Category" variable to be sure.
When I run this, I will initially get an action failed notification: "2025-05-23 15:08:24 Select Menu Item failed to find target menu item Event➤Categorize➤%Variable%Category% in macro “Calendar Event Parser Test” (while executing Select “%Variable%Category%” in the Menu “Event” in Microsoft Outlook)."
Then, when the "manual" pass at assigning the Category comes through, it behaves just fine.
Of course, re-creating this issue exactly would require you to have the same categories enabled in your own local Outlook. But hopefully this demonstrates well enough what is happening.
I suspect the error message just parrots out the string "%Variable%Category%" instead of evaluating the token for the error message. So I don't think that it is correct to say "the text %Variable%Category% is being passed."
In any case, I think I know what the problem is (but I could be wrong.) You see, some apps don't actually generate the menu items until the user opens the menu with the mouse (or with equivalent actions in KM.) So what I suspect you need to do is split the Select action into two or three actions. Two might suffice. Just select Event/Category, then pause briefly, then select the full item that you want. That should give Outlook the time and the signal to generate the submenu items.
I can't explain why it started for you with 11.0.4.
I'm sorry if I can't write the code for you. I have a headache today, and in any case, I don't have Outlook.
Thank you for the suggestion. This wasn't what I needed to fix it... but it got me thinking just enough to figure out what it was.
It appears that somehow my variable had some trailing spaces or the like, which was what was breaking the flow. Trimming it solved the problem. Perhaps 11.0.4 changed some type of default trimming behavior in text variables when used in Menu commands. But more likely, I had some slight differences in my input text today from what I was using yesterday... and that was propagated through.
I suppose, but only if AppleScript requires multiple commands to press a single menu item. If not, you will need to break up the single command in AppleScript and insert a pause just like you need for KM. That's because the app doesn't generate the menu items until you click on the menu. It's a defect in the program that we can fix using a multiple step approach.