Get name/state or activate any tab in a web browser

Post your working scripts, libraries and tools
serg
Posts: 35
Joined: 21 Mar 2015, 05:33

Get name/state or activate any tab in a web browser

31 Jul 2015, 05:51

I want to share what I have just learned - how to get info or activate any tab in a browser. This method will probably work for most browsers, I tried it on few and it worked.
It is based entirely on posts/code by Jethrow. Since it took me some time to figure out how to do it even after reading Jethrow posts, I want to share this step by step guide, which might be helpful to other AHK newbies.

Big THANKS to Jethrow for Accessible Info Viewer and to Sean & Jethrow for Acc library.
(I know Jethrow abandoned Acc-Viewer in favor of UI-based tools, but it still works like a charm)

Acc Lib and Accessible Info Viewer will be needed:
http://www.autohotkey.com/board/topic/7 ... -09272012/
http://www.autohotkey.com/board/topic/7 ... 012-09-20/

Open the Viewer and drag cross on top of the browser control where all tabs are located and see if in Acc Structure you can see names of tabs.
If you see tab names there, note name of Class(NN) of that control, and "Path" / "Child ID" on the bottom of the Viewer

Here is example for K-Meleon browser:
From the Viewer, I got tab control Class(NN) "ToolbarWindow322", Path "4", Child ID - 1,2,3... {tab numbers}

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



Active tab will have "Checked" state in this case

To activate particular tab, use this command:

Code: [Select all] [Download] GeSHi © Codebox Plus

Win.accDoDefaultAction(A_Index)			;(inside of Loop above, where "A_Index" will be a tab number -  from 1 up to %Win.accChildCount%)


For some mysterious reason, if I assign "var := A_Index" (inside of Loop) and then "Win.accDoDefaultAction(var)" - it doesnt work!?
To get Value/Role, replace "Name" with "Value" or "Role" etc.
User avatar
fump2000
Posts: 313
Joined: 04 Oct 2013, 17:31

Re: Get name/state or activate any tab in a web browser

13 Aug 2015, 02:59

Hi!
Please, can you post a complete example script for Chrome or IE?

I still do not understand the workings.

thx!
fump
Guest10
Posts: 578
Joined: 01 Oct 2013, 02:50

Re: Get name/state or activate any tab in a web browser

14 Aug 2015, 05:55

Can you post example scripts for Firefox? :geek:

Return to “Scripts and Functions”

Who is online

Users browsing this forum: No registered users and 12 guests