Copy link to clipboard
Copied
Hi everyone, I'm trying to create a Extention in Adobe Illustrator and I want to use toggle the 'Hide Edges' option available under the **View** menu (Ctrl+H). I have tried the following commands:
app.executeMenuCommand("previewEdges"); app.executeMenuCommand("showEdges");
Both commands work individually, but I need a way to toggle between showing and hiding edges, just like the manual Ctrl+H shortcut.
Is there a method or a specific script to achieve this toggle behavior? Or is there another command I'm missing?
Any insights or examples would be greatly appreciated!
Attached is a screenshot of the menu option I'm referring to.
Thank you
This was.
app.executeMenuCommand('edge') ;
I found this complete list for MenuCommand:
https://ten-artai.com/illustrator-ccver-22-menu-commands-list
Copy link to clipboard
Copied
You may record an action that uses the Insert Menu Item command to include the toggle command. Then call that action in your script.
Note that by using the Insert Menu Item command the action always shows the "Show Edges" command, but it will serve as a toggle, no matter what state is currently turned on in the View menu.
Copy link to clipboard
Copied
Thank you for the detailed explanation.
I've used this method before, but now I want to integrate it directly into my script without recording any action.
Copy link to clipboard
Copied
This was.
app.executeMenuCommand('edge') ;
Copy link to clipboard
Copied
Thank you so much.
This is exactly what I was looking for. I really appreciate your help.
One more thing if you don't mind—do you know if there's a way to force 'Hide Edges' instead of toggling it?
That would be really helpful.
Copy link to clipboard
Copied
Probably not possible with ExtendScript; it can be achieved by using AppleScript or similar and checking the current menu state.
Copy link to clipboard
Copied
Thank you for clarifying that; I appreciate your suggestion about using AppleScript; I'll look into it.
Copy link to clipboard
Copied
I found this complete list for MenuCommand:
https://ten-artai.com/illustrator-ccver-22-menu-commands-list