Also, here is an example from my script on pushing a MS Access button:
Dim $i ; $Path depth counter for convenience when adjusting the path
Dim $iAAccess; IAccessible root object, in this case the MS Access window - for debugging
Dim $iAText ; IAccessible object for the Msgtxt field - for debugging
Dim $iAQuit ; IAccessible object for the Quit button - for debugging
; Build the IAccessible tree to the subform containing the buttons
$i = 0
$Path[$i][0] = $MsAccess_WindowTitle_Main
$Path[$i][1] = $MsAA_ROLE_CLIENT
$Path[$i][2] = ""
$i = $i + 1
$Path[$i][0] = "Workspace"
$Path[$i][1] = $MsAA_ROLE_WINDOW
$Path[$i][2] = ""
$i = $i + 1
$Path[$i][0] = "Workspace"
$Path[$i][1] = $MsAA_ROLE_CLIENT
$Path[$i][2] = ""
$i = $i + 1
$Path[$i][0] = $MsAccess_WindowTitle_Subform
$Path[$i][1] = $MsAA_ROLE_WINDOW
$Path[$i][2] = ""
$i = $i + 1
$Path[$i][0] = $MsAccess_WindowTitle_Subform
$Path[$i][1] = $MsAA_ROLE_CLIENT
$Path[$i][2] = ""
$i = $i + 1
; Get the IAccessible object for the Quit button
$Path[$i][0] = "Quit"
$Path[$i][1] = $MsAA_ROLE_PUSHBUTTON
$Path[$i][2] = ""
;Debug Checks START
;Check to see if we can get the IAccessible object for the Access window
;Check to see if the path is right for the Quit button
;First get the IAccessible object for the Main Access Window
$iAAccess = MSAA_GetAccessibleObject($MsAccess_WindowTitle_Main)
If Not IsObj($iAAccess) then
msgbox(0,"Error","$iAAccess is not an object",15)
Exit(1)
EndIf
;Now get the IAccessible object for the Quit button
$iAQuit = MSAA_GetObjectByPath($Path, $iAAccess, $iAChildID)
If Not IsObj($iAQuit) then
msgbox(0,"Error","$iAQuit is not an object",15)
Exit(1)
EndIf
;Debug Checks END
MSAA_DoDefaultActionByPath($MsAccess_WindowTitle_Main, $Path)
I used the debug checks section when I was figuring out how the paths worked to make sure I was getting an object to return. That section and the corresponding variables should be removed in production.
Here is the inspect32.exe output for the Quit button:
How found: Mouse move (518,502)
hwnd=0x000E047C 32bit class="OFormSub" style=0x56000000 ex=0x0
Info: IAcc = 0x0016EE18 VarChild:[VT_I4=0x0]
Impl: Remote native IAccessible
Annotation ID: [not supported]
Name: "Quit"
Value: none [mnfd]
Role: push button
State: focusable
Location: {l:467, t:487, w:92, h:28}
Description: ""
Kbshortcut: none [null]
DefAction: "Press"
Parent: "SIMS FAR v1.8":client
Help: none [mnfd]
Help Topic: [:0] [Error - Empty string - Should return S_FALSE/NULL instead?]
ChildCount: 0
Window: 0x0020051C class="OForm" style=0x56CA0000 ex=0x140
Children: Container has no children
Selection: none [empty]
Ancestors: "SIMS FAR v1.8" : client : focused,focusable
"SIMS FAR v1.8" : window : focused,moveable,focusable
"Workspace" : client : focusable
"Workspace" : window : focusable
"SIMS FAR" : client : focusable
"SIMS FAR" : window : sizeable,moveable,focusable
"Desktop" : client : normal
"Desktop" : window : normal
[ No Parent ]