UI Events & Saving from Preview

Searched all around and haven’t found a solution for this. Not sure of the limitations of UI Events.

Using the “perform action” in PreFab’s UI Browser makes this work, but the Applescript itself errors with “NSReceiverEvaluationScriptError: 4”.

Open a file named test.pdf in preview…and here is the simple code:

tell application "Preview" to activate
tell application "System Events"
	tell process "Preview"
		keystroke "S" using {command down, shift down}
		click button "Save" of sheet 1 of window "test.pdf "
	end tell
end tell

Am I missing something? Much thanks!

Check this out:

http://www.apple.com/applescript/uiscripting/03.html

For your answer