active accessibility get value

Get help with using AutoHotkey and its commands and hotkeys
hrvoje83
Posts: 45
Joined: 01 Mar 2017, 10:37

active accessibility get value

27 Sep 2017, 01:56

Hello,

I need some help with my code.

Am I missing something, because message box is always empty and I did spy stuff with accessible info viewer?

If you ask me for a win title, it is in a variable "hrx", and it is from main window, so this is fine.
Picture of Accesible info viewer is in attachment.

WinActivate, ahk_class AxMainFrame
Sleep, 333
WinGetTitle, hrx, ahk_class AxMainFrame
Sleep, 333
#Include C:\Program Files\AutoHotkey\Lib\Acc.ahk
test := Acc_Get("Value", "4.2.8", 0, "%hrx%")
Sleep, 300
MsgBox, 0, , %test%, 1
Return
Attachments
Capture.PNG
Capture.PNG (12.42 KiB) Viewed 1128 times
Elgin
Posts: 106
Joined: 30 Sep 2013, 09:19

Re: active accessibility get value

27 Sep 2017, 03:03

Your code tries to access the window with the literal name: %hrx%

Use:

Code: Select all

test := Acc_Get("Value", "4.2.8", 0, hrx)
hrvoje83
Posts: 45
Joined: 01 Mar 2017, 10:37

Re: active accessibility get value

27 Sep 2017, 03:16

Hi Elgin,

Thanks for your reply, but these two combination does not working.

test := Acc_Get("Value", "4.2.8", 0, hrx)
test := Acc_Get("Value", "4.2.8", 0, %hrx%)

Also the 1st one same situation
test := Acc_Get("Value", "4.2.8", 0, "%hrx%")

Is anything else wrong in my code INCLUDE maybe?
Elgin
Posts: 106
Joined: 30 Sep 2013, 09:19

Re: active accessibility get value

27 Sep 2017, 03:57

Since you're accessing the window through "ahk_class AxMainFrame": does it have a title at all? If not you would pass an empty string through hrx which will do nothing.

Try:

Code: Select all

test := Acc_Get("Value", "4.2.8", 0, "ahk_class AxMainFrame")
and get rid of the WinGetTitle. The WinActivate should not be needed either.
User avatar
jeeswg
Posts: 5286
Joined: 19 Dec 2016, 01:58
Location: UK

Re: active accessibility get value

27 Sep 2017, 05:32

The following may work:

Code: Select all

ControlGet, hCtl, Hwnd,, AxPaneWnd4, ahk_class AxMainFrame
test := Acc_Get("Value", "4.2.8", 0, "ahk_id " hCtl)
test2 := Acc_Get("Value", "4.1.4.2.8", 0, "ahk_id " hCtl)
MsgBox, 0,, % test, 1
MsgBox, 0,, % test2, 1
return
Btw I would expect that Sleep would not be necessary for this script.

This works in Notepad:

Code: Select all

q::
ControlGet, hCtl, Hwnd,, Edit1, ahk_class Notepad
vText := Acc_Get("Value", "4", 0, "ahk_id " hCtl)
MsgBox, % vText
return
hrvoje83
Posts: 45
Joined: 01 Mar 2017, 10:37

Re: active accessibility get value

27 Sep 2017, 05:57

Wow, this code bellow works, really thanks for your help jeeswg :)

Also Elgin thank you too.

ControlGet, hCtl, Hwnd,, AxPaneWnd4, ahk_class AxMainFrame
test := Acc_Get("Value", "4.2.8", 0, "ahk_id " hCtl)
MsgBox, 0,, % test, 1
return
hrvoje83
Posts: 45
Joined: 01 Mar 2017, 10:37

Re: active accessibility get value

30 Jan 2018, 09:37

Hi all,

I need help with this code, can someone knows what is wrong with my code?

Always I get blank message after run, Name is not working.

Is it because of IE?

Am I missing something?

Code: Select all

test := ""
WinActivate, ahk_class IEFrame
Sleep, 333
#Include Acc.ahk
ControlGet, hCtl, Hwnd, , Internet Explorer_Server1, ahk_class IEFrame
test := Acc_Get("Name", "14.1.6.23.1", 1, "ahk_id " hCtl)
Sleep, 300
MsgBox, 0, , %test%
Return
Attachments
Capture.PNG
Capture.PNG (15.8 KiB) Viewed 904 times
User avatar
jeeswg
Posts: 5286
Joined: 19 Dec 2016, 01:58
Location: UK

