Acc library (MSAA) and AccViewer download links

Post your working scripts, libraries and tools
User avatar
hasantr
Posts: 249
Joined: 05 Apr 2016, 14:18
Location: İstanbul

Re: Acc library (MSAA) and AccViewer download links

11 Jun 2019, 03:20

I have such a problem.
---------------------------
iWB2 Learner UPDATED.ahk
---------------------------
Error: Call to nonexistent function.

Specifically: Acc_ObjectFromPoint(child).accSelect(0x3, child)

Line#
112: temp := clipboard := %A_GuiControl%
113: ToolTip,"clipboard= " (StrLen(temp) > 40 ? SubStr(temp,1,40) "..." : temp)
114: SetTimer,RemoveToolTip,1000
115: }
116: Else
116: if (A_GuiControl = "TView")
116: {
---> 117: Acc_ObjectFromPoint(child).accSelect(0x3, child)
118: Hotkey,~LButton Up,On
120: if TV_GetParent(TVsel:=TV_GetSelection())
120: {
121: TV_GetText(text, TVsel)
122: RegExMatch(text, "\d+", child)
123: clicked := Stored.pelt.childNodes[child]
124: }

The program will exit.
---------------------------
Okey
---------------------------
User avatar
jeeswg
Posts: 6647
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Acc library (MSAA) and AccViewer download links

11 Jun 2019, 21:37

- 3 possible solutions:
- (1) Create a folder called 'Lib' (in the same folder as the AutoHotkey exe), and copy Acc.ahk and Anchor.ahk into that folder.
- (2) Edit 'iWB2 Learner UPDATED.ahk', add these 2 lines at the top (or bottom):

Code: Select all

#Include %A_ScriptDir%\Acc.ahk
#Include %A_ScriptDir%\Anchor.ahk
- (3) Edit 'iWB2 Learner UPDATED.ahk', add the contents of Acc.ahk and Anchor.ahk into it at the bottom (or top).
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
hasantr
Posts: 249
Joined: 05 Apr 2016, 14:18
Location: İstanbul

Re: Acc library (MSAA) and AccViewer download links

12 Jun 2019, 02:57

jeeswg wrote:
11 Jun 2019, 21:37
- 3 possible solutions:
- (1) Create a folder called 'Lib' (in the same folder as the AutoHotkey exe), and copy Acc.ahk and Anchor.ahk into that folder.
- (2) Edit 'iWB2 Learner UPDATED.ahk', add these 2 lines at the top (or bottom):

Code: Select all

#Include %A_ScriptDir%\Acc.ahk
#Include %A_ScriptDir%\Anchor.ahk
- (3) Edit 'iWB2 Learner UPDATED.ahk', add the contents of Acc.ahk and Anchor.ahk into it at the bottom (or top).
Yeah, that worked. Thanks.
malcev
Posts: 197
Joined: 12 Aug 2014, 12:37

Re: Acc library (MSAA) and AccViewer download links

01 Sep 2019, 08:52

There is a bug in AccViewer.
To recreate this bug You have to:
1) Install the next extension: in Chrome::::
https://chrome.google.com/webstore/detail/floating-for-youtube-exte/egncdnniomonjgpjbapalkckojhkfddk
2) Run Google Chrome with --force-renderer-accessibility flag.
3) Run any Youtube video in this extension.
If You run AccViewer to get object from floating-for-youtube window - You will get nothing.
If You run AccExplorer from MSDN - You will get object and path.
https://github.com/blackrosezy/gui-inspect-tool/blob/master/AccExplorer32.exe
burque505
Posts: 1003
Joined: 22 Jan 2017, 19:37

Re: Acc library (MSAA) and AccViewer download links

01 Sep 2019, 15:57

@malcev, thank you for linking to this tool!
malcev
Posts: 197
Joined: 12 Aug 2014, 12:37

Re: Acc library (MSAA) and AccViewer download links

02 Sep 2019, 05:51

tmplinshi wrote:
10 Oct 2018, 15:57
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
https://gist.github.com/tmplinshi/0fcb8655c1402a3662ac048d0d974915

Image
There is a bug in your code.
Open Chrome, navigate to any Youtube video, double click with right mouse button on it, choose "picture in picture".
Then try to get path of this "picture in picture youtube video".
Using Your tool - You will get "5".
But if You use original AccViewer, then You will get the right path - "4.1.5".
https://raw.githubusercontent.com/Drugoy/Autohotkey-scripts-.ahk/master/DevTools/AccViewer.ahk
tmplinshi
Posts: 1484
Joined: 01 Oct 2013, 14:57

Re: Acc library (MSAA) and AccViewer download links

02 Sep 2019, 07:31

@malcev I checked the original AccViewer that I have, it produce the same result as my modified version "5". The AccViewer.ahk you provide do produce "4.1.5".

So I compared the two versions, and found the reason to it.

Code produce path "5":

