Closing every Photoshop window

I want to make a small applescript to close every window in photoshop cs. I was thinking of using the keystroke to emulate command-option-w, then having it stroke “d” to “Don’t Save” this part will work, what I need help with is counting the number of windows open so I can know the number of times to repeat “d” the number will vary, so I want it to count every time around.

I don’t have Photoshop CS, but I can’t help but think you’re making this much more difficult than it needs to be.

Check the app’s dictionary and see if it supports a ‘close’ event. If it does your script might be as simple as:

tell application "Photoshop CS"
   close every document saving no
end tell

That beats a kludgy UI solution hands down.

It’s is that simple!

thanks, that works great. I was thinking close evry window and it wasn’t working. :rolleyes: