Quantcast
Channel: Adobe Community : Popular Discussions - Photoshop Scripting
Viewing all articles
Browse latest Browse all 12244

How do I detect the presence of an open file in Photoshop?

$
0
0

I’m new to Adobe scripting, and one of my first scripts deals with the activeDocument in Photoshop.

If there is no activeDocument, I want to display a message and quit the script.

 

My efforts so far have been met with frustration.  While creating the script in ExtendScript Toolkit,

I used the  test expression "activeDocument in app", and everything worked as expected.

And when I installed the script in the Photoshop scripts folder and ran it from Photoshop

with a document open, it also worked.

 

But when I ran the script from Photoshop with no document open, it failed.

 

Moreover, after that, the script failed when I tried to run it in ESTK.

I did some testing and found that my test expression, "activeDocument in app"

was returning true, even though no document was open.

 

Still in ESTK, I replaced the “app” with ”Application” in the test expression.  That worked when

I stepped through the script.  But when I tried to run it without stopping, it stopped at the

test expression, and displayed the error message, “Application is undefined.”

 

So how do I test for the presence of an open document in Photoshop ??


Viewing all articles
Browse latest Browse all 12244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>