【ahk】用標題名稱啟用IE指定tab,ahktab
;功能:啟用IE指定tab/*測試方法:開啟IE 依次訪問http://www.baidu.com/http://cn.bing.com/百度處於不啟用狀態、必應處於啟用狀態。*/;作者:sunwind;時間:2015年1月18日01:03:16;問題反饋:qq 157157;測試環境:IE8;作業系統:WIN7 64;AHK版本:AutoHotkey Unicode 32-bit 1.1.16.4iWeb_Activate("百度一下,你就知道")sleep,1000 iWeb_Activate("微軟必應搜尋 - 全球搜尋,有問必應 (Bing)") returniWeb_Activate(sTitle) { ; thanks Sean ; http://www.autohotkey.com/forum/viewtopic.php?p=231093#231093 DllCall("LoadLibrary", "str", "oleacc.dll") DetectHiddenWindows, On ;~ WinActivate,% "ahk_id " HWND;~ WinWaitActive,% "ahk_id " HWND,,5ControlGet, hTabBand, hWnd,, TabBandClass1, ahk_class IEFrameControlGet, hTabUI , hWnd,, DirectUIHWND1, ahk_id %hTabBand% If hTabUI && DllCall("oleacc\AccessibleObjectFromWindow", "Uint", hTabUI, "Uint",-4, "Uint", GUID(IID_IAccessible,"{618736E0-3C3D-11CF-810C-00AA00389B71}"), "UintP", pacc)=0 { Loop, % pacc.accChildCount If paccChild:=pacc.accChild[A_Index] If paccChild.accRole[0] = 0x3C { paccTab:=paccChild Break } } If pacc:=paccTab { Loop, % pacc.accChildCount If paccChild:=pacc.accChild[A_Index] If paccChild.accName[0] = sTitle { paccChild.accDoDefaultAction[0]Break } } WinActivate,% sTitle} GUID(ByRef GUID, sGUID) ; Converts a string to a binary GUID and returns its address.{ VarSetCapacity(GUID, 16, 0) return DllCall("ole32\CLSIDFromString", "wstr", sGUID, "ptr", &GUID) >= 0 ? &GUID : ""}