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

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

Community Beginner ,
Dec 21, 2024 Dec 21, 2024

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 

ismailelmakh_0-1734785727733.png


TOPICS
Scripting

Views

221

Translate

Translate

Report

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

Community Expert , Dec 21, 2024 Dec 21, 2024

This was.

app.executeMenuCommand('edge') ;

Votes

Translate

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

Votes

Translate

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

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.

Votes

Translate

Translate

Report

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

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.

Votes

Translate

Translate

Report

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 Expert ,
Dec 21, 2024 Dec 21, 2024

Copy link to clipboard

Copied

This was.

app.executeMenuCommand('edge') ;

Votes

Translate

Translate

Report

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

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.

ismailelmakh_0-1734890085158.png

 

Votes

Translate

Translate

Report

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 Expert ,
Dec 22, 2024 Dec 22, 2024

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

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