Code: Select all

	Acc_ObjectFromWindow(hWnd, idObject = 0)
	{
		If DllCall("oleacc\AccessibleObjectFromWindow", "Ptr", hWnd, "UInt", idObject&=0xFFFFFFFF, "Ptr", -VarSetCapacity(IID,16)+NumPut(idObject==0xFFFFFFF0?0x46000000000000C0:0x719B3800AA000C81,NumPut(idObject==0xFFFFFFF0?0x0000000000020400:0x11CF3C3D618736E0,IID,"Int64"),"Int64"), "Ptr*", pacc)=0
			Return	ComObjEnwrap(9,pacc,1)
	}
Code produce path "4.1.5":

Code: Select all

	Acc_ObjectFromWindow(hWnd, idObject = 0)
	{
		Acc_Init()
		If	DllCall("oleacc\AccessibleObjectFromWindow", "Ptr", hWnd, "UInt", idObject&=0xFFFFFFFF, "Ptr", -VarSetCapacity(IID,16)+NumPut(idObject==0xFFFFFFF0?0x46000000000000C0:0x%_offset1%19B3800AA000C81,NumPut(idObject==0xFFFFFFF0?0x0000000000020400:0x11CF3C3D618736E0,IID,"Int64"),"Int64"), "Ptr*", pacc)=0
		Return	ComObjEnwrap(9,pacc,1)
	}
The difference between the above two Acc_ObjectFromWindow functions:
  • 0x719B3800AA000C81
  • 0x%_offset1%19B3800AA000C81
The value of _offset1 is 10, but it's not a global variable, or even it was, MsgBox % 0x%_offset1%19B3800AA000C81 will be empty, that means you can just replace 0x%_offset1%19B3800AA000C81 to 0 to get the result path "4.1.5".
I think this was an accident that someone made a replacement to 7 with %_offset1% :D .
malcev
Posts: 197
Joined: 12 Aug 2014, 12:37

Re: Acc library (MSAA) and AccViewer download links

02 Sep 2019, 17:45

I do not think that it will be correct.
I do not understand why in this function:

Code: Select all

GetAccPath(Acc, byref hwnd="") {
	hwnd := Acc_WindowFromObject(Acc)
	WinObj := Acc_ObjectFromWindow(hwnd)
	WinObjPos := Acc_Location(WinObj).pos
	while Acc_WindowFromObject(Parent:=Acc_Parent(Acc)) = hwnd {
		t2 := GetEnumIndex(Acc) "." t2
		if Acc_Location(Parent).pos = WinObjPos
			return {AccObj:Parent, Path:SubStr(t2,1,-1)}
		Acc := Parent
	}
	while Acc_WindowFromObject(Parent:=Acc_Parent(WinObj)) = hwnd
		t1.="P.", WinObj:=Parent
	return {AccObj:Acc, Path:t1 SubStr(t2,1,-1)}
}
we need this expression

Code: Select all

		if Acc_Location(Parent).pos = WinObjPos
			return {AccObj:Parent, Path:SubStr(t2,1,-1)}
If we remove it - code produce path "4.1.5".
And if We need to get object and path from Chrome We should rewrite GetAccPath and GetEnumIndex functions.
User avatar
jeeswg
Posts: 6647
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Acc library (MSAA) and AccViewer download links

02 Sep 2019, 18:25

There may be some ideas here re. alternative Acc functions (for Acc paths):
How to get the full ACC path for control on cursor? - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=56470&p=254902#p254902
AccessibleObjectFromWindow does not execute method accFocus in Firefox - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=60278&p=254907#p254907

You could try this for getting Acc paths (JEE_AccGetTextAll):
Acc: get text from all window/control elements - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=40615

@malcev: It would be helpful, after a while/after reflecting, when the picture is clearer, if you could summarise what problems you have seen with Acc.ahk and/or AccViewer, specifically problems with the versions in the AccPack zip. Thanks. [EDIT: Or you could create an alternative AccPack zip with proposed updated scripts.]

Thanks also for the great links re. YouTube and Acc alternatives. Much appreciated.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
malcev
Posts: 197
Joined: 12 Aug 2014, 12:37

Re: Acc library (MSAA) and AccViewer download links

03 Sep 2019, 20:25

There is an error in library from the first post link
[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
If DllCall("oleacc\AccessibleObjectFromWindow", "Ptr", hWnd, "UInt", idObject&=0xFFFFFFFF, "Ptr", -VarSetCapacity(IID,16)+NumPut(idObject==0xFFFFFFF0?0x46000000000000C0:0x%_offset1%19B3800AA000C81,NumPut(idObject==0xFFFFFFF0?0x0000000000020400:0x11CF3C3D618736E0,IID,"Int64"),"Int64"), "Ptr*", pacc)=0
And I think that algorithm for getting path in AccViewer.ahk is wrong.
There are some situations in Google Chrome when several parent objects have the same location as child object and how we can choose which one of them to take?
May be it will be better to get path of searched object with creating tree of all objects and comparing each object properties such as name, value, state, location... with our searched object properties?

Return to “Scripts and Functions”

Who is online

Users browsing this forum: No registered users and 28 guests