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

On and Off switch on a simple script

$
0
0

If my script is a while loop, I've been trying to think of a way to enter and exit the loop at the press of a hotkey, in this case F1 and F2. I have tried 3-4 different methods that I thought of but some just press 2 indefinitely, others don't do anything at all. I know that you can make an Exit function that will completely exit the script, but I want to be able to turn the script back on with just the press of an hotkey and I think if you exit the script you can no longer do that so that's why I'm trying to find a way with Exitloop instead.

 

This is the last thing I tried (doesn't do anything)

#include <Misc.au3> Global $ON_OFF = 0 If _IsPressed("F1") Then $ON_OFF = 1 ; OFF If _IsPressed("F2") Then     Do         While 1             send("{2}")             If $ON_OFF = 1 Then ExitLoop         WEnd     Until $ON_OFF = 1         $ON_OFF = 0 EndIf

Thanks.


Viewing all articles
Browse latest Browse all 12506

Trending Articles



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