Hey I need help on a loop command please. I'm inexperienced, so bare with me please. I also tried the Loop Command article, but I don't understand it.
I want to make a loop that types the following in quotes: "/hello"
It should be typed and entered automatically every 2 minutes.
Any ideas on how to do that?
Also, what commands do I have to enter to activated and deactivate the loop?
Thank You,
Johnny.
need help on a loop commad
Started by
johnny94
, Sep 13 2012 07:29 AM
6 replies to this topic
#1
johnny94
Posted 13 September 2012 - 07:29 AM
#2
Posted 13 September 2012 - 07:36 AM
There's 2 ways to do this.
continue - skips the rest of the loop and starts a new one, if there's no more loops, it simply ends
break - ends the loop and continues with the rest of the code
while (variable) { ; while the variable is true, it loops
sendraw /hello
sleep 120000 ; 120 seconds
}or:
Loop { ; you need to manually end this
sendraw /hello
sleep 120000
}There's 2 commands for loops you need to know:continue - skips the rest of the loop and starts a new one, if there's no more loops, it simply ends
break - ends the loop and continues with the rest of the code
#3
johnny94
Posted 13 September 2012 - 07:41 AM
how do i start the loop?
#4
Posted 13 September 2012 - 07:45 AM
Try this.
; To start press CTRL+ALT+SHIFT+S ^!+s:: SetTimer,Send,120000 Send: sendraw /hello Return ; To start press CTRL+ALT+SHIFT+A ^!+a::SetTimer,Send,Off
#5
johnny94
Posted 13 September 2012 - 07:55 AM
thanks a lot HotKeyIt, the script works perfectly
#6
johnny94
Posted 13 September 2012 - 08:05 AM
Sorry to double post, but one thing.
What if I'm playing a game, and I need to enter this in the chat box.
I enabled the command, and it just types out the command in the games chat box, but it doesn't enter the command for me. Any ideas?
On my other ahk script where I use sendinput, I use {enter} to enter the commands in the game, but that doesn't work with this loop.
What if I'm playing a game, and I need to enter this in the chat box.
I enabled the command, and it just types out the command in the games chat box, but it doesn't enter the command for me. Any ideas?
On my other ahk script where I use sendinput, I use {enter} to enter the commands in the game, but that doesn't work with this loop.
#7
johnny94
Posted 13 September 2012 - 08:08 AM
oh wait never mind i got it to work =p
; To start press CTRL+ALT+SHIFT+S
^!+s::
SetTimer,Send,210000
Send:
sendraw /hello
sendinput {enter}
Return
; To start press CTRL+ALT+SHIFT+A
^!+a::SetTimer,Send,Off
thanks
; To start press CTRL+ALT+SHIFT+S
^!+s::
SetTimer,Send,210000
Send:
sendraw /hello
sendinput {enter}
Return
; To start press CTRL+ALT+SHIFT+A
^!+a::SetTimer,Send,Off
thanks




