Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Is it Possible to Toggle 'Hide Edges' in Illustrator via Script?

Community Beginner ,
Dec 21, 2024 Dec 21, 2024

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 

ismailelmakh_0-1734785727733.png


TOPICS
Scripting
587
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Enthusiast , Dec 21, 2024 Dec 21, 2024

This was.

app.executeMenuCommand('edge') ;
Translate
Community Beginner , Dec 22, 2024 Dec 22, 2024

I found this complete list for MenuCommand:
https://ten-artai.com/illustrator-ccver-22-menu-commands-list

Translate
Adobe
Community Expert ,
Dec 21, 2024 Dec 21, 2024

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 22, 2024 Dec 22, 2024

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 21, 2024 Dec 21, 2024

This was.

app.executeMenuCommand('edge') ;
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 22, 2024 Dec 22, 2024

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.

ismailelmakh_0-1734890085158.png

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 22, 2024 Dec 22, 2024

Probably not possible with ExtendScript; it can be achieved by using AppleScript or similar and checking the current menu state.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 22, 2024 Dec 22, 2024

Thank you for clarifying that; I appreciate your suggestion about using AppleScript; I'll look into it.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 22, 2024 Dec 22, 2024
LATEST

I found this complete list for MenuCommand:
https://ten-artai.com/illustrator-ccver-22-menu-commands-list

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines