VBS启动自定义Firefox窗口和URL

时间:2013-03-06 17:21:00

标签: firefox vbscript

我一直在捣乱一些脚本来推出一个带有链接到网络摄像头的URL的便携版Firefox。我的目标是使用相同的FF.exe使用2个脚本,但使用2个不同的URL / IP。我试图通过删除滚动条,菜单和状态来解除浏览器功能,因此只能看到网络摄像头控件和视图。

这是当前的代码,但我似乎犯了一个错误,因为现在没有显示URL,只有启动时的默认值。尺寸是完美的。

dim wshshell

FirefoxProfile = "Profile"
FirefoxPath = "C:\ADMIN\FF\FF.exe"
webappurl = "http://Domain.com"
Height = "870"
Width = "920"

Set wshshell = WScript.CreateObject("WScript.Shell")

wshshell.run """" & FirefoxPath & """ -P """ & FirefoxProfile & """ -Height """ & Height & """ -Width """ & Width & "" & webappurl

Set wshshell = Nothing
wscript.quit

您可以提供的任何帮助或只是向正确的方向轻推都将非常感激。这是我发现的其他东西,所以也许可以使用它,不幸的是我认为它本身并没有任何用处。

window.open('Domain.com',null,"height=100px,width=100px,status=0,toolbar=0,menubar=0,location=0");

工作代码:

dim wshshell

Function qq(str)
qq = Chr(34) & str & Chr(34)
End Function

FirefoxProfile = "Profile"
FirefoxPath = "C:\ADMIN\FF\FF.exe"
webappurl = "172.22.111.8"
Height = "700"
Width = "920"
Status ="0"
Toolbar = "0"
Menubar = "0"

Set wshshell = WScript.CreateObject("WScript.Shell")

wshshell.run qq(FirefoxPath) & " -P " & qq(FirefoxProfile) _
& " -status " & qq(status) & " -Toolbar " & qq(toolbar) & " -menubar " & qq(menubar) _
& " -Height " & qq(Height) & " -Width " & qq(Width) _
& " " & webappurl

Set wshshell = Nothing
wscript.quit

1 个答案:

答案 0 :(得分:0)

我怀疑你的问题在于:

wshshell.run ... & """ -Width """ & Width & "" & webappurl

当你可能需要一个结束双引号后跟一个空格时,该指令中的最后一个""只是一个空字符串:

wshshell.run ... & """ -Width """ & Width & """ " & webappurl

我通常建议使用引用函数来避免quotefusion:

Function qq(str)
  qq = Chr(34) & str & Chr(34)
End Function

'...

wshshell.run qq(FirefoxPath) & " -P " & qq(FirefoxProfile) _
  & " -Height " & qq(Height) & " -Width " & qq(Width) _
  & " " & webappurl
相关问题