Is this still active / working? Trying to do a count of the chrome tabs:
Code: Select all
#SingleInstance, Force
#Include D:\AutoHotkey\Lib\Acc.ahk
;==================================================
#1::
If WinExist("ahk_class Chrome_WidgetWin_1")
{
WinActivate
Sleep, 25
;https://www.autohotkey.com/docs/commands/WinGet.htm
WinGet, ChromeID, ID, A
;msgbox % "Chrome ID is: " ChromeID
CountIs := JEE_ChromeGetTabCount(ChromeID)
msgbox % "countIs: " CountIs
}
else
{
msgbox chrome not running...
}
return
;==================================================
;==================================================
;https://www.autohotkey.com/boards/viewtopic.php?p=139114#p139114
;requires Acc.ahk:
;Acc library (MSAA) and AccViewer download links - AutoHotkey Community
;https://github.com/Drugoy/Autohotkey-scripts-.ahk/blob/master/Libraries/Acc.ahk
;==================================================
JEE_ChromeGetTabCount(hWnd)
{
vCount := 0
msgbox % "Chrome ID is: " hWnd
oAcc := Acc_Get("Object", "4.1.2.2.2", 0, "ahk_id " hWnd)
for _, oChild in Acc_Children(oAcc)
{
vTabText := oChild.accName(0)
if !(vTabText == "") && !(vTabText == "New Tab")
{
vCount++
msgbox Add
}
}
oAcc := oChild := ""
return vCount
}
;==================================================
JEE_ChromeGetTabNames(hWnd, vSep:="`n")
{
oAcc := Acc_Get("Object", "4.1.2.2.2", 0, "ahk_id " hWnd)
vOutput := ""
for _, oChild in Acc_Children(oAcc)
{
vTabText := oChild.accName(0)
if !(vTabText == "")
&& !(vTabText == "New Tab")
vOutput .= vTabText vSep
}
vOutput := SubStr(vOutput, 1, -StrLen(vSep)) ;trim right
oAcc := oChild := ""
return vOutput
}
;==================================================
JEE_ChromeFocusTabByNum(hWnd, vNum)
{
oAcc := Acc_Get("Object", "4.1.2.2.2", 0, "ahk_id " hWnd)
if !Acc_Children(oAcc)[vNum+1]
vNum := ""
else
Acc_Children(oAcc)[vNum+1].accDoDefaultAction(0)
oAcc := ""
return vNum
}
;==================================================
JEE_ChromeFocusTabByName(hWnd, vTitle, vNum:=1)
{
oAcc := Acc_Get("Object", "4.1.2.2.2", 0, "ahk_id " hWnd)
vCount := 0, vRet := 0
for _, oChild in Acc_Children(oAcc)
{
vTabText := oChild.accName(0)
if (vTabText = vTitle)
vCount++
if (vCount = vNum)
{
oChild.accDoDefaultAction(0), vRet := A_Index
break
}
}
oAcc := oChild := ""
return vRet
}
;==================================================
I grabbed the acc.ahk library from
HERE. No variable is being counted?