VBS启动自定义Firefox窗口和URL
问题描述:
我一直在混搭一些脚本来启动一个可移植的Firefox版本,并且链接到网络摄像头。我的目标是有两个脚本使用相同的FF.exe,但去2个不同的URLS/IP的。我试图通过删除滚动条。菜单和状态来重新设置浏览器功能,以便只能看到网络摄像机控件和视图。VBS启动自定义Firefox窗口和URL
这是目前的代码,但我似乎已经犯了一个错误,因为现在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
答
我怀疑你的问题就在这里:
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
非常感谢您对@Ansgar我soving问题,也建议使用一个引用函数好点。我得到了一个小家长头晕。现在的工作脚本适用于任何正在寻找类似事物的人。我现在唯一的问题是找到FF的正确开关,而不是窗口本身。经过一番四处寻找,我可能不得不找到一个完全选择命令行参数的不同浏览器。 _带有code_的已更新OP – BinaryOm 2013-03-07 11:57:55