Copy link to clipboard
Copied
I am trying to write a Javascript snippet that will select all "Text Objects" and "Brush Objects" on the current document's visible, unlocked layers, then delete the objects.
This thread about "Execute Menu Item" seemed promising, but I could not figure out the proper object names to use. Executing a menu item may not be the most efficient approach anyway.
Can someone help me with this? Thanks.
function test()
{
var docRef = app.activeDocument;
var sel;
docRef.selection = null;
app.executeMenuCommand("Brush Strokes menu item");
sel = docRef.selection;
for(var x=sel.length-1;x>=0;x--)
{
sel
.remove(); }
app.executeMenuCommand("Text Objects menu item");
sel = docRef.selection;
for(var x=sel.length-1;x>=0;x--)
{
sel
.remove(); }
}
test();
Copy link to clipboard
Copied
function test()
{
var docRef = app.activeDocument;
var sel;
docRef.selection = null;
app.executeMenuCommand("Brush Strokes menu item");
sel = docRef.selection;
for(var x=sel.length-1;x>=0;x--)
{
sel
.remove(); }
app.executeMenuCommand("Text Objects menu item");
sel = docRef.selection;
for(var x=sel.length-1;x>=0;x--)
{
sel
.remove(); }
}
test();
Copy link to clipboard
Copied
Thank you, William! Works like a charm. Where's the tip jar?
I will study this and see what I can learn for next time.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now