Jump to content

Pause hotkey


 Share

Recommended Posts

#include <GUIConstants.au3>
#include<WindowsConstants.au3>

Global $f_Run = False, $f_AnyChecked = False

Global $Form1 = GUICreate("Form1", 625, 444, 189, 146)
Global $MyButton1 = GUICtrlCreateButton("Start", 520, 0, 100, 30, 0)
GUICtrlSetFont(-1, 15, 800, 0, "MS Serif")
GUICtrlSetBkColor(-1, 0xFFFFE1)
HotKeySet("{ESC}", "Terminate")
Hotkeyset("{F1}", "showmessage")
HotKeySet("{F2}", "TogglePause")
; Create box
GUICtrlCreateGroup ( "Games", 500, 30, 125, 170)
Opt("GUICoordMode",0); Relative coords
$hRadio1 = GUICtrlCreateRadio("Wack'A'Veggie",     10, 20, 130, 30)
$hRadio2 = GUICtrlCreateRadio("Unknown",       -1, 30, 130, 30)
$hRadio3 = GUICtrlCreateRadio("Unknown",       -1, 30, 130, 30)
$hRadio4 = GUICtrlCreateRadio("Tag'A'War",  -1, 30, 130, 30)
Opt("GUICoordMode",1); GUI coords

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
            
        Case $MyButton1

            $f_Run = True
            While $f_Run
                $f_AnyChecked = False
                For $i = $hRadio1 To $hRadio1 + 3
                    If BitAND(GUICtrlRead($i), $GUI_CHECKED) = $GUI_CHECKED Then
                        $Ispressed = $i - $hRadio1 + 1; $Ispressed is now the number of the radio
                        ExitLoop                     ; Get out of the For...Next loop
                    EndIf
                Next
                Switch $Ispressed
                    Case 1
Local $colourarray[9]=[0xe6b77c,0x613582,0xed8041,0xe6b77c,0x613582,0xed8041,0xe6b77c,0x613582,0xed8041]
local $tempaddress[1][4]=[[0,0,0,0]]
Global $itsago=10
AdlibRegister("waiting",50)
While 1
    for $i=0 to (UBound($colourarray)-1)
        
        $pixelSearch = PixelSearch(57, 45, @DesktopWidth, @DesktopHeight, $colourarray[$i])
                    If IsArray($pixelSearch) = 1 and $itsago=10 Then
                        MouseClick("left", $pixelSearch[0], $pixelSearch[1], 1, 0)
                        $itsago=0
                        
                        ContinueLoop
                    EndIf
                Next
            WEnd
            
            
Func waiting()
    if $itsago=10 then Return
if $itsago=0 then
    $itsago=1
    ToolTip("waiting")
Else
$itsago=10

    ToolTip("")
EndIf
ConsoleWrite($itsago&@crlf)
EndFunc
                    Case 2
                    
                    Case 3
                    
                    Case 4
                   
                EndSwitch

            WEnd
            HotKeySet("{ESC}")
            HotKeySet("{F1}")
            Hotkeyset("{F2}")
    EndSwitch
WEnd
Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(21100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc


Func Terminate()
    Exit 0
EndFunc

Func ShowMessage()
    MsgBox(4096,"","Test1")
EndFunc

I Cant get the pause hotkey to pause the script , any suggestions?

Link to comment
Share on other sites

Yes, use tidy option on your script

in scite select tools>tidy , if you dont have that option try to instal full scite version from autoit download page and then run the tidy from scite

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

Yes, use tidy option on your script

in scite select tools>tidy , if you dont have that option try to instal full scite version from autoit download page and then run the tidy from scite

Thanks alot, it showed me what was wrong, tnx again :mellow:

All I had to do is declaire $paused and move the Func outside the case.

Edited by snoopy
Link to comment
Share on other sites

  • 2 weeks later...

Here is a Top of the range pause function

HotKeySet("{PAUSE}", "Pause")
 
While 1
    ConsoleWrite("Fancy Script Continues" & @CRLF)
    ;fancy script
    Sleep(1000)
WEnd
 
Func Pause()
    ConsoleWrite("Fancy Script Is Paused" & @CRLF)
    MsgBox(0, "Top Pause Function", "Paused")
EndFunc   ;==>Pause

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...