Need Help in using ACC library Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
rakesha002
Posts: 30
Joined: 04 Dec 2017, 00:11

Need Help in using ACC library

13 Dec 2018, 05:00

Hello,

I am trying to get info from Firefox window using ACC lib, so far i got the code working ok, but search is slow and going deep is time consuming but working.
My question is can i (or any one) make it more simplified/modified/ realistic as i made it very complicated and almost close chaos(using function call recursively).
FFAccess.ahk
get info from Firefox window using ACC lib
(1.33 KiB) Downloaded 39 times
i'm open to all suggestions, any help would be great
Thanks
User avatar
jeeswg
Posts: 6904
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Need Help in using ACC library  Topic is solved

13 Dec 2018, 05:36

This may be relevant.
Acc: get text from all window/control elements - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=40615

AccViewer might be useful, though you probably know about it already.
Acc library (MSAA) and AccViewer download links - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=26201

Some Acc examples with Firefox.
Firefox/Chrome, get tab names/focus tab - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=26947
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
rakesha002
Posts: 30
Joined: 04 Dec 2017, 00:11

Re: Need Help in using ACC library

15 Dec 2018, 02:32

Hi Jeeswg,
jeeswg wrote:
13 Dec 2018, 05:36
This may be relevant.
Acc: get text from all window/control elements - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=40615
Yes this is relevant, Thanks man, i previously found this script but never went into that deep,

I need to ask you a question though, i need Location of each in the loop, from here do i need to

1. Acc := Acc_ObjectFromPoint(ChildId)
Location := GetAccLocation(Acc, ChildId)

2. Acc := Acc_ObjectFromPath(Acc_ObjectFromWindow(Win), "4,25,1,1,1,8,2,1,1,1,2,2,1,1")
Location := Acc_Location(Acc)
after getting path
please clarify it, thanks.
DRocks
Posts: 525
Joined: 08 May 2018, 10:20

Re: Need Help in using ACC library

15 Dec 2018, 07:44

I also have trouble with hierarchy higher than 2. Example: path 5.2 is ok but 4.5.2 is not

The only way I found to make this work is to isolate the classNN of the closest parent to the control I am looking for.
But I have never been able to get text from a control that is somehwere in a complex hierarchy. Acc Viewer only reveals 2 steps of path its wierd

Your last example with the path: 4,25,1,1,1,8,2,1,1,1,2,2,1,1 would be a complete failure for me unless I learn how to correctly find the right path sequence too

But what is cool is that when it works, it works so worth the effort.
Btw the isolate classNN tip which is the only way I got it working was feom you Jee so again and again, thank you

Edit: forgot to mention that I am using traditionnal acc librairy function acc_get("object....)
User avatar
jeeswg
Posts: 6904
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Need Help in using ACC library

16 Dec 2018, 00:01

Here's some code for getting the coordinates of an element.

Code: Select all

q:: ;Acc - get position of element under cursor
oAcc := Acc_ObjectFromPoint(vChildID)
Acc_Location(oAcc, vChildID, vPos)
MsgBox, % vPos
return

w:: ;Notepad - get Edit control position
WinGet, hWnd, ID, A
oAcc := Acc_Get("Object", "4.1.4", 0, "ahk_id " hWnd)
Acc_Location(oAcc, 0, vPos)
MsgBox, % vPos
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
DRocks
Posts: 525
Joined: 08 May 2018, 10:20

Re: Need Help in using ACC library

16 Dec 2018, 00:24

Thank you. So this should find the complete hierarchy / path ?
I will try it tommorow
rakesha002
Posts: 30
Joined: 04 Dec 2017, 00:11

Re: Need Help in using ACC library

17 Dec 2018, 11:38

DRocks wrote:
16 Dec 2018, 00:24
Thank you. So this should find the complete hierarchy / path ?
I will try it tommorow
Hi DRocks,

Did it find what you are looking for? The complex one?

Yes path higher than 2 in Firefox, is complex and cant get it accurately
DRocks
Posts: 525
Joined: 08 May 2018, 10:20

Re: Need Help in using ACC library

17 Dec 2018, 17:02

I did not test it yet im sorry
rakesha002
Posts: 30
Joined: 04 Dec 2017, 00:11

Re: Need Help in using ACC library

18 Dec 2018, 08:23

Hi DRocks,

Good news for both of us i got it working finally
""Acc: get text from all window/control elements - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=40615 ""
turns out "jeeswg's" script is giving perfect path than "Accessible info Viewer" in this case.
hope it helps any one else who needs it.
have a great day
User avatar
jeeswg
Posts: 6904
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Need Help in using ACC library

18 Dec 2018, 16:46

Hello rakesha002, in the last few days I wrote this post comparing my top-down 'AccGetTextAll' function against the (in some ways unreliable) bottom-up AccViewer approach.
How to get the full ACC path for control on cursor? - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 29#p253329
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
rakesha002
Posts: 30
Joined: 04 Dec 2017, 00:11

Re: Need Help in using ACC library

19 Dec 2018, 03:44

Hi, jeeswg,

Thank you for your great scripts, those works like a charm in my daily routine, keep up the good work

have a great day
rakesha002
Posts: 30
Joined: 04 Dec 2017, 00:11

Re: Need Help in using ACC library

19 Dec 2018, 12:27

Hi, jeeswg,

Can i ask one more question, i'm curious though
like location and other parameters can i get path under mouse cursor (object from point of-course)

Thanks
User avatar
jeeswg
Posts: 6904
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Need Help in using ACC library

19 Dec 2018, 18:36

- That's the question I address in the link above. It's difficult to always get the numbers right (nth child), and to know how many numbers to use (at what point stop as you add numbers to the left).
- I may return to the function to use more criteria to try and get the numbers right, and to indicate whenever a number is uncertain.
- Issues to do with how many numbers to use have been a bit baffling. However, I might consider combining a top-down (like my get all text function) and a bottom-up approach. This could be somewhat slow though.
- For my own use however, I've been happy just to use the top-down approach that lists every GUI element, and haven't really needed an element under cursor approach. It's only been because AccViewer attempts this and because people have asked for it, that I've investigated it. (Well, it was a worthwhile question to investigate anyhow.)
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
rakesha002
Posts: 30
Joined: 04 Dec 2017, 00:11

Re: Need Help in using ACC library

20 Dec 2018, 01:14

Hi, jeeswg,

Yep, your are right about every thing you said, and somewhat i know the answer as well,
Currently I'm looking into your new "bottom-up approach" since you've mentioned it here, "For me it is complete failure on Firefox so far gives only controls vIndex"


Edit :
I need to ask you a favor(or any one else who's interested),
I found a work around to find path of control under mouse in firefox from your script,
Can you make it any faster, for me it is almost 10 sec, and
finding is in active tab only so every thing else not required, take off extra load or something you know better than me.
Thanks.
Attachments
Get_AccPath.ahk
Finding control's path (firefox mainly)
(2.41 KiB) Downloaded 30 times

Return to “Ask For Help”

Who is online

Users browsing this forum: boiler, Google [Bot], Odlanir, pn4265 and 229 guests