Dear All, I have played with AppleScript enough to write a few simple scripts to control key aspects of GarageBand’s UI, and attach them to shortcut keys facilitated by VoiceOver, which I use to read my Mac’s screen. I have MS Word and Excel for the Mac, but had all but given up on getting any use out of them, as VoiceOver will not read the data in them. Oddly enough, it does read their menus and dialogs.
As it turns out, I have been able to get spoken text out of Word with this small piece of script: — Select a line of text, then tell VoiceOver to speak it tell application "Microsoft Word" tell application "System Events" tell process "Microsoft Word" to key code 123 using {command down} delay 0.5 tell process "Microsoft Word" to key code 124 using {shift down, command down} delay 0.5 end tell set theText to get content of text object of selection end tell tell application "VoiceOver" to output theText
It “sort of” works, but not always reliably. Can anyone think of a better method than sending the movement and selection keys to Word? Perhaps using text range objects? The reference I’ve used, Word 2004 AppleScript Reference, only cites examples of selecting specific pieces of the document, such as first paragraph; it makes no mention of how to select, forinstance, from the insertion point to the end of the current line, sentence or paragraph. Yet, if this is possible, we should be able to develop a comprehensive set of scripts to read essential elements of the active document, and thus make Word, and maybe Excel, usable with VoiceOver. This start could be just the tip of the iceburg. While we can’t force VoiceOver to read something if it just sees “unknown” on a custom control, we can query the objects of an application which are exposed, then tell VoiceOver to output the text extracted from such objects. In this way, VoiceOver could perhaps catch up somewhat to the Windows readers in their abilities to give meaningful feedback from custom controls.
Dreaming aside, can you recommend a better scripting reference for Word, or a better method than key sending to select text? If so, I’ll grab the ball and run with it. Thanks in advance :-)
|