返回列表 发帖

[问题求助] 请教VBS不能创建对像

set oDOM = WScript.GetObject("http://city.ip138.com/ip2city.asp")
flag=0
for i=1 to 10
   if oDOM.readyState = "complete" then
      flag=1
      exit for
   end if
   WScript.sleep 500
next
if flag=0 then
    WScript.Echo "timeout ..."
    wscript.quit
end if
s=oDOM.documentElement.innerText
Set Re = New RegExp
Re.Pattern="(\d+)\.(\d+)\.(\d+)\.(\d+)"
for each r in Re.Execute(s)
     res=r
     exit for
Next
WScript.Echo "IPAddress: " & res
'设置剪切板的内容
Dim Form, TextBox
Set Form = CreateObject("Forms.Form.1")
Set TextBox = Form.Controls.Add("Forms.TextBox.1").Object
TextBox.MultiLine = True
TextBox.Text = res
TextBox.SelStart = 0
TextBox.SelLength = TextBox.TextLength
TextBox.Copy
MyVar = MsgBox (res,64,"请Ctrl+V粘贴IP地址")COPY
以上代码我用VBSEDIT编译出来可以运行并且正常! 但是用脚本运行要报错. 请教大神怎么处理啊?

如何破解! 有没有更好的代码呀  后就是后面复制的部分!

TOP

没装 office,确切说是没装 vba



如何破解! 有没有更好的代码呀  后就是后面复制的部分!

TOP

弹出提示不好!~  我想应该有解决办法吧  ~?是吧?版主!

TOP

回复 7# pcl_test

谢谢!!

对于VBS脚本我疑惑的是编译成EXE可以运行得到IP地址到剪切板.为什么脚本运行不对

TOP

回复 9# pcl_test

谢谢.正在学习代码中......

TOP

返回列表