Make Safari scrolling a PDF file after is has been loaded

Hi folks,

I realized that the newest Safari (Mac OS 10.6.2) does not automatically focus the PDF view when one has loaded a PDF page into Safari (e.g. http://www.uni-muenster.de/Jura.itm/hoeren/materialien/Skript/Skript_Maerz2008.pdf). In an older version I could use

tell application "Safari"
  tell application "System Events" to keystroke " "
end tell

to scroll automatically to the next page (by pressing space bar) after the page has been loaded. In the latest version I need to click manually into the PDF view to make Safari accepting the space bar press.

How can I bypass this problem? I tried to click automatically into the PDF view by using

tell application "Safari"
	activate
	tell application "System Events"
		tell process "Safari"
			set winPos to position of window 1
			click at {(item 1 of winPos) + 50, (item 2 of winPos) + 400}
			keystroke " "
		end tell
	end tell
end tell

This is not only ugly but also does not work. Does anyone have any idea how to make Safari scrolling my PDF file?

Thanks!
Lars

Hi Lars,

Making use of the free command line tool cliclick I can persuade Safari to scroll on my Mac OS X 10.6 system:


tell application "Safari"
	activate
	set winPos to bounds of window 1
	set command to "/Users/martin/Desktop/cliclick " & ((item 1 of winPos) + 50) & space & ((item 2 of winPos) + 400)
	do shell script command
	tell application "System Events"
		keystroke " "
	end tell
end tell

Best regards from Berlin to Münster (my sister also studies there…),

Martin

Great, that helps me a lot! Thanks, Martin.

Greets from Milan to Berlin (originally from Potsdam).