Shortcut Menu Bar?

I want the script to select all text then read it back to me using something like:



tell application "Pages"
	activate
	
	tell application "System Events"
		tell process "Pages"
			click menu item "Select All" of menu "Edit" of menu bar 1
		end tell
	end tell
	
	tell application "System Events"
		click menu item "Start Speaking" in menu "Speech" of menu item "Speech" of shortcut of process "Pages"
	end tell
	
end tell

but it doesn’t recognize it.

Applescript Error:
System Events got an error: Can’t get shortcut of process “Pages”.

How do I access the shortcut menu ( or control+click ), so I can click menu item “Start Speaking”?

Model: 20" iMac
AppleScript: 2.3
Browser: Safari 531.21.10
Operating System: Mac OS X (10.6)

Hi,

if you want the whole text to be spoken, this does it.


tell application "Pages" to set theText to text 1 thru -1 of document 1
say theText

The “Start Speaking” menu item is also accessible in the Services menu in 10.5 and I guess you can create a custom service in 10.6

That works great!!

Three questions though:

  1. how do I get it to stop
  2. how do I do it by paragraph (even if I was to add paragraphs later)?
  3. how do I create a custom service for speech in Pages menu bar?

Model: 20" iMac
AppleScript: 2.3
Browser: Safari 531.21.10
Operating System: Mac OS X (10.6)