looping through thumbnails stops unexpectedly after 30-60
Posted: Tue Jan 24, 2012 4:23 am
I wrote what i thought was a fairly simple script to add a right click menu to loop through selected thumbnails in bridge and open each one in photoshop and run an action. It works, but will often stop before it finishes all the thumbnails. It gives no errors, and I have been tearing my hair out trying to figure out what I could be missing. Sometimes it will finish up to 180 and other times it will only finish 30-60 (this is on the same pc). I have pulled apart the main function for direct testing in ESTK with no right click menu
Code: Select allvar filesflatten = [];
var f = app.document.selections;
for (var i =0; f.length > i; i++) {
if (f.spec instanceof File){ filesflatten.push(f.spec); }
}
-for (var i =0; filesflatten.length > i; i++) { //for each file selected
scr = "app.open(" + filesflatten.toSource () + ");"; //open the file in photoshop
scr +="doAction(\"Universal Flattener\", \"Flatten\");"; //run the action
var bt = new BridgeTalk();
bt.target = "photoshop";
bt.body = scr;
bt.onError = function(errybody){alert(errybody.body); }
bt.send(); //send the message to photoshop
}
I am hoping someone with more experience will look at this and point out the mistake im making, or what could make bridge bail on a script like that without erroring on me. Ive been lurking around here for months now learning lots of stuff, props to everyone that makes this site happen.
Code: Select allvar filesflatten = [];
var f = app.document.selections;
for (var i =0; f.length > i; i++) {
if (f.spec instanceof File){ filesflatten.push(f.spec); }
}
-for (var i =0; filesflatten.length > i; i++) { //for each file selected
scr = "app.open(" + filesflatten.toSource () + ");"; //open the file in photoshop
scr +="doAction(\"Universal Flattener\", \"Flatten\");"; //run the action
var bt = new BridgeTalk();
bt.target = "photoshop";
bt.body = scr;
bt.onError = function(errybody){alert(errybody.body); }
bt.send(); //send the message to photoshop
}
I am hoping someone with more experience will look at this and point out the mistake im making, or what could make bridge bail on a script like that without erroring on me. Ive been lurking around here for months now learning lots of stuff, props to everyone that makes this site happen.