Hello,
I'm trying to show all layers of all files(.psd) in the folder. The process will be like that:
Step 1: Open the first file
Step 2: Select all layer of this file
Step 3: Show all layer of this file
Step 4: Save and close
Step 5: Open the second file
Step 6: Select all layer of this file
Step 7: ...
Thanks a lot for your help.
Show all layers of all files in the folder
Re: Show all layers of all files in the folder
Code: Select all
sTT = stringIDToTypeID, fls = File('~/desktop/Folder/')
.getFiles('*.psd'), dsc = new ActionDescriptor(); while(fls.length) {
if ((lrs = (actvDcmnt = open(fls.shift())).layers).length > 1 || !lrs[0].isBackgroundLayer)
runMenuItem(sTT('selectAllLayers')), (ref = new ActionReference()).putEnumerated
(sTT('layer'), sTT('ordinal'), sTT('targetEnum')), (lst = new ActionList()).putReference(ref),
dsc.putList(sTT('null'), lst), executeAction(sTT('show'), dsc); actvDcmnt.save(), actvDcmnt.close()
}
Re: Show all layers of all files in the folder
Thanks for your help!!!Kukurykus wrote: ↑Tue Apr 06, 2021 1:21 pmCode: Select all
sTT = stringIDToTypeID, fls = File('~/desktop/Folder/') .getFiles('*.psd'), dsc = new ActionDescriptor(); while(fls.length) { if ((lrs = (actvDcmnt = open(fls.shift())).layers).length > 1 || !lrs[0].isBackgroundLayer) runMenuItem(sTT('selectAllLayers')), (ref = new ActionReference()).putEnumerated (sTT('layer'), sTT('ordinal'), sTT('targetEnum')), (lst = new ActionList()).putReference(ref), dsc.putList(sTT('null'), lst), executeAction(sTT('show'), dsc); actvDcmnt.save(), actvDcmnt.close() }
I open PS CS6, then File/Script/Browse ... I choose your code, then a notification appears
Error 24:File().getFiles is not a function.
line: 1
-> sTT = stringIDToTypeID, fls = File('E:\1. PHAP TIEN DNT TAP 38\4. Tô màu_full/')
I'm so sorry, I just a beginner. Could you give me more instructions, plz
Re: Show all layers of all files in the folder
Remove colon and change backslashes to slashes, plus add one at beginning of path.