app.activeDocument.path

Upload Photoshop Scripts, download Photoshop Scripts, Discussion and Support of Photoshop Scripts

Moderators: Tom, Kukurykus

Mike Hale

app.activeDocument.path

Post by Mike Hale »

I would like to see app.activeDocument.path return either a file object if the document has a file or null if it is a new document. It now throws an error if the doc is new.

Both File.openDialog() and file.openDlg() return null if there is no file and I think app.activeDocument.path should do the same.
xbytor

app.activeDocument.path

Post by xbytor »

The current behaviour is unfortunately consistent with other 'active*' things, like app.activeDocument throwing an exception if no doc is open. This was an API design flaw from the early days. The best they could do is add an 'isNew' property.

BTW, has anybody checked to see if the 'dirty' bit in the document descriptor ever got fixed? It was originally added to detect if a doc needed to be saved but was busted when it was first introduced.
Mike Hale

app.activeDocument.path

Post by Mike Hale »

I could live with an isNew DOM property. Still I would like to see Photoshop now throw exceptions as often as it does. At least with activeDocument one can check documents.length first. It would be nice to have a DOM way to determine if the document has a file without using try/catch.