Hello,
I've been constantly and repeatably experiencing this error the first 2 times I launch my script. Third and subsequent lauches go smoothly, unless I reboot PS - which moves the situation back to square one (1st launch fails, 2nd launch fails, 3rd is ok).
The script contains, among the rest, a ScriptUI window with embedded graphics - as suggested in the ScriptUI Guide for Dummies I use the following code to serialize PNG icons:
function graphic_to_text(infiles /*array of file objects*/ ) {
var outfile, s, re1 = /^\(new String\(/, re2 = /\)\)$/;
for(var i = 0; i < infiles.length; i++) {
if (infiles[i].exists) {
outfile = new File(infiles[i].fullName.replace(/\.(png|idrc|jpg)$/, ".txt"));
infiles[i].open("r");
infiles[i].encoding = "BINARY";
outfile.open("w");
s = infiles[i].read();
outfile.write(s.toSource().replace(re1, "").replace(re2, ";"));
infiles[i].close();
outfile.close();
}
}
}
var file = new File($.fileName);
var folder = new Folder(file.path);
graphic_to_text(folder.getFiles("*.png"));
which I then embed as (looong) strings this way:
var zoomFitPNG = "\u0089PNG\r\n\x1A\n\x00\x00\x00\rIHDR\x00\x00\x00\ /* etc. etc. */ \u00AEB`\u0082"
win.previewAndProgressGroup.zoomGroup.zoomFitButton.image = zoomInPNG;
so far I've never had any problem - strangely enough I'm now getting this error (and this weird pattern of fails and successes). I forgot to mention that when the script runs as it is supposed to do, the graphics are ok.
If you're wondering, OSX 10.8.2, PS CS6 (13.0.3).
Any suggestion is welcome. Thanks in advance!
Davide
... View more