Why would "Execute Menu Item" not work for all Mac with "identical" systems?

I have used KM's "Select Menu Item" action to select elements in Illustrator CC 2015.3. When sharing the macro it works for some but not all users. All users are on High Sierra, Illustrator CC 2015.3. I cannot figure out what causes the macro to fail only for certain users. Any ideas?

I even re-wrote the macro on one of the problem Macs and it still did not work. I used the "Record" method to insure all text was accurate.

Consistent macro functionality is the biggest challenge trying to share macros between 7 production artists.

Keyboard Maestro 8.2.2 Actions

Keyboard Maestro Actions.kmactions (3.8 KB)

Something is different on the user's machine that fails.
To find out why, you need to collect some data when it fails.

In the Gear menu for the Select Menu Action, uncheck the "Failure Aborts Macro":

image

Then add a IF/THEN action that test the token %ActionResult%, which returns "OK" if it was successful.

image


One thought just popped up: possible timing issues -- maybe the user with the issue is running slower for some reason, and the menu items are not available yet. You could try adding some Pauses before the Select Menu to see if that helps.

1 Like

It could be due to how the macro is called. If the trigger uses a modifier key, the menu entry could be different or unavailable if a modifier key is being pressed. I don't have Illustrator to check but many applications will use the Option key to change a menu item to do something similar or extra.

For example, I have a macro that simply types out a text string that is triggered by Shift+F6. Sometimes the case of the text is wrong because I was still holding the Shift key.

To fix this, I added the following Pause Until action at the start of the macro. This way the macro is triggered with the hotkey but then waits for me to release all modifiers.

Another tip to help out your future self. Change the Select Menu action to just "Front Application" instead of specifying "Adobe Illustrator CC 2015.3". Then put all of your Illustrator macros into a Group Folder and configure the Group Folder's "Available in these applications" parameter to contain "Adobe Illustrator CC 2015.3".
This way you won't have to update each individual macro but just the group folder when you update the Illustrator application.

1 Like

Thank you, both. I've learned something… again.

In the meantime an AI Forum Script guru wrote a javascript snippet that works much faster anyway. I just didn't know how to write it.

//~ Written by: william a dowling

function test()
{
var docRef = app.activeDocument;
var sel;

docRef.selection = null;  
app.executeMenuCommand("Brush Strokes menu item");  
sel = docRef.selection;  
for(var x=sel.length-1;x>=0;x--)  
{  
    sel[x].remove();  
}  

app.executeMenuCommand("Text Objects menu item");  
sel = docRef.selection;  
for(var x=sel.length-1;x>=0;x--)  
{  
    sel[x].remove();  
}  

}
test();

Thanks for the help.