2013-03-06 27 views
0

我一直在混搭一些腳本來啓動一個可移植的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 

回答

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 
+0

非常感謝您對@Ansgar我soving問題,也建議使用一個引用函數好點。我得到了一個小家長頭暈。現在的工作腳本適用於任何正在尋找類似事物的人。我現在唯一的問題是找到FF的正確開關,而不是窗口本身。經過一番四處尋找,我可能不得不找到一個完全選擇命令行參數的不同瀏覽器。 _帶有code_的已更新OP – BinaryOm 2013-03-07 11:57:55