DeadlyKitten999
DeadlyKitten999

Reputation: 67

How to get IE object with Internet Explorer 9 using autohotkey

i was able to activate IE8 objects in active tabs using code below:

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
}

but i am unable to do the same thing on Internet Explorer 9...do you know how solve this problem?

Upvotes: 1

Views: 462

Answers (1)

user10364927
user10364927

Reputation:

I can't speak to IE9 as I have IE11, but I can tell you that in IE11, the new tab title is "New tab - Internet Explorer". Notice the lower-case "t" and lack of "Windows". This would only give you problems if you were on a new blank page though.

Are you sure the problem lies with this code snippet? I suspect it might be with how the object is being used outside of this. It may be helpful to see more of your code.

Except for detecting the new tab, it's working for me with IE11. Here's the code I used for testing:

f1::
WinGetTitle, Name, ahk_class IEFrame
Name := (Name="New tab - 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")
        MsgBox , % wb.LocationName . "`n" . wb.FullName
Return

Upvotes: 1

Related Questions