#SingleInstance force ;测试方法,IE中打开多个网页Tab,其中一个是百度 #z:: tabName := "百度一下,你就知道" ie:=getTabObj(tabName) MsgBox % ie.LocationURL Return getTabObj(TabName="") ;Retrieve pointer to existing IE window/tab { IfEqual, TabName,, WinGetTitle, TabName, ahk_class IEFrame TabName := ( TabName="新建选项卡 - Windows Internet Explorer" ) ? "about:Tabs" ;如果是新建选项卡就返回 about:Tabs : RegExReplace( TabName, " - (Windows|Microsoft) Internet Explorer" ) ;去除 - Windows Internet Explorer 或者 - Microsoft Internet Explorer For Pwb in ComObjCreate( "Shell.Application" ).Windows if(InStr( Pwb.LocationName , TabName ) && InStr( Pwb.FullName, "iexplore.exe" )) Return Pwb }