- To whom it may concern -
as this thread is from 2016, you might get interested to use UIA , ACC's successor instead: viewtopic.php?f=6&t=104999
"UIAutomation is a Microsoft accessibility framework that allows interacting with user-accessible elements (clicking buttons, sending text etc) in a programmatic way. It is the successor to the Acc/MSAA framework."
... and why that makes even more sense: viewtopic.php?p=467030#p467030
But just in case you stick with ACC, UIAViewer.ahk (provided on the page linked above) offers the option to run in "Acc-Mode" to identify Acc-paths more reliable!
[(BoBo) Moderator: Added 2022-06-10]
; ----------------------------------------------------------------------
I couldn't find a page on the new forum with up-to-date links for the Acc library and AccViewer so I'm posting some here:
See AccPack.zip at the bottom of this post, it contains AHK v1 versions of:
Acc.ahk
AccViewer.ahk
Anchor.ahk
iWB2 Learner UPDATED.ahk
==================================================
[Acc.ahk]
Autohotkey-scripts-.ahk/Acc.ahk at master · Drugoy/Autohotkey-scripts-.ahk · GitHub
https://github.com/Drugoy/Autohotkey-scripts-.ahk/blob/master/Libraries/Acc.ahk
[AccViewer.ahk]
Autohotkey-scripts-.ahk/AccViewer.ahk at master · Drugoy/Autohotkey-scripts-.ahk · GitHub
https://github.com/Drugoy/Autohotkey-scripts-.ahk/blob/master/DevTools/AccViewer.ahk
[Anchor.ahk (for use with AccViewer)]
AutoHotkey-Scripts/Anchor.ahk at master · polyethene/AutoHotkey-Scripts · GitHub
https://github.com/polyethene/AutoHotkey-Scripts/blob/master/Anchor.ahk
TO DOWNLOAD:
Go to the right-hand side of the page and right-click Raw.
TO INSTALL:
Place Acc.ahk and Anchor.ahk in the folder:
C:\Program Files\AutoHotkey\Lib
TO RUN:
Double-click AccViewer.ahk.
TO USE:
Drag the crosshair to a window/control/object.
Or hover over a window/control/object and press Ctrl+/.
TIPS ON RETRIEVING TEXT/INFORMATION VIA THE ACC LIBRARY:
jeeswg's Acc tutorial - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=7&t=40590
AccViewer Basic - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=32039
==================================================
[iWB2 Learner UPDATED.ahk (23,803 bytes)]
New item: iWB2 Learner · Issue #94 · ahkscript/awesome-AutoHotkey · GitHub
https://github.com/ahkscript/awesome-AutoHotkey/issues/94
TO DOWNLOAD:
Go to iWB2 Learner UPDATED.zip and right-click,
or instead, use the direct download link:
https://github.com/ahkscript/awesome-AutoHotkey/files/211139/iWB2.Learner.UPDATED.zip
TO RESOLVE THE ERROR ('Error: Invalid function declaration.'):
[note: this error has already been fixed in the AccPack.zip download below]
Edit the script, replace:
TV_GetDiffCount(p1, p2))
with:
TV_GetDiffCount(p1, p2)
==================================================
[Excel_Get function][new version][doesn't require Acc]
MS-Office-COM-Basics/Excel_Get.ahk at master · ahkon/MS-Office-COM-Basics · GitHub
https://github.com/ahkon/MS-Office-COM-Basics/blob/master/Examples/Excel/Excel_Get.ahk
[Excel_Get function][old version][requires Acc]
excel and com? - Ask for Help - AutoHotkey Community
https://autohotkey.com/board/topic/73940-excel-and-com/#entry469769
Acc library (MSAA) and AccViewer download links
Acc library (MSAA) and AccViewer download links
- Attachments
-
- AccPack.zip
- (19.83 KiB) Downloaded 5145 times
Last edited by jeeswg on 14 Apr 2018, 17:41, edited 12 times 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
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: Acc library (MSAA) and AccViewer download links
Thank you very much for this.
Re: Acc library (MSAA) and AccViewer download links
Cheers, an absolute pleasure. And just so everyone knows I did not write these great functions!
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: Acc library (MSAA) and AccViewer download links
For a copy that works with my 64-bit Win7 box you can try https://dl.dropboxusercontent.com/u/676 ... PDATED.ahk.
I corrected the typo listed above and moved a variable. Please let me know if it doesn't work or the link dies.
Edit: That link is dead due to Dropbox policy changes, but it's apparently irrelevant now. April 30, 2018
Thanks!
burque505
I corrected the typo listed above and moved a variable. Please let me know if it doesn't work or the link dies.
Edit: That link is dead due to Dropbox policy changes, but it's apparently irrelevant now. April 30, 2018
Thanks!
burque505
Last edited by burque505 on 30 Apr 2018, 15:46, edited 2 times in total.
Re: Acc library (MSAA) and AccViewer download links
I compared your version with the version I have using WinMerge.
Since I have the corrected the (two brackets) error also,
the only difference was:
;#INCLUDE %A_ScriptDir%\Query.ahk
#INCLUDE %A_ScriptDir%\Anchor.ahk
#INCLUDE %A_ScriptDir%\Acc.ahk
Indeed iWB2 Learner requires Anchor.ahk and Acc.ahk,
this can be done by putting them in
C:\Program Files\AutoHotkey\Lib,
but yes sometimes I include scripts directly using #Include.
Query.ahk is no longer needed, and is correctly commented out.
I don't know which variable you moved, WinMerge did not show
any moved variable.
Thank you for your comments.
Since I have the corrected the (two brackets) error also,
the only difference was:
;#INCLUDE %A_ScriptDir%\Query.ahk
#INCLUDE %A_ScriptDir%\Anchor.ahk
#INCLUDE %A_ScriptDir%\Acc.ahk
Indeed iWB2 Learner requires Anchor.ahk and Acc.ahk,
this can be done by putting them in
C:\Program Files\AutoHotkey\Lib,
but yes sometimes I include scripts directly using #Include.
Query.ahk is no longer needed, and is correctly commented out.
I don't know which variable you moved, WinMerge did not show
any moved variable.
Thank you for your comments.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: Acc library (MSAA) and AccViewer download links
Gr8 tool.tnx!
Re: Acc library (MSAA) and AccViewer download links
Hallo @jeeswg
@jNizM recommended this library to make usable a key on my keyboard that AHK does not natively see. All I can see in forum threads, etc, is GUI related, so I feel lost. Any tips? Or who would know, or how do I learn?
Thanks :wave:
@jNizM recommended this library to make usable a key on my keyboard that AHK does not natively see. All I can see in forum threads, etc, is GUI related, so I feel lost. Any tips? Or who would know, or how do I learn?
Thanks :wave:
try it and see
...
...
Re: Acc library (MSAA) and AccViewer download links
I haven't personally done anything like that. Not that it's impossible, but I can't see how Acc would help with this, I view it more for interacting with GUIs as you say. Perhaps AHKHID (the word does look a little like 'Acc') or Lua? I'd say more if I knew any more. Best of luck.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: Acc library (MSAA) and AccViewer download links
I've since investigated AHKHID. Try these scripts in case they help to solve your problem.
NEW Barcode Input Capture (USB and RS232 compatible) - Page 2 - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 73#p170673
AHK keyboard hook + AHKHID causing buggy behavior - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 925#p87925
NEW Barcode Input Capture (USB and RS232 compatible) - Page 2 - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 73#p170673
AHK keyboard hook + AHKHID causing buggy behavior - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 925#p87925
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: Acc library (MSAA) and AccViewer download links
For the (others) dummies who(also) struggle to understand the syntax:
https://autohotkey.com/boards/viewtopic ... 72#p190772
https://autohotkey.com/boards/viewtopic ... 72#p190772
Re: Acc library (MSAA) and AccViewer download links
I found that ACC library does not work with directive #if.
1 example - open google chrome, move cursor to address bar, and press f10, f11.
When we press f10 - the result will be wrong.
2 example - open google chrome and press f10.
I get error - "Error 0x8001010D - An outgoing call cannot be made since the application dispatching an input-synchronous call".
If I press f11 - all works OK.
Is it bug of autohotkey or acc library or I do something wrong?
1 example - open google chrome, move cursor to address bar, and press f10, f11.
When we press f10 - the result will be wrong.
Code: Select all
#If !test()
f10:: return
#If
return
f11::test()
return
test()
{
tooltip % Acc_test(child).accName(child)
}
Acc_test(ByRef _idChild_ = "", x = "", y = "")
{
Static h
If Not h
h:=DllCall("LoadLibrary","Str","oleacc","Ptr")
If DllCall("oleacc\AccessibleObjectFromPoint", "Int64", x==""||y==""?0*DllCall("GetCursorPos","Int64*",pt)+pt:x&0xFFFFFFFF|y<<32, "Ptr*", pacc, "Ptr", VarSetCapacity(varChild,8+2*A_PtrSize,0)*0+&varChild)=0
Return ComObjEnwrap(9,pacc,1), _idChild_:=NumGet(varChild,8,"UInt")
}
I get error - "Error 0x8001010D - An outgoing call cannot be made since the application dispatching an input-synchronous call".
If I press f11 - all works OK.
Code: Select all
#If !test()
f10:: return
#If
return
f11::test()
return
test()
{
hwndChrome := WinExist("ahk_class Chrome_WidgetWin_1")
AccChrome := Acc_ObjectFromWindow(hwndChrome)
AccAddressBar := GetElementByName(AccChrome, "Address and search bar")
msgbox % AccAddressBar.accValue(0)
}
GetElementByName(AccObj, name) {
if (AccObj.accName(0) = name)
return AccObj
for k, v in Acc_Children(AccObj)
if IsObject(obj := GetElementByName(v, name))
return obj
}
Re: Acc library (MSAA) and AccViewer download links
- @malcev: I did some tests and got the same results as you, the error message appeared when used with #If but otherwise the function worked.
- Since #If has to be fast, perhaps it's placing certain limits on what functions can do.
[EDIT:] The issue is further discussed here:
#If and ComObjCreate return error 0x8001010D - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=48444
- Since #If has to be fast, perhaps it's placing certain limits on what functions can do.
Code: Select all
#If oAcc := test()
q::
MsgBox, % oAcc.accValue(0)
return
#If
;Error: 0x8001010D - An outgoing call cannot be made since the application is dispatching an input-synchronous call.
;do e then w
e::
oAcc := test()
MsgBox, % oAcc.accValue(0)
return
#If test2()
w::
MsgBox, % oAcc.accValue(0)
return
#If
r::
ToolTip
return
test()
{
if !hWnd := WinActive("ahk_class Chrome_WidgetWin_1")
return
oAcc := Acc_Get("Object", "4.1.2.2.3.5.2", 0, "ahk_id " hWnd)
ToolTip, % "TEST: " oAcc.accValue(0)
if InStr(oAcc.accValue(0), "http")
|| InStr(oAcc.accValue(0), "www")
return oAcc
}
test2()
{
global oAcc
if !hWnd := WinActive("ahk_class Chrome_WidgetWin_1")
return
if InStr(oAcc.accValue(0), "http")
|| InStr(oAcc.accValue(0), "www")
return 1
}
#If and ComObjCreate return error 0x8001010D - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=48444
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
-
- Posts: 1472
- Joined: 05 May 2018, 12:23
Re: Acc library (MSAA) and AccViewer download links
Question: Does anyone know where in MSDN it talks about ACC? Curious to read up about it and how windows works within its api for this.
I tried doing acc or other searches but was not successful.
Thank you
I tried doing acc or other searches but was not successful.
Thank you
Re: Acc library (MSAA) and AccViewer download links
There are some links here:
jeeswg's Acc tutorial - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=7&t=40590
This is pretty much the only link I've used:
IAccessible interface (Windows)
https://msdn.microsoft.com/en-us/librar ... s.85).aspx
jeeswg's Acc tutorial - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=7&t=40590
This is pretty much the only link I've used:
IAccessible interface (Windows)
https://msdn.microsoft.com/en-us/librar ... s.85).aspx
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
-
- Posts: 1472
- Joined: 05 May 2018, 12:23
Re: Acc library (MSAA) and AccViewer download links
That was helpful thank youjeeswg wrote:There are some links here:
jeeswg's Acc tutorial - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=7&t=40590
This is pretty much the only link I've used:
IAccessible interface (Windows)
https://msdn.microsoft.com/en-us/librar ... s.85).aspx
Re: Acc library (MSAA) and AccViewer download links
AccViewer.ahk is not working in my system. I don't really know what it's supposed to do, but probably it's not supposed to crash when I press the Show Acc Structure... Unless I press that button, it does abssolutely nothing
My AHK version is 1.1.29.00
Edit: I have managed to do something, first changing the hotkey to CTRL+P (no idea why CTRL+/ did not work). However, it does not seem to find any difference between two dialog boxes I am using within a page
My AHK version is 1.1.29.00
Edit: I have managed to do something, first changing the hotkey to CTRL+P (no idea why CTRL+/ did not work). However, it does not seem to find any difference between two dialog boxes I am using within a page
Re: Acc library (MSAA) and AccViewer download links
- Try v1.1.29.01 or a version before v1.1.29.00.
- If you have any further queries re. the dialog boxes, I would suggest starting a new thread.
- If you have any further queries re. the dialog boxes, I would suggest starting a new thread.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: Acc library (MSAA) and AccViewer download links
I made some changes to the AccViewer:
- Display all 'State' and its constant name/value
- Display constant name/value of 'Role'
- Changed the hotkey from "Ctrl+/" to "Ctrl+F12"
- Added 'HotTracking' checkbox
- Increased GUI Size
Re: Acc library (MSAA) and AccViewer download links
Nice, I like the changes, thank you.
Regards,
burque505
Regards,
burque505
Re: Acc library (MSAA) and AccViewer download links
- Nicely done tmplinshi.
- I intend to do a similar AccViewer edit re. states.
- You can see the info I intend to display here. All states, like you've done, as well as a list of the focused and selected item indexes if applicable.
AccViewer Basic - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=32039
- I need to add support for getting the Acc path. I want to make available the Acc path relative to the window and relative to the first available ancestor control, ready to copy and paste for use with Acc_Get, in a similar way to this script:
Acc: get text from all window/control elements - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=40615
(It's not always clear what the AccViewer path is relative to, what the starting point is.)
And in a similar way to this script (thanks again tmplinshi):
How to get the full ACC path for control on cursor? - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 67#p241267
- I also plan to add hotkeys to show the window/control under the cursor.
- I also intend to convert it to AHK v2.
- I found the AccViewer script really really bad to work with. I would like to overhaul the entire code, while retaining the same outward appearance.
- That and iWB2 Learner are the only scripts I've had problems with converting to AHK v2.
- I also want to fix zoom support in iWB2 Learner, but I was having problems with frames inside frames. The still unresolved problem preventing further work on AccViewer.
Internet Explorer get element under cursor (show borders, show text) (any zoom percentage) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=29458
- I've decided to get back to AccViewer before iWB2 Learner, but it's somewhere like 11th to 20th on my AutoHotkey to-do list.
[EDIT:] I've addressed getting the Acc path (and text) for the GUI element under the cursor in the scripts below:
[get the Acc path for the element under the cursor]
How to get the full ACC path for control on cursor? - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=56470
[ code to try and get the text for the element under the cursor]
getting a link's URL or the content of a tooltip - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=3918
- I intend to do a similar AccViewer edit re. states.
- You can see the info I intend to display here. All states, like you've done, as well as a list of the focused and selected item indexes if applicable.
AccViewer Basic - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=32039
- I need to add support for getting the Acc path. I want to make available the Acc path relative to the window and relative to the first available ancestor control, ready to copy and paste for use with Acc_Get, in a similar way to this script:
Acc: get text from all window/control elements - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=40615
(It's not always clear what the AccViewer path is relative to, what the starting point is.)
And in a similar way to this script (thanks again tmplinshi):
How to get the full ACC path for control on cursor? - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 67#p241267
- I also plan to add hotkeys to show the window/control under the cursor.
- I also intend to convert it to AHK v2.
- I found the AccViewer script really really bad to work with. I would like to overhaul the entire code, while retaining the same outward appearance.
- That and iWB2 Learner are the only scripts I've had problems with converting to AHK v2.
- I also want to fix zoom support in iWB2 Learner, but I was having problems with frames inside frames. The still unresolved problem preventing further work on AccViewer.
Internet Explorer get element under cursor (show borders, show text) (any zoom percentage) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=29458
- I've decided to get back to AccViewer before iWB2 Learner, but it's somewhere like 11th to 20th on my AutoHotkey to-do list.
[EDIT:] I've addressed getting the Acc path (and text) for the GUI element under the cursor in the scripts below:
[get the Acc path for the element under the cursor]
How to get the full ACC path for control on cursor? - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=56470
[ code to try and get the text for the element under the cursor]
getting a link's URL or the content of a tooltip - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=3918
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Return to “Scripts and Functions (v1)”
Who is online
Users browsing this forum: No registered users and 74 guests