Photoshop - check if layer is empty?

Does anyone know of a way to check if an active visible layer in Photoshop is empty? I could run a filter to test, but if there is data on the layer it may take a while to run, and then the filter would have to be undone right after :frowning:

Check the bounds of the layer. If itā€™s empty it should return all zeroā€™s. I donā€™t have PS on my current machine, but try something like:

tell application "Adobe Photoshop CS"
	set theLayer to current layer of current document
	if bounds of theLayer is {0.0, 0.0, 0.0, 0.0} then display dialog "Layer Empty"
end tell

-N

nedloh99,
If you only knew how long I worked on this. I tried everything, for many different system events, to deleting layers that didnā€™t equal originating names, etc. All of my workarounds were long and tedious. And then you com along and supply this wonderful one-liner.

I am so grateful. Thank you very much,
Jeff

One thing I have found to be a huge time saver when trying to Applescript ANYTHING is ā€œget propertiesā€ of an object and check with any reference material I can find about the app.

Getting the properties of an object gives you a fast overview (but not always complete) of available object properties via applescript and what they are called (instead of drilling through the dictionary). You can always check for r/o status later.

In this case If you ā€œget propertiesā€ of an empty layer vs. a layer with something on it, youā€™ll see the differenceā€¦

Hope this helps in the future.

-N