1 person found this helpful
To use the top layer just use:
var topLayerName = app.activeDocument.layers.name
What format do you want to save the file as?
Jpeg, but if save as popup dialog box appear with already top layer name is enough
dear my actual task is i want to drag an image form one tab to another tab and in this task image name is not copy to previous tab say tab tow to tab one so i have use this script to copy document name to layer name:
var idoc = app.activeDocument; var ilayer = idoc.activeLayer; var filename = idoc.name; filename = filename.slice (0, filename.lastIndexOf(".")); //just add this line to the construction. ilayer.name = filename;
The next step is to make some bevel and emboss and shadow effect then save as jpeg but with image name. which is i have got with my above code
but problem is the second code not copy top layer name, in other word i just want layer name which i have dragged to tab one and with dragged
here is link for psd file
and final result that i want is below, please help me this is simple task but i am stuck in this issue.
This should save the image as a jpg. You might need to flatten it first. You need to have a path where you want it saved.
var jpgOptions = new JPEGSaveOptions(); jpgOptions.quality = 8;//or whatever you want var filePath = idoc.pathname; docRef.saveAs (new File(filePath +'/' + filename + '.jpg'), jpgOptions);
Thanks for your precious help, I just want to popup dialog box for save as that already have top layer name because i dont want to give any specific location.
also would you suggest me any other way to accomplish this task? or i'm doing right? i just want at my dropbox link .psd file open then drag a new image on it with image name and then save as jpeg, also when i go image batch process there is also an error and jpeg not save with original name?