check if a document is saved

in photoshop cs i want to close all documents that are saved and ignore all those that arent saved, possible?

You can use the Modified property of each open document to determine if the document has been modified since it was last saved, and close only the documents that haven’t been.

tell application "Adobe Photoshop CS"
	set openDocs to every document
	repeat with thisDoc in openDocs
		if modified of thisDoc is false then close thisDoc
	end repeat
end tell

thanks