vbscript-将"Internet Explorer应用程序"窗口置于最前面 [英] vbscript - Bring Internet Explorer Application window to front

查看:174
本文介绍了vbscript-将"Internet Explorer应用程序"窗口置于最前面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个脚本,可以在其中通过CreateObject("InternetExplorer.Application")创建IE窗口.问题是,每当我运行此脚本时,它总是在我的计算机上可能已经打开的任何其他文件后面打开.我希望此IE窗口在其他所有内容的顶部打开.它不必像任务管理器"中的选项一样始终位于顶部",但至少应在最初时首先打开.在那之后,我不在乎会发生什么.我已经搜寻了很多东西,但一直找不到找到实现这一目标的方法.我已经尝试过appactivatefocus(),但似乎都不起作用.有什么建议吗?

I have a script where I create an IE window through CreateObject("InternetExplorer.Application"). The problem is, whenever I run this script, it always opens behind whatever else might already be open on my machine. I want this IE window to open on TOP of everything else. It does not have to be "always on top", like the option in Task Manager, but it should at least initially open on top. After that, I don't care what happens. I have searched high and low and have been unable to find a way to achieve this. I have tried appactivate and focus() but neither of those seem to work. Any suggestions?

我正在使用IE 11运行Windows 7

I am running Windows 7 with IE 11

推荐答案

您可能会遇到问题,因为IE窗口的标题与页面的标题不完全相同(例如,"Yahoo-Internet Explorer") 因此,在开始导航至页面之前,必须先将其放在前面:

You probably have the problem because the title of the IE window is not exactly the title of the page (ie. "Yahoo - Internet Explorer") Therefore you must bring it to the front before you start navigating to the page :

Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
CreateObject("WScript.Shell").AppActivate "Internet Explorer"
ie.Navigate "http://www.yahoo.com/"

这篇关于vbscript-将"Internet Explorer应用程序"窗口置于最前面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