Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Help with javascript errors

Explorer ,
Apr 11, 2015 Apr 11, 2015

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

}

TOPICS
Scripting
325
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 12, 2015 Apr 12, 2015

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Apr 13, 2015 Apr 13, 2015
LATEST

try one of this:

(...)

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

(...)


or

(...)

for (var s in stacks) {

(...)


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines