Error 520 - Unable to create temporary image file

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

undavide

Error 520 - Unable to create temporary image file

Post by undavide »

Hello,
I'm having problems with a script involving ScriptUI and embedded icons - using one of the recommended methods to serialize png graphics as outlined in the ScriptUI Guide for dummies.
Namely I'm:

Code: Select allvar infile = File ("/d/test_jpg/icon.png");
var outfile = File ("/d/test_jpg/icon.txt");
infile.open ("r");
infile.encoding = "binary";
var temp = infile.read();
infile.close();
outfile.open ("w");
outfile.write (temp.toSource ());
outfile.close ();

stripping the resulting string and using it like:

Code: Select allzoomInPNG = "\u0089PNG\r\n\x1A\n\x00\x00\x00\rIHDR\x00\x00\x00\x10\x00\x00\x00\x10\b\x06\x00\x00\ // etc. etc. etc.
win.previewAndProgressGroup.zoomGroup.zoomInButton.image = zoomInPNG;

When I start Photoshop and run my script, it fires "Error 520 - Unable to create temporary image file" pointing to the latest line. Twice (I mean, I close the script error alert and relaunch the script: it fails again).
Then it runs smoothly, displaying the graphics as supposed, as long as PS is open.
When I restart PS, same story. Weird!

Any suggestion?
Thanks and best wishes for the new year!

Davide