Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

IE and Gui Browser Com Tutorial


  • This topic is locked This topic is locked
47 replies to this topic
smikkelsen (not logged in
  • Guests
  • Last active:
  • Joined: --
I can't even get this to work:

#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!

tank
  • Administrators
  • 4345 posts
  • AutoHotkey Foundation
  • Last active: May 02 2019 09:16 PM
  • Joined: 21 Dec 2007
so the question is
how in the @#$%^&*() can a page google.com going to have a title of Samikkelsen.com - Windows Internet Explorer

how
think
i already told you the problem was the title you used and yet you insist on continuing

pageSearched:="Google" 
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,%pageSearched% 
         Break 
      COM_Release(pwb) ;didnt break so release the one we didnt use 
   }
would return a pointer to a goole page open in a browser
Samikkelsen.com - Windows Internet Explorer isnt ever going to give you didly because the
- Windows Internet Explorer
is a suffix added by IE it has nothing to do with the page title
Samikkelsen.com would only work if a page was open to that page and the <title>...</title> if the page was Samikkelsen.com
Never lose.
WIN or LEARN.

smikkelsen
  • Members
  • 126 posts
  • Last active: Jan 02 2014 06:38 AM
  • Joined: 24 Jun 2008
I don't mean to be rude, but I don't think you read my code all the way through. It was my mistake to leave that extra peice of code in there, but if you look, the variable referenced for the wintitle, it is "windowname" not "pagesearched".


It still doesn't work for me, i'm at a loss here.