VBScript CreateObject 谷歌浏览器 [英] VBScript CreateObject Google Chrome

查看:96
本文介绍了VBScript CreateObject 谷歌浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个 VBScript,它运行良好,脚本没有问题,但我想在 Chrome 而不是 IE 中打开它.

I have this VBScript it works fine, no problem with script but I would like to open it in Chrome instead of IE.

我对 VB 脚本非常陌生.有人可以帮我吗.

I am very very new to VB Scripting. Can someone please help me.

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

推荐答案

看看代码.有启动chrome的代码

Have a look at the code. There is the code for starting chrome

  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}"

这篇关于VBScript CreateObject 谷歌浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