I need some help. I am a newbie in VBS and I want to write a bot for a video game I play to type stuff.
set sellAllTyping = wscript.CreateObject("WScript.Shell")
x= MsgBox ("To stop the bot, click OK. /// Coded by Vncz with a little help from StackOverflow! :^) RIP Yams ;-;",vbOK+vbInformation,"sell all Bot")
if x=vbOK then
' *** I don't know what to write here. ***
sellAllTyping.sendkeys "t"
wscript.sleep 1000
sellAllTyping.sendkeys "/sell all"
wscript.sleep 1000
sellAllTyping.sendkeys "{ENTER}"
wscript.sleep 5000
loop
I want to have the loop on the very bottom stop if I press OK on the message box I summoned. In place of the comment, what code should I write, if I'm even doing it right? Thanks!
I don't know which looping keyword you used. Use any of the below keyword after
if x=vbOK then "Exit For/Exit Do/Exit Function" might help you
Unfortuately, msgbox freeze the execution.
In others words, you cannot loop between the moment the message apear and the moment you click on Ok or Cancel.
The only way to achieve this is to make a HTA file like this:
then, on the linked vbs file (for this example, it's test.vbs), you must write something like this:
The only problem now is that the app is freezing because of the loop (if I replace msgbox with sendkeys) or is always hide behind the msgbox.
this code work well (with a sleep function):
Make sure you name the hta file "something.hta" and NOT "something.html"