Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Starting and stopping a loop with keystrokes

$
0
0

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. 

 

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.


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>