打开使用VBScript变量页面上浏览器 [英] Opening browser on a variable page using vbscript

查看:267
本文介绍了打开使用VBScript变量页面上浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图写一点的VBScript来打开特定网页的浏览器。最终,此网页将每个脚本唯一的。目前,我有以下的code这作品:

I'm trying to write a bit of VBScript to open a browser on a specific webpage. Ultimately this webpage would be unique per script. At the moment I have the following code which works:

Dim objShell

objShell = CreateObject("Shell.Application")
objShell.ShellExecute("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe", "www.google.ie", "", "", 1)

不过,我想获得以下工作:

But I would like to get the following working:

Dim iURL As String
Dim objShell

iURL = "www.google.ie"

objShell = CreateObject("Shell.Application")
objShell.ShellExecute("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe", iURL, "", "", 1)

任何的想法是什么,我做错了什么?任何帮助将大大AP preciated。

Any ideas what it is I'm doing wrong? Any help would be greatly appreciated.

推荐答案

没有作为字符串如VBScript不强类型,你需要一个集在创建COM对象和放大器的一个实例;周围的方法调用没有括号;

No As String as VBScript is not strongly type, you need a set when you create an instance of the COM object & no parens around the method call;

Dim iURL 
Dim objShell

iURL = "www.google.ie"

set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "chrome.exe", iURL, "", "", 1

或者,如果铬是默认

Or if chrome is the default

set objShell = CreateObject("WScript.Shell")
objShell.run(iURL)

这篇关于打开使用VBScript变量页面上浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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