[jawsscripts] Re: getObjectInfoByName

  • From: "Dennis Brown" <DennisTBrown@xxxxxxxxxxx>
  • To: <jawsscripts@xxxxxxxxxxxxx>
  • Date: Mon, 10 Mar 2008 18:04:42 -0400

Hi Jackie,
We created that command, as well as ClickObjectByName specifically because of the Windows Live group of applications that have a single window with lots of objects scattered throughout, so I'll use the Windows Live Messenger history window as the example here. The function takes several parameters, some just empty variables that the function populates when it is called, so you have to declare the variables used. GetObjectInfoByName(1=Handle,2=ObjectName,3=Instance,4=Type, 5=State, 6=Value, 7=Description, 8=HotKey, 9=ParentContainer) We'll use the following variables to hold the values returned by the function:
var
int iObjectType,
int iObjectState,
string sObjectValue,
string sDescription,
string sHotkey,
string sContainer
1. Handle: Handle of window containing the object, such as GetAppMainWindow(GetFocus())
2. String: Name of the desired object,  such as "History".
3. Integer: Instance of the object, for those times where there may be more than a single object with the desired name. For example, in WLM, there are 2 history windows; the first being the true history window, and the second being the tool tip that pops up with the last thread of the conversation. This second history object does not have the sender's name, and after it is displayed, the sender's name and the new thread is appended to the first history object's value string. So in this case, since there are two objects named "History", we want the first, so we use an integer value of 1 4. Integer iObjectType: The object's type is returned as an integer value. For example, 43=ReadOnly edit, 66=Multilined edit, 1=Button, etc. 5. Integer iObjectState: Contain the object's state flags. This will be a combination
of Control Attribute identifiers defined in HJCONST.JSH.   Here they are:
;Control Attribute identifiers
CTRL_NONE = 0,
CTRL_CHECKED = 1,
CTRL_UNCHECKED = 2,
CTRL_GRAYED = 4,
CTRL_DISABLED = 8,
CTRL_SUBMENU = 16,
CTRL_PRESSED = 32,
CTRL_OPENED=64,
CTRL_CLOSED=128,
CTRL_SELECTED=256,
CTRL_SINGLELINE=512,
CTRL_MULTILINE=1024,
CTRL_EXPANDED=2048,
CTRL_COLLAPSED=4096,
CTRL_HASCHILDREN=8192,
CTRL_VISITED=0x4000,
CTRL_Indeterminate=0x8000,
CTRL_PARTIALLY_CHECKED = 32770,
6. String sObjectValue contains the value string of the object. In the History object, it will be the entire conversation, with the sender name and threads separated by carriage returns characters. 7. Optional: String sDescription is the object's description string returned by the function.
8. Optional: String sHotkey, if it has one, otherwise it is an empty string.
9. Optional: String sContainer is he object that contains the object desired, or the parent object.

Here is an example of retrieving the value string of the WLM History object, then announcing the last thread sent. Since the function itself returns a true if the object was found, and a false if not, we'll check for that first:

Function AnnounceLastThread()
var
int iType,
int iState,
string sValue,
string sSender,
string sThread
If !GetObjectInfoByName(GetAppMainWindow(GetFocus()),"History", 1,iType,iState,sValue) Then
   Say("Object not found.",ot_error)
   Return
EndIf
; Found it, so grab the last and second to the last strings, delimited by return characters...
let sSender=StringSegmentIndex(sValue,"\r",-2)
let sThread=StringSegmentIndex(sValue,"\r",-1)
; Now announce those puppies...
Say(sSender,ot_screen_message)
Say(sThread,ot_screen_message)
EndFunction
So if you had just sent a message, telling the person to go soak their head, the function would cause Jaws to say:

Jackie says:
Go soak your head.

Hope this helps!
Thanks,
Dennis Brown
----- Original Message ----- From: "Jackie McBride" <abletec@xxxxxxxxx>
To: <jawsscripts@xxxxxxxxxxxxx>
Sent: Monday, March 10, 2008 12:15 AM
Subject: [jawsscripts] getObjectInfoByName


Could some1 please give me a code snippet of how to use this? This
object stuff is about 2 drive me bats.

--
Jackie McBride
Please join my fight against breast cancer
<http://teamacs.acsevents.org/site/TR?px=1790196&pg=personal&fr_id=3489>
& Check out my homepage at:
www.abletec.serverheaven.net
__________
View the list's information and change your settings at
//www.freelists.org/list/jawsscripts



__________ 
View the list's information and change your settings at //www.freelists.org/list/jawsscripts

Other related posts: