Generally COM is the best approach or inserting JS thru the address bar
the below function will activate a tab in IE7 and 8 but requires the COM standard library
Code:
iWeb_Activate(sTitle)
{
; thanks Sean
; http://www.autohotkey.com/forum/viewtopic.php?p=231093#231093
DllCall("LoadLibrary", "str", "oleacc.dll")
DetectHiddenWindows, On
;~ Winshow,% "ahk_id " HWND:=COM_Invoke(pwb:=iWeb_getwin(sTitle),"HWND")
;~ COM_Release(pwb)
;WinRestore,% "ahk_id " HWND
WinActivate,% "ahk_id " HWND
WinWaitActive,% "ahk_id " HWND,,5
ControlGet, hTabBand, hWnd,, TabBandClass1, ahk_class IEFrame
ControlGet, hTabUI , hWnd,, DirectUIHWND1, ahk_id %hTabBand%
If hTabUI && DllCall("oleacc\AccessibleObjectFromWindow", "Uint", hTabUI, "Uint",-4, "Uint", COM_GUID4String(IID_IAccessible,"{618736E0-3C3D-11CF-810C-00AA00389B71}"), "UintP", pacc)=0
{
Loop, % COM_Invoke(pacc, "accChildCount")
If paccChild:=COM_Invoke(pacc, "accChild", A_Index)
If COM_Invoke(paccChild, "accRole", 0) = 0x3C
{
paccTab:=paccChild
Break
}
Else COM_Release(paccChild)
COM_Release(pacc)
}
If pacc:=paccTab
{
Loop, % COM_Invoke(pacc, "accChildCount")
If paccChild:=COM_Invoke(pacc, "accChild", A_Index)
If COM_Invoke(paccChild, "accName", 0) = sTitle ; Change the condition here as appropriate!
{
COM_Release(pwb),VarSetCapacity(pwb,0),VarSetCapacity(HWND,0)
COM_Invoke(paccChild, "accDoDefaultAction", 0)
COM_Release(paccChild)
Break
}
Else COM_Release(paccChild)
COM_Release(pacc)
}
WinActivate,% sTitle
}
_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
