从.bat文件/命令刷新火狐 [英] refresh firefox from .bat file/ command

查看:361
本文介绍了从.bat文件/命令刷新火狐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图刷新火狐每当一个bat文件被调用。我不想一个扩展。我需要知道,如果有,可以从使用​​.bat文件中重新加载当前的浏览器或选项卡中的命令。

I am attempting to refresh Firefox whenever a bat file is called. I Dont want an extension. I need to know if there is a command that can be used from within a .bat file to reload the current browser or tab.

我知道你可以使用
启动Firefox 作为一个命令,但是这只是打开一个新的Firefox实例。我需要刷新当前实例。

I know you can use start firefox as a command but this simply opens a new firefox instance. I need to refresh the current instance.

推荐答案

我只是插科打诨,并与今年上半年工作的解决方案,它可以帮助一点点走了过来。创建一个名为类似 refresh.vbs 文件并粘贴此在:

I was just messing around and came up with this half-working solution that might help a little. Create a file called something like refresh.vbs and paste this in:

Set WshShell = WScript.CreateObject("WScript.Shell") 
WshShell.AppActivate("Google Chrome")
WScript.Sleep 500
WshShell.SendKeys "{TAB}" 
WScript.Sleep 100
WshShell.SendKeys "{F5}" 

我只能使用Chrome测试。该脚本启动浏览器,发送<大骨节病>标签,然后将<大骨节病> F5 刷新。它的工作原理时,我已经Chrome浏览器显示一个网页,而不是在有多个网络选项卡中打开(因为的则AppActivate 激活窗口,但并没有给重点任何东西)。

I could only test it with Chrome. The script activates Chrome, sends a tab, and then sends F5 to refresh. It works when I have Chrome up showing one web page, but not when there are multiple web tabs open (because AppActivate activates the Window, but does not give focus to anything).

也许它的工作原理与Firefox更好。有可能一些方法来枚举在浏览器中的标签和VBS激活它,但我不知道这一点。

Maybe it works better with Firefox. There's probably some way to enumerate the tabs in a browser and activate it in vbs, but I don't know it.

如果您产卵VBS内的浏览器(请参见 WshShell.Run 和在的SendKeys 的文档),你可以得到的进程号,并直接将邮件发送到窗口,而不是依赖于应用程序的标题。

If you spawn the browser within the vbs (see WshShell.Run, and the example in the SendKeys documentation), you can get the process number and send messages directly to that Window instead of relying on the app title.

您可以从批处理文件中调用该.vbs,如果你需要:

You can invoke the .vbs from within a batch file if you need to:

@echo off
refresh.vbs

这篇关于从.bat文件/命令刷新火狐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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