Jump to content
Sign in to follow this  
0pie

Starting and stopping a loop with keystrokes

Recommended Posts

0pie

Hey all, I'm trying to make a script that loops betweeh hitting "R" and "ENTER" when I hit F6, stops when I hit F7, and restarts when I hit F6 again.  (I'm putting a bunch of stuff into a chest in Skyrim, haha).

Here's my code:

 Local $var
Func Simple1()
    $var=1
EndFunc
Func Simple2()
    $var=2
EndFunc
HotKeySet ("{F6}", "Simple1")
HotKeySet ("{F7}", "Simple2")
 Select
     Case $var = 1
            Send ("{ENTER}")
            Send ("{R}")
            Sleep (1000)
            HotKeySet ("{F6}", "Simple1")
            HotKeySet ("{F7}", "Simple2")
     Case $var = 2
         HotKeySet ("{F6}", "Simple1")
         HotKeySet ("{F7}", "Simple2")
     Case Else
         HotKeySet ("{F6}", "Simple1")
         HotKeySet ("{F7}", "Simple2")
 EndSelect

What am I doing wrong?  Is the script just ending itself as soon as it runs?  How do I add a simple "wait for my command" function?

I tried putting a "Sleep" function in the var2 and Else areas, but that didn't seem to help much - the sleep function means the script stops running and accepting input, right?

Thanks for any help.

Edited by 0pie

Share this post


Link to post
Share on other sites
big_daddy

0pie,

Welcome to the AutoIt forum.

Please read the Forum rulesparticularly the section regarding game automation, before posting again.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×