Copy link to clipboard
Copied
I need a script thats going to select this layer and then export it as a png. But Im getting stuck on not being able to even select it thought extendscript. Any advice or help?
 
1 Correct answer
Envelope objects are of type PluginItem. If you know for sure that there are no other pluginItems in the document, you can select them this way:
app.activeDocument.pluginItems[0].selected = true;
Explore related tutorials & articles
Copy link to clipboard
Copied
Ok so this is tripping me out but this below only works when after manually change the Envelope object to Envelope by clicking on it and renaming it. Is there anyway to go about doing this without running into that issue?
Copy link to clipboard
Copied
The plot thickens. It turns out when you warp a text it'll create an Envelope distort sub layer, this isn't a revelation it's just the beginning to the episode that's playing in my head, But I've found out with the use of another script that tells me the name of a selected object it's not Envelope. It seems as soo that when illustrator make an envelop distort object it calls it Envelope in the layers panel but it's actually called Unnamed. And you as far I'm aware you can select this object without having to manually type in Envelope again in the layers panel even thought it's already called that. Thank you for tunning into this hour's episode tune in next hour where I hopefully figure this out. Same manic meltdown time, same manic meltdown channel.
Copy link to clipboard
Copied
When you distort an item with an envelope, you create an unnamed pluginItem. So, unless you name it, you cannot target it by name. If it's always the topmost item in the "base" layer or the one pluginItem in the "base" layer, you could target it that way.
Copy link to clipboard
Copied
Envelope objects are of type PluginItem. If you know for sure that there are no other pluginItems in the document, you can select them this way:
app.activeDocument.pluginItems[0].selected = true;
Copy link to clipboard
Copied
Envelopes like any other item you create, ie text items, path items, etc don't have names. You would have to name items explicitly in the layers panel (if you working manually). You don't have to name the unnamed envelope as "Envelope", you can name it anything else that it more descriptive.
Copy link to clipboard
Copied
Im sensing an "X Y problem" here.
you want to export a PNG, but youre asking about how to select a layer.
The bad news: Layers can't be selected via script, as far as i know..
The good news: You don't need to. if you only want to export stuff on a certain layer(s), you can simply hide the other layers and then export normally.
The confusion: you said youre trying to select a layer, but all of your descriptions are about trying to select an envelope/plugin item...? are you trying to export a png of just that envelope item without anything else?

