| 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编译出来可以运行并且正常! 但是用脚本运行要报错. 请教大神怎么处理啊? |