How to export object with hidden or locked layer as png?
Hello,
This topic is a bit complex, but I will try to explain my problem as well as I can.
I'm trying to export selected assets as .png images with extendscript but some of my art pieces have locked/hidden layers/pageitems which prompts me this message:

Some notes on this:
- I am able to recursively walk through my objects and unlock/unhide them. But unhiding certain art makes the artwork look wrong
- I think clipping masks interfere here as well, prompting this error.
- I read this post about the same kind of problem, but their solution was either to unlock the layers and lock them again after, or to use some operator overwriting which seems too complex for what I want to achive.
This is a part from the code which exports the selected asset as an image:
for (var i=0, len=selected_art.length; i < len ; i++) {
var item = selected_art[i]
item.selected = true
doc.fitArtboardToSelectedArt(doc.artboards.length-1)
if(os == WINDOWS){
file_path = OsSpecificFolderPath(immage_trimmer_path + "/" + item.name + ".png")
}
else{
file_path = immage_trimmer_path + "/" + item.name + ".png"
}
var file = new File(file_path);
doc.exportFile(file, ExportType.PNG24, options);
item.selected = false
};
The line that prompts this error is the
which is slightly surprising. I would expect item.selected = true to be the culprit..
In the end all I want is the same functionality as File -> Export selected... without the prompt, is there any way to work around this?
Thanks in advance
