Acc: get text from all window/control elements

Post your working scripts, libraries and tools
Posts: 8
Joined: 17 Sep 2019, 13:45

Re: Acc: get text from all window/control elements

27 Sep 2019, 12:17


is this still working with Chrome 77?

I am trying to run this in order to have total tabs open on Chrome shown on a Message Box:

Code: Select all

	oAcc := Acc_Get("Object", "", 0, "ahk_id " hWnd)
	for _, oChild in Acc_Children(oAcc)
		vTabText := oChild.accName(0)
		if !(vTabText == "")
		&& !(vTabText == "New Tab")
	oAcc := oChild := ""
	return vCount

text1 = JEE_ChromeGetTabCount(hWnd)
MsgBox, %text1%

and get this errors:

>"C:\Program Files\AutoHotkey\AutoHotkey.exe" /ErrorStdOut "C:\Users\martinhorst\atnbueno.ahk"
C:\Program Files\AutoHotkey\Lib\Acc.ahk (15) : ==> Duplicate function definition.
Specifically: Acc_Init()
>Exit code: 2 Time: 0.3308

I attach also the whole code, taken from another topic:

what am I doing wrong? please enlighten this newbie! Thanks!
(6.52 KiB) Downloaded 48 times
Posts: 1371
Joined: 22 Jan 2017, 19:37

Re: Acc: get text from all window/control elements

28 Sep 2019, 10:43

@potrovelo, I got the same error you did with Chrome 77. But it does work with mods as shown in the spoiler.

1) Chances are you already have Acc.ahk someplace the script found it (your LIB folder, most likely, where I myself have it); comment out all the "Acc_*" functions and the "Duplicate function definition" error will go a away. But more errors appear - not to worry, though.
2) As written, you are not grabbing the Hwnd of the browser window. Please try the code below, it works for me (you can comment out the MsgBox in the 'JEE_ChromeGetTabCount(hwnd)' hotkey section, of course).

Let me know if it doesn't work (I am at least getting a tab count, don't know if it's right). :D It won't get the right count if you add a tab after the script is running unless you reload.
User avatar
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Acc: get text from all window/control elements

29 Sep 2019, 20:09

@potroveio: I updated the Chrome functions, here:
Firefox/Chrome, get tab names/focus tab - Page 2 - AutoHotkey Community
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “Scripts and Functions”

Who is online

Users browsing this forum: No registered users and 24 guests