CS5 bug? File is deleted when attempting to open!

Discussion of Photoshop Scripting, Photoshop Actions and Photoshop Automation in General

Moderators: Tom, Kukurykus

kpt

CS5 bug? File is deleted when attempting to open!

Post by kpt »

I don't know if there's a specific thread for this but I just bought CS5 and tried some scripts.
One of them failed in a rather bizarre way: when attempting to open a .psd-file, an exception is thrown and the file is removed!

I'm still investigating, but was wondering if anyone else has seen this behavior?

Code: Select allvar doc = app.activeDocument;
Folder.current = new Folder("/Users/kjellpost/PBD/Overlays/");
var psdRef = new File().openDlg("Pick an overlay", "PSD:*.psd");
alert("psdRef = "  + psdRef);
alert("typeof psdRef = " + (typeof psdRef)); /* object */
if (psdRef == null) {
   alert("psdRef = null");
} else {
  var template;
  try {
    template = app.open(psdRef);
  } catch (e) {
    alert("Hm, could not open " + psdRef + ", " + e);
  }
}


These messages are shown during execution:



The attempt to open the file leads to an exception and the removal of the file curlphoto-V.psd!

Has anyone seen this? Who at Adobe should I contact?

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

Mike Hale

CS5 bug? File is deleted when attempting to open!

Post by Mike Hale »

I have not seen that using CS5 on WinXP. Does it happen with any file or just that one example? I just tested your code here using a file on my system and it opened the file as expected.

But to answer your question you can report bugs at https://www.adobe.com/cfusion/mmform/in ... e=wishform ... e=wishform. Note that Adobe will want to reproduce the bug so give as much detail as you can. Photoshop version ie Photoshop Extended 32bit, the OS and computer info - ram, chipset, etc. I would run the following code in ESTK with Photoshop as the target
Code: Select all$.writeln(app.systemInformation)
And include the results of the Javascript console in your report.
kpt

CS5 bug? File is deleted when attempting to open!

Post by kpt »

Hi Mike,

I can delete any .psd-file with this script. I'm running CS5 on a Mac OS X and have tried both in 32- and 64-bit mode. I've also reduced the script to the following:

Code: Select allvar psdRef = new File().openDlg("Pick a file", "PSD:*.psd");
alert("psdRef = "  + psdRef);
try {
    var template = app.open(psdRef);
  } catch (e) {
    alert("Hm, could not open " + psdRef + ", " + e);
  }

Thanks for the link, I'll try to post the bug there later but would like to test it on another Mac computer first.
Mike Hale

CS5 bug? File is deleted when attempting to open!

Post by Mike Hale »

Sorry I don't yet have CS5 for Mac yet so I can't text on that platform.
kpt

CS5 bug? File is deleted when attempting to open!

Post by kpt »

No problem Mike, just tested it on my laptop with the same result.

Edit: just submitted the bug report.
Mike Hale

CS5 bug? File is deleted when attempting to open!

Post by Mike Hale »

Just as a test you might want to run one of the Adobe scripts like Image Processor on a folder of test images to see if it also deletes. I know that there didn't seem to be that many script users on the beta program but I can't imagine that a but that causes data loss wasn't noticed.
kpt

CS5 bug? File is deleted when attempting to open!

Post by kpt »

Image Processor seems to run fine.

I wonder if there's something wrong with openDlg()? If I create a File object myself, rather than using openDlg, the script works.
kpt

CS5 bug? File is deleted when attempting to open!

Post by kpt »

There seems to be a problem with the construct new File().openDlg(...);

This code does not currently work on my Mac CS5:
Code: Select allFolder.current = new Folder("/a/b/c");
var fileref = new File().openDlg(...);

However, this seems to do the same thing:
Code: Select allvar fileref = new File("/a/b/c").openDlg(...);

And it also works on CS4 so I will use this for future code.
Mike Hale

CS5 bug? File is deleted when attempting to open!

Post by Mike Hale »

I have never used new File().openDlg(). I normally do some variation of this
Code: Select allvar myFolder = Folder.current = new Folder("~/Desktop");
var fileref = myFolder.openDlg('...');