Copy link to clipboard
Copied
I am new to scripting. I just installed this script and it's throwing a couple errors (I do not know the correct syntax) Is there anyone out there that can help me?
var stacks = app.document.stacks;
var stackCount = stacks.length;
for(var s = 0;s 1){
var bt = new BridgeTalk;
bt.target = "photoshop";
var myScript = ("var ftn = " + psRemote.toSource() + "; ftn("+stackFiles.toSource()+");");
bt.body = myScript;
bt.onResult = function( inBT ) {myReturnValue(inBT.body); }
bt.send(500);
}
}
function getStackFiles( stack ){
var files = new Array();
for( var f = 0; f<stack.thumbnails.length;f++){
files.push(stack.thumbnails
}
return files;
};
function myReturnValue(str){
res = str;
}
function psRemote(stackFiles){
var loadLayersFromScript = true;
var strPresets = localize ("$$$/ApplicationPresetsFolder/Presets=Presets");
var strScripts = localize ("$$$/PSBI/Automate/ImageProcessor/Photoshop/Scripts=Scripts");
var strFile2Stack = "Load Files into Stack.jsx";
var ipFilePath = app.path + "/" + strPresets + "/" + strScripts + "/" + strFile2Stack;
var ipFile = new File (ipFilePath);
$.evalFile( ipFile );
loadLayers.intoStack(stackFiles);
app.doAction ('action name', 'action set');
var saveFile = new File('~/desktop/'+(new Date().getTime().toString())+'.psd');
app.activeDocument.saveAs(saveFile);
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
}
Copy link to clipboard
Copied
it seems there is an error in line 3 however I don't know the proper for loop syntax.
Copy link to clipboard
Copied
try one of this:
(...)
for (var s = 0; s < stackCount; s++) {
(...)
or
(...)
for (var s in stacks) {
(...)