Easy scripting problem: select all text in viewer window


	tell application id "com.devon-technologies.thinkpro2"
		activate
		set oWin to open window for record oLocn
		set selection of viewer window 1 to oNewRec

This works great (BTW, oLocn is set to open in three pane view). I now have the record in the top of the window selected, and the text below it.

Now I want select all the text in the text-displaying pane of the window and then run another applescript (that references selected text).

But how to select all the text? How even to get the text pane focused?

I tried:


tell application "System Events" to keystroke "A" using {command down}

but this fails. And I’ve tried to “set the focused to true”, but I don’t know even how to “get” the text area (?) or text field (?) of a three-pane-view window!

Geniuses, please help!

I’m not sure what you are trying to do here.

If you are trying to just get the text for the currently displayed record, you can do something a lot more reliable than issuing commands with the system events:

 
tell application id "com.devon-technologies.thinkpro2"
	set the_rec to content record of window 1
	set the_text to rich text of the_rec
end tell

That will get you the text as rich text, you can also just get plain text by substituting the word “plain” for “rich.”

But I might be completely misunderstanding your intent…

-erico

Instead of selecting all and accessing “selected text” you could simply access “text”.