Procedure 中的 VBScript 对象
VBScipt object inside Procedure
我正在尝试制作一个点击机器人,但我不明白为什么他不起作用。 运行 Sub 有效,但其他无效。 zou 能帮我解释一下你是如何将对象传递给程序的吗?非常非常非常感谢。
Sub run()
set wshshell = wscript.CreateObject("wscript.shell")
wshshell.run "chrome.exe"
wscript.sleep (5000)
WshShell.Sendkeys "https://scrap.tf/raffles"
WshShell.Sendkeys "{ENTER}"
End Sub
Sub find()
wscript.sleep (5000)
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{ENTER}"
End Sub
Sub enter()
wscript.sleep (5000)
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{ENTER}"
End Sub
Sub back()
wscript.sleep (5000)
WshShell.Sendkeys "%{LEFT}"
wscript.sleep (5000)
End Sub
Call run
Call find
Call enter
Call back
只需将所有潜艇中应该使用的对象分配给全局范围内的变量:
Set WshShell = wscript.CreateObject("wscript.shell")
Call run
Call find
Call enter
Call back
Sub run()
WshShell.Run "chrome.exe"
WScript.Sleep (5000)
WshShell.Sendkeys "https://scrap.tf/raffles"
WshShell.Sendkeys "{ENTER}"
End Sub
Sub find()
WScript.Sleep (5000)
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{ENTER}"
End Sub
Sub enter()
WScript.Sleep (5000)
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{ENTER}"
End Sub
Sub back()
WScript.Sleep (5000)
WshShell.Sendkeys "%{LEFT}"
WScript.Sleep (5000)
End Sub
我正在尝试制作一个点击机器人,但我不明白为什么他不起作用。 运行 Sub 有效,但其他无效。 zou 能帮我解释一下你是如何将对象传递给程序的吗?非常非常非常感谢。
Sub run()
set wshshell = wscript.CreateObject("wscript.shell")
wshshell.run "chrome.exe"
wscript.sleep (5000)
WshShell.Sendkeys "https://scrap.tf/raffles"
WshShell.Sendkeys "{ENTER}"
End Sub
Sub find()
wscript.sleep (5000)
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{ENTER}"
End Sub
Sub enter()
wscript.sleep (5000)
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{ENTER}"
End Sub
Sub back()
wscript.sleep (5000)
WshShell.Sendkeys "%{LEFT}"
wscript.sleep (5000)
End Sub
Call run
Call find
Call enter
Call back
只需将所有潜艇中应该使用的对象分配给全局范围内的变量:
Set WshShell = wscript.CreateObject("wscript.shell")
Call run
Call find
Call enter
Call back
Sub run()
WshShell.Run "chrome.exe"
WScript.Sleep (5000)
WshShell.Sendkeys "https://scrap.tf/raffles"
WshShell.Sendkeys "{ENTER}"
End Sub
Sub find()
WScript.Sleep (5000)
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{ENTER}"
End Sub
Sub enter()
WScript.Sleep (5000)
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{TAB}"
WshShell.Sendkeys "{ENTER}"
End Sub
Sub back()
WScript.Sleep (5000)
WshShell.Sendkeys "%{LEFT}"
WScript.Sleep (5000)
End Sub