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

How to hide object in scripting

Community Beginner ,
Aug 09, 2018 Aug 09, 2018

How do you hide in object in scripting like a text frame? This can be accomplished from the menu by selecting the text frame and select Object -> Hide.

The only thing I've found is the "visible" property for layers to show and hide them but I can't find a property on the text frame to show or hide from scripting.

TOPICS
Scripting
2.6K
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 1 Correct answer

Community Expert , Aug 09, 2018 Aug 09, 2018

You can use executeMenuCommand like below.

app.executeMenuCommand("hide");

Select your textFrame and run it.

Translate
Adobe
Community Expert ,
Aug 09, 2018 Aug 09, 2018

You can use executeMenuCommand like below.

app.executeMenuCommand("hide");

Select your textFrame and run 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 ,
Aug 10, 2018 Aug 10, 2018

Thank you! That worked but how would I show these items? I get an error when I try to select hidden items.

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 Expert ,
Aug 15, 2018 Aug 15, 2018
LATEST

Try "showAll" command.

And You can reference below.

Illustrator CC(ver.22) menu commands list | CC Labo

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
Engaged ,
Aug 09, 2018 Aug 09, 2018

In my case it was easier to put all objects I wanted to be hidden later on into one layer right from the start.
Then it is possible to hide a complete layer (and show again afterwards). Below are two functions to hide and show a top level layer. You call the function and just have to pass it the name of your layer.

E.g. call "hide_layer (text)" than you do a Save As or Export and after that call "show_layer (text).

function hide_layer (a) {

    var docHide = app.activeDocument; 

    var myLayers1 = docHide.layers; 

    var hideName1 = a; 

    try { 

        hideLayer1 = myLayers1.getByName (hideName1); 

        hideLayer1.visible = false; 

        redraw(); 

        } 

    catch (e) {} 

    }

 

function show_layer (a) {

    var docShow = app.activeDocument; 

    var myLayers2 = docShow.layers; 

    var showName2 = a; 

    try { 

        showLayer2 = myLayers2.getByName (showName2); 

        showLayer2.visible = true; 

        redraw(); 

        } 

    catch (e) {} 

    }

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