ACC Library, new question.

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
x32
Posts: 177
Joined: 25 Nov 2016, 16:44

ACC Library, new question.

15 Jul 2018, 21:15

I was shown how to retrieve information from controls, that Windowspy can't see, using the ACC Library. However, having to specify their position is not reliable, especially since it only responds in screen mode. Controls change positions depending on the page and what it's function is at the time, even if the app is always full screen.

It would be my guess that there is a way to access the value of a control by name instead of by coordinates. The Accessible Info Viewer can see every control on the window. It list them according to the group they belong to. In the picture, The ACC Structure window shows all of the controls and highlights the chosen control with a red box on the main program. It also shows a path to the control in the bottom of the Accessible Info Viewer window. So how can I use the ACC library to access the information in that control by using the control's name or path?


Image
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: ACC Library, new question.

16 Jul 2018, 02:25

To get text from a GUI element, you need to find the right information to pass to the Acc_Get function. There is some info here:
Acc: get text from all window/control elements - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=40615
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
x32
Posts: 177
Joined: 25 Nov 2016, 16:44

Re: ACC Library, new question.

16 Jul 2018, 03:41

Yes, exactly what I was looking for, it uses the path. Only I'm still not getting it.

The sample code does work for retrieving from notepad, but when I try to use it for my program I get nothing. The only thing I can see to change is the path. What am I missing? What is the (2) parameter after accName?

Code: Select all

q:: ;Notepad - get status bar text
WinGet, hWnd, ID, A
;hWnd = 0x1007FC
oAcc := Acc_Get("Object", "1.1.4.13", 0, "ahk_id " hWnd)
MsgBox, % oAcc.accName(2)
oAcc := ""
return
Image
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: ACC Library, new question.

16 Jul 2018, 03:57

- Try accName and accValue.
- The (2) is the child ID, see here:
Using the ACC library - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 90#p228690
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
x32
Posts: 177
Joined: 25 Nov 2016, 16:44

Re: ACC Library, new question.

16 Jul 2018, 04:12

Ok, so for an object it should be 0. I still have blank message boxes from both.

Code: Select all

q:: 
WinGet, hWnd, ID, A
oAcc := Acc_Get("Object", "1,1,4,13", 0, "ahk_id " hWnd)
MsgBox, % oAcc.accName(0)
MsgBox, % oAcc.accValue(0)
oAcc := ""
return
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: ACC Library, new question.

16 Jul 2018, 04:17

- My function to get text for all elements is the most reliable way to get the correct path.
- [EDIT:] See JEE_AccGetTextAll, here:
Acc: get text from all window/control elements - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=40615
Last edited by jeeswg on 16 Jul 2018, 04:56, edited 1 time in total.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
x32
Posts: 177
Joined: 25 Nov 2016, 16:44

Re: ACC Library, new question.

16 Jul 2018, 04:30

Maybe I have an old version?

Code: Select all

vAccPath := "--" ;not implemented
Actually I think I'm looking at the wrong script.
x32
Posts: 177
Joined: 25 Nov 2016, 16:44

Re: ACC Library, new question.

16 Jul 2018, 04:46

SUCESS!!!!! Once I figured out which tool you were referring to.

While AIV gave me "1.1.4.13" as a path, your tool gave me "4.1.1.4.13". That fixed the problem.

Thanks again for all your help.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Chunjee, inseption86, mebelantikjaya, rc76 and 311 guests