AppleScript, closing multiple documents

Hello,
I would like to create an AppleScript for Preview to close all open documents with a particular string in their title, e.g.

tell application "Preview"
	try
		close all documents whose title contains ("Jane Doe")
	end try
end tell

That does not run - Syntax Error Expected end of line but found plural class name.

Any suggestions will be appreciated.

Thanks.

Lennox

Hi, it should work like in this sample:

tell application "Preview"
	tell (every document whose name contains "Jane Doe")
		close
	end tell
end tell
1 Like

Thanks Thomas Kaltschmidt,
Works great, exactly what I wanted.
Thanks again.
Lennox