首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >VBScript CreateObject谷歌Chrome

VBScript CreateObject谷歌Chrome
EN

Stack Overflow用户
提问于 2013-01-09 04:51:06
回答 3查看 57.1K关注 0票数 6

我有这个VBScript它工作得很好,脚本没有问题,但我想在Chrome而不是IE中打开它。

我对VB脚本编程是非常非常陌生的。谁能帮帮我。

代码语言:javascript
复制
WScript.Quit Main

Function Main
  Set IE = WScript.CreateObject("InternetExplorer.Application", "IE_")
  IE.Visible = True
  IE.Navigate "http://gmail.com"
  Wait IE
  With IE.Document
    .getElementByID("login_username").value = "myuser"
    .getElementByID("login_password").value = "mypass"
    .getElementByID("frmLogin").submit
  End With
End Function

Sub Wait(IE)
  Do
    WScript.Sleep 500
  Loop While IE.ReadyState < 4 And IE.Busy 
  Do
    WScript.Sleep 500
  Loop While IE.ReadyState < 4 And IE.Busy 
End Sub

Sub IE_OnQuit
  On Error Resume Next
  WScript.StdErr.WriteLine "IE closed before script finished."
  WScript.Quit
End Sub
EN

回答 3

Stack Overflow用户

发布于 2013-01-09 18:58:23

这是因为Chrome不支持VBScript。请参阅http://productforums.google.com/forum/#!category-topic/chrome/give-feature-feedback-and-suggestions/xHWNXByKdhM

票数 2
EN

Stack Overflow用户

发布于 2016-06-01 14:33:47

看一下代码。下面是启动chrome的代码

代码语言:javascript
复制
  set WshShell=WScript.CreateObject("WScript.Shell")
   strAnswer = InputBox("Please enter a name for your new file:")
   WshShell.run "chrome.exe"
   WScript.sleep 100
   WshShell.sendkeys "www.google.com" 
   WshShell.sendkeys "{ENTER}"
票数 2
EN

Stack Overflow用户

发布于 2022-01-07 21:01:37

不幸的是,你只能打开一些网址,你不能像在internet explorer上那样控制它。

代码语言:javascript
复制
dim objApp : set objApp=createobject("Shell.application")
objApp.Shellexecute"chrome.exe","www.google.com","","", 1
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14223765

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档