Open contextual menu in Safari and click menu item "Next page"

Hi!

I am wondering whether I could open the contextual menu (right button menu) in Safari (I am using Safari 4) when a PDF document is being shown. When the contextual menu is opened the menu item “Next page” shall be clicked if it is not grayed (it grayed/disabled if the last page is reached). Is it is possible to do that with AppleScript?

I already searched this forum on how to show the contextual menu and found one interesting entry (http://macscripter.net/viewtopic.php?id=21338) that calls the contextual menu for TextEdit, but it does not work for Safari (since Safari has no text area but tabs).

Thanks for your suggestions!
Lars

Browser: Safari 530.17
Operating System: Mac OS X (10.5)

I now bypass this issue by downloading the PDF file before, counting the pages with http://macscripter.net/viewtopic.php?id=29867 and then send the space key as often as needed to the browser. Thanks for anyone who thought about this!

Ah…

activate application "Safari"
tell application "System Events"
	tell process "Safari"
		
		perform action "AXShowMenu" of middle group of UI element 1 of scroll area 1 of group 3 of window 1
		
	end tell
end tell

Wow, you did you find out? I suppose one cannot determine wheter a menu item of that contextual menu is grayed?