Copy link to clipboard
Copied
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.
You can use executeMenuCommand like below.
app.executeMenuCommand("hide");
Select your textFrame and run it.
Copy link to clipboard
Copied
You can use executeMenuCommand like below.
app.executeMenuCommand("hide");
Select your textFrame and run it.
Copy link to clipboard
Copied
Thank you! That worked but how would I show these items? I get an error when I try to select hidden items.
Copy link to clipboard
Copied
Try "showAll" command.
And You can reference below.
Copy link to clipboard
Copied
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) {}
}
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more