Skip to main content
This topic has been closed for replies.
Correct answer nandhinin87775610

Tanks for your replay..

I was found solution

app.selection[0].hidden = true;

and one more thing..textFrame does not have visible property

2 replies

nandhinin87775610AuthorCorrect answer
Inspiring
December 3, 2018

Tanks for your replay..

I was found solution

app.selection[0].hidden = true;

and one more thing..textFrame does not have visible property

pixxxelschubser
Community Expert
Community Expert
December 3, 2018

You are right.

It seems I was in Script UI.

pixxxelschubser
Community Expert
Community Expert
December 1, 2018

The question seems to be very easy - but isn't! It depends on the structure of you document.

For the beginning.

The best case: all text frames are on the same layer (and no other items).

var aDoc = app.activeDocument;

var aLay = aDoc.layers.getByName('Ebene 1'); // the name of your text frames layer

aLay.visible = false; // or the opposite

Other case:

easy document structure with only top level layers and no groups and no sublayers

You can loop though all layers

and for every layer loop through all page items and check if the item a text frame is. But this is not required.

Use the text frames class instead:

var theTF = aDoc.textFrames; will give you all the text frames in your document.

Loop through the text frames and hide or show every text frame item.

theTF.visible = true // or false

But sometimes this is not a good way if there are thousend of text frames in your document exist - or if you a deep nested document structure have with nested layers/sublayers in nested deep nested groups with some text frames visible and unlocked and other textframes are hidden and perhaps locked.

Show us a good example file, please.