Last active
February 14, 2020 09:30
-
-
Save jethrow/2574167 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; AutoHotkey_L: | |
IEGet(name="") { | |
IfEqual, Name,, WinGetTitle, Name, ahk_class IEFrame ; Get active window if no parameter | |
Name := (Name="New Tab - Windows Internet Explorer")? "about:Tabs":RegExReplace(Name, " - (Windows|Microsoft) Internet Explorer") | |
for WB in ComObjCreate("Shell.Application").Windows | |
if WB.LocationName=Name and InStr(WB.FullName, "iexplore.exe") | |
return WB | |
} | |
; AHK Basic: | |
IEGet(name="") { | |
IfEqual, Name,, WinGetTitle, Name, ahk_class IEFrame ; Get active window if no parameter | |
Name := (Name="New Tab - Windows Internet Explorer") ? "about:Tabs":RegExReplace(Name, " - (Windows|Microsoft) Internet Explorer") | |
oShell := COM_CreateObject("Shell.Application") ; Contains reference to all explorer windows | |
Loop, % COM_Invoke(oShell, "Windows.Count") { | |
if pwb := COM_Invoke(oShell, "Windows", A_Index-1) | |
if COM_Invoke(pwb, "LocationName")=name and InStr(COM_Invoke(pwb, "FullName"), "iexplore.exe") | |
Break | |
COM_Release(pwb), pwb := "" | |
} | |
COM_Release(oShell) | |
return, pwb | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment