Skip to main content
Known Participant
April 12, 2015
Question

Help with javascript errors

  • April 12, 2015
  • 2 replies
  • 354 views

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.spec);

}

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);

}

This topic has been closed for replies.

2 replies

Pedro Cortez Marques
Legend
April 13, 2015

try one of this:

(...)

for (var s = 0; s < stackCount; s++) {

(...)


or

(...)

for (var s in stacks) {

(...)


cutch2222Author
Known Participant
April 12, 2015

it seems there is an error in line 3 however I don't know the proper for loop syntax.