Re: active accessibility get value

30 Jan 2018, 10:17

- You might want to use the hWnd of Internet Explorer instead of the control, it depends which window/control you select with the rectangle, before navigating down to the element.
- I would generally recommend using COM for Internet Explorer.
- This might help you to identify the right Acc path:
Acc: get text from all window/control elements - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=40615
hrvoje83
Posts: 45
Joined: 01 Mar 2017, 10:37

Re: active accessibility get value

30 Jan 2018, 10:26

Hi jeeswg,

What is the hWnd of IE?

Yes, normally I am using COM, but these fields are inside IE like IFRAME.1, so my thoughts are to use Acc to get Values/Names of these fields.

Can you help me with that? What is best choice?
Capture2.PNG
Capture2.PNG (14.3 KiB) Viewed 892 times
User avatar
jeeswg
Posts: 5286
Joined: 19 Dec 2016, 01:58
Location: UK

Re: active accessibility get value

30 Jan 2018, 11:50

- To get the hWnd of Internet Explorer:
WinGet, hWnd, ID, ahk_class IEFrame

- An IFrame example:
IE iframe and frame - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 78#p128078

- Further IFrame links:
COM+IE error "0x80070005 - Access is denied." with PayPal - Ask for Help - AutoHotkey Community
https://autohotkey.com/board/topic/9144 ... ntry668548
Need COM help for IE - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 189#p28189
hrvoje83
Posts: 45
Joined: 01 Mar 2017, 10:37

Re: active accessibility get value

31 Jan 2018, 05:57

Hi,

Finally I did it.

After more houndrets tries correct path is 1.14.1.6.23.1, but in Acc Viewer you can see up in this post given path is 14.1.6.23.1.

So I was missing "1." in front of the code.

Is something wrong with Acc Viewer or I am not using it correctly?

Correct code is:

Code: Select all

test := Acc_Get("Name", "1.14.1.6.23.1", 1, "ahk_id " hCtl)
User avatar
jeeswg
Posts: 5286
Joined: 19 Dec 2016, 01:58
Location: UK

Re: active accessibility get value

31 Jan 2018, 07:04

- It can be difficult to get AccViewer to show the correct numbers in full, that was a key reason for the function I created, posted here:
Acc: get text from all window/control elements - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=40615
- Even though it looks like you've been successful, I would recommend that you try the function in that link, and also try my script that uses WBGet above, in case that works.
User avatar
gregster
Posts: 1426
Joined: 30 Sep 2013, 06:48

Re: active accessibility get value

31 Jan 2018, 07:49

Haven't used AccViewer for a while, but isn't the "1." for the "child id", mentioned in the AccViewer. "Path" is then the path for that child ID...

EDit: Ah, I guess the next parameter in Acc_Get is for the child ID... but does this function work correctly then? I guess I will have to investigate further... ;)
hrvoje83
Posts: 45
Joined: 01 Mar 2017, 10:37

Re: active accessibility get value

31 Jan 2018, 08:18

Hi gregster,

I can help you with something that I know and that is my next thing to investigate.

Situation is similar like above, path is 1.14.1.17.4.1.1 and Child id: 2, but wont find name when you put lets say:

2.1.14.1.17.4.1.1, 2
1.14.1.17.4.1.1, 2
2.14.1.17.4.1.1, 1
2.14.1.17.4.1.1, 2

I am working in Microsoft Dynamics CRM.
hrvoje83
Posts: 45
Joined: 01 Mar 2017, 10:37

Re: active accessibility get value

31 Jan 2018, 09:30

Ok, now it is working I just put 2nd option and thats it.

I mean I tried this over and over.

I hope that tommorow whenn I come again to job it will still be working :)
hrvoje83
Posts: 45
Joined: 01 Mar 2017, 10:37

Re: active accessibility get value

31 Jan 2018, 09:36

After restarting of my computer againg not working???!!!???

Does someone knows what could be problem?

Maybe include or something else?

Return to “Ask For Help”

Who is online

Users browsing this forum: Google [Bot], paik1002, roysubs, Scr1pter and 111 guests