Get ACC info (but not from point)

Get help with using AutoHotkey and its commands and hotkeys
drizzt
Posts: 31
Joined: 20 Apr 2018, 20:44

Get ACC info (but not from point)

20 Mar 2019, 14:43

Hello,

I have a Gui tree with a bunch of values. I am able to click on the first value and get the name by using this script:

Code: Select all

#Include Acc.ahk

AccGetName()
{
ComObjError(False)
oAcc := Acc_ObjectFromPoint(vChildId)
vAccRoleNum := oAcc.accRole(vChildId)
vAccRoleNumHex := Format("0x{:X}", vAccRoleNum)
vAccStateNum := oAcc.accState(vChildId)
vAccStateNumHex := Format("0x{:X}", vAccStateNum)
oRect := Acc_Location(oAcc, vChildId)

vAccName := oAcc.accName(vChildId)
ComObjError(True)
return, vAccName
}
I can then do mousemove, 0, 10, R to move 10 pixels down and get the next name
but instead of doing this, I want to just click arrow down and get the name from whatever is highlighted. Is this possible?
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Get ACC info (but not from point)

21 Mar 2019, 13:12

Here's some code to report the focused treeview item, and to list all treeview items.

Code: Select all

;[Acc functions]
;Acc library (MSAA) and AccViewer download links - AutoHotkey Community
;https://autohotkey.com/boards/viewtopic.php?f=6&t=26201

q:: ;treeview get focused item
ControlGet, hCtl, Hwnd,, SysTreeView321, A
oAcc := Acc_Get("Object", "4", 0, "ahk_id " hCtl)
vOutput := ""
Loop, % oAcc.accChildCount
	if (oAcc.accState(A_Index) & 0x4) ;STATE_SYSTEM_FOCUSED := 0x4
	{
		try vOutput := oAcc.accName(A_Index)
		break
	}
oAcc := ""
;Clipboard := vOutput
MsgBox, % vOutput
return

w:: ;treeview list items
ControlGet, hCtl, Hwnd,, SysTreeView321, A
oAcc := Acc_Get("Object", "4", 0, "ahk_id " hCtl)
vOutput := ""
Loop, % oAcc.accChildCount
	try vOutput .= oAcc.accName(A_Index) "`r`n"
oAcc := ""
;Clipboard := vOutput
MsgBox, % vOutput
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “Ask For Help”

Who is online

Users browsing this forum: AHKStudent, Bing [Bot], hisrRB57, Raymond888, teadrinker, ziwzih and 48 guests