VBS启动自定义Firefox窗口和URL [英] VBS to Launch Custom Firefox Window and URL
问题描述
我一直在拼凑一些脚本来启动带有链接到网络摄像头的URL的便携式版本的Firefox.我的目标是让2个脚本使用相同的FF.exe,但要使用2个不同的URL/IP.我试图通过删除滚动条,菜单和状态来取消浏览器功能,以便仅查看网络摄像头控件和视图.
I have been mashing up some script to launch a portable version of Firefox with an URL linked to Webcams. My objective is to have 2 scripts using the same FF.exe but going to 2 different URLS/IP's. I am trying to rescrict the browser function by removing scroll bars.menus and status so only the webcam controls and view can be seen.
这是当前代码,但是由于URL现在不显示,仅在启动时显示为默认值,因此我似乎犯了一个错误.尺码很完美.
This is the current code but I seem to have made an error as now the URL is not displaying, only the default on launch. The sizing is perfect.
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
您可以提供的任何帮助或只是朝着正确的方向微调,我们将不胜感激.这是我发现的其他东西,因此也许可以使用,但是不幸的是,我不认为它有任何用处.
Any help that you can provide or just a nudge in the right direction would be most appreciated. This is something else that I have found so maybe this could be used, Unfortunately I don't think that on it's own it's any use.
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
推荐答案
我怀疑您的问题出在这里:
I suspect that your problem lies here:
wshshell.run ... & """ -Width """ & Width & "" & webappurl
该指令中的最后一个""
只是一个空字符串,当您可能需要用双引号引起来并加一个空格时:
The last ""
in that instruction is just an empty string when you probably need a closing double quote followed by a space:
wshshell.run ... & """ -Width """ & Width & """ " & webappurl
我通常建议使用引号功能以避免引号混淆:
I usually recommend using a quoting function to avoid 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
这篇关于VBS启动自定义Firefox窗口和URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!