【问题标题】:How to get IE object with Internet Explorer 9 using autohotkey如何使用自动热键通过 Internet Explorer 9 获取 IE 对象
【发布时间】:2019-06-08 07:29:25
【问题描述】:

我能够使用以下代码在活动选项卡中激活 IE8 对象:

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
}

但我无法在 Internet Explorer 9 上做同样的事情...你知道如何解决这个问题吗?

【问题讨论】:

    标签: windows internet-explorer-9 autohotkey


    【解决方案1】:

    由于我有 IE11,我无法与 IE9 对话,但我可以告诉你,在 IE11 中,新标签页标题是“新标签页 - Internet Explorer”。注意小写的“t”和缺少“Windows”。但是,如果您在新的空白页面上,这只会给您带来问题。

    您确定问题出在这段代码 sn-p 上吗?我怀疑这可能与对象在此之外的使用方式有关。查看更多代码可能会有所帮助。

    除了检测新选项卡外,它适用于 IE11。这是我用于测试的代码:

    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
    

    【讨论】:

      猜你喜欢
      • 2012-02-29
      • 1970-01-01
      • 1970-01-01
      • 2023-03-08
      • 2020-07-11
      • 1970-01-01
      • 1970-01-01
      • 2017-06-06
      • 1970-01-01
      相关资源
      最近更新 更多