Sleep for a custom time

Ask gaming related questions (AHK v1.1 and older)
SkillerAmSkillen
Posts: 3
Joined: 25 May 2019, 13:07
Contact:

Sleep for a custom time

16 Jul 2019, 06:28

I wrote a script, but it's not working.
It should work like if I type in the InputBox a number, it should sleep x minutes and then go on.

I tried it with

InputBox, Text
Sleep, %OutputVar% ** 60000

but it doesn´t work.
I also tried it with copy the right nuber in minutes and then Sleep, %Clipboard% ** 60000, but it either didn´t worked.
Pleas help, thanks
gregster
Posts: 9001
Joined: 30 Sep 2013, 06:48

Re: Sleep for a custom time

16 Jul 2019, 08:14

Well, you read a variable via InputBox (in your case text), and then use some unrelated and possibly empty variable called OutputVar in the sleep command.
Also ** is the power operator, not the multiply operator, which would be simply *.

Code: Select all

InputBox, var
sleep, var * 1000			; the sleep command accepts expressions; no % needed, but wouldn't hurt: sleep % var * 1000 is equivalent
msgbox % "I waited " var " seconds" 
SkillerAmSkillen
Posts: 3
Joined: 25 May 2019, 13:07
Contact:

Re: Sleep for a custom time

16 Jul 2019, 08:59

Thank you for the quick answer.
My final script is finished:

Sleep, 200
InputBox, var,
Sleep, 3000
WinActivate, ahk_exe chrome.exe
Sleep, 1000
Loop, %var% {
Sleep, 10000
MouseMove, 100, 100
Sleep, 20000
MouseMove, 300, 300
Sleep, 20000
MouseMove, 800, 800
Sleep, 10000
}
ExitApp




Space::
ExitApp

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 99 guests