#q:: ; test hotkey { windowname="Google" java=yahoo.com COM_Init() ; Initialize COM - requires COM.ahk library pageSearched:="Samikkelsen.com - Windows Internet Explorer" Loop, % COM_Invoke(psw := COM_Invoke(psh:=COM_CreateObject("Shell.Application"), "Windows"), "Count") { LocationName:=COM_Invoke(pwb:=COM_Invoke(psw, "Item", A_Index-1), "LocationName") IfInString,LocationName,%windowname% Break COM_Release(pwb) ;didnt break so release the one we didnt use } COM_Invoke(pwb, "Navigate", java) COM_Release(pwb) COM_Term() Return }
I open an instance of IE7 and open Google.com, then run the script. Still gives me the not connected error. This is driving me crazy!