Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google chrome Chrome:可以像InternetExplorer那样编写脚本。用VBScript编写应用程序?_Google Chrome_Vbscript - Fatal编程技术网

Google chrome Chrome:可以像InternetExplorer那样编写脚本。用VBScript编写应用程序?

Google chrome Chrome:可以像InternetExplorer那样编写脚本。用VBScript编写应用程序?,google-chrome,vbscript,Google Chrome,Vbscript,我有一个VBScript,它使用InternetExplorer.Application登录到一个网站,然后每隔一段时间刷新一次页面,以防止网站因不活动而注销。它位于安装在我们办公室的仪表板屏幕上。有没有类似的方法来编写Chrome脚本?它不必是VBScript,任何语言都可以。我们希望停止使用Internet Explorer。您无法将Google Chrome作为VBscript中的对象进行控制。原因如下: 话虽如此,你仍然可以操纵谷歌浏览器的刷新。只需复制要刷新的页面的标题,一旦页面被激活

我有一个VBScript,它使用InternetExplorer.Application登录到一个网站,然后每隔一段时间刷新一次页面,以防止网站因不活动而注销。它位于安装在我们办公室的仪表板屏幕上。有没有类似的方法来编写Chrome脚本?它不必是VBScript,任何语言都可以。我们希望停止使用Internet Explorer。

您无法将Google Chrome作为VBscript中的对象进行控制。原因如下:

话虽如此,你仍然可以操纵谷歌浏览器的刷新。只需复制要刷新的页面的标题,一旦页面被激活,使用SendKeys命令使其刷新。e、 g.(CTRL+R)-导致刷新,或在Sendkeys(^R)中

一旦你让它刷新,只需将它设置为一个循环,并设置你想要的等待时间

'This is an infinite loop, only disposed of by exiting Wscript.exe or Cscript.exe
Do While(true)
Dim PageTitleToRefresh, IntervalinSeconds, x, objShell, Success

'Page Titles - NOT the page address - (google.com = NO) (Google = YES)
'Page Titles are normally stored at the top of the browser or in the tab name of the browser. 
PageTitleToRefresh = "Google"
IntervalinSeconds = 10

x = IntervalinSeconds * 1000
Set objShell = WScript.CreateObject("WScript.Shell")
    Do Until Success = True
        Success = objShell.AppActivate(PageTitleToRefresh)
        Wscript.Sleep 1000
    Loop
    wscript.echo "Activated, now refreshing"
objShell.SendKeys "^r"

Wscript.Sleep IntervalinSeconds
Loop

以下是我在js文件中编辑的一种方式,但也可以在vbs中实现:

var fso = new ActiveXObject("Scripting.FileSystemObject");


var chrome = "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe";
var url = 'http://google.com';

if (fso.FileExists(chrome)){
    var objShell = WScript.CreateObject("Shell.Application");
    objShell.ShellExecute(chrome, "--app="+url, "", "", 1);
}
else{ //if chrome doesn''t exists, so launch ie :
    oIE1 = WScript.CreateObject ("InternetExplorer.Application");

    oIE1.Visible = 1;
    oIE1.AddressBar = 0;
    oIE1.StatusBar = 0;
    oIE1.ToolBar = 0;
    oIE1.MenuBar = 0;
    oIE1.Navigate(url);
}