Skip to main content
Silly-V
Legend
February 10, 2017
Question

app.executeMenuCommand() problems

  • February 10, 2017
  • 4 replies
  • 4473 views

I'm using AI CC 2017 and it has been brought to my attention that my app.executeMenuCommand("doc-color-cmyk"); doesn't work some times when my script is ran.

#target illustrator

function test(){

    var doc = app.activeDocument;

    app.executeMenuCommand("doc-color-rgb");

    app.redraw();

};

test();

I tested the above snippet and sure enough, nothing happens.

Then, I went to the menu item and hovered over it to reveal the CMYK/RGB menu items in the document color space (without choosing one even), and it now works.

Is this the same thing that's happening with the Actions not registering the recorded scripts menu items?

It is not acceptable when they have to show this item, however rare it might be!

I went by with actions for this purpose, but having this come up was a rather unwelcome 'surprise'.

This topic has been closed for replies.

4 replies

Participating Frequently
October 4, 2022

I have had the same problem with Illustrator 26 / windows 10 tying to run a script to batch convert some files to CMYK and do some clean up operations.
My script is running FINE via ESTK but is NOT executing the menu command when run from inside Illustrator via the menu File > Scripts > Other script.
Easy solution (after what I read in the above comments): Create a blank new file and then run the script from the menu - it runs fine now!

flexoway
Participant
September 24, 2021

is this issue solved,I am in Illustrator 2021 and this issue happen in Mac with M1,but OK in Win10

o-marat
Inspiring
February 12, 2017

Silly-V, did you try make an action and run it through script? What will be action behaviour?

Perhaps the bug bound with third party software? Doubtful, but probable.

What the same software (like keyboard switchers that may generate some funny and strange bugs) in your Mac and Windows?

Silly-V
Silly-VAuthor
Legend
February 12, 2017

Yes, I used actions as a successful work-around. Also in my last test, I did have to explicitly reveal the Document Color Mode menu items with the disclosure triangle to make the code work - whereas in a previous test I had to reveal the File menu only.

One more thing: on both computers I have ever tested this on (one windows one mac) they each have a setup with 2 monitors.

CarlosCanto
Community Expert
Community Expert
February 10, 2017

it works ok here. Windows 10, CC2017

Silly-V
Silly-VAuthor
Legend
February 10, 2017

Did you try restarting your Illustrator and not revealing the document color space menu item and running the test?

CarlosCanto
Community Expert
Community Expert
February 10, 2017

lost the bet...still works fine.


I'm running your test() from the estk