Jump to content

How to stop a function.


Xoenix
 Share

Recommended Posts

This is my code so far.

#include <GuiConstants.au3>

GuiCreate("Auto Clicker", 348, 223, 366,266)

$n = GUICtrlCreatePic(@Systemdir & "\oobe\images\wpakey.jpg",0,0, 366,266)

GuiCtrlSetState($n, $GUI_DISABLE)

$Button1 = GuiCtrlCreateButton("Auto Clicker On", 80, 72, 120, 33)

$Button2 = GuiCtrlCreateButton("Auto Clicker Off", 80, 112, 120, 33)

GuiSetState()

While 1

$msg = GuiGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg = $Button1 ;On Button

Clicker()

Case $msg = $Button2 ;Off Button

Exit

Case Else

;;;

EndSelect

WEnd

Exit

;Clicker

Func Clicker()

While 1

WinWaitActive("MapleStory")

MouseClick ("left")

WEnd

EndFunc

As you can see its an Auto Clicker, very simple. The only problem im have is that after I start it, pressing the off button doesnt stop it, and i need to Ctrl Alt Delete to exit, quite annoying. So a lil help would be awesome ;)

Link to comment
Share on other sites

Try something like HotKeySet:

#include <GuiConstants.au3>
HotKeySet("{Esc}", "_Stop")

Global $Clicking = 0

GUICreate("Auto Clicker", 348, 223, 366, 266)
$n = GUICtrlCreatePic(@SystemDir & "\oobe\images\wpakey.jpg", 0, 0, 366, 266)
GUICtrlSetState($n, $GUI_DISABLE)
$Button1 = GUICtrlCreateButton("Auto Clicker On", 80, 72, 120, 33)
$Button2 = GUICtrlCreateButton("Auto Clicker Off", 80, 112, 120, 33)

GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button1;On Button
            $Clicking = 1
            Clicker()
        Case $msg = $Button2;Off Button
            $Clicking = 0
        Case Else
        ;;;
    EndSelect
WEnd
Exit


;Clicker
Func Clicker()
    While $Clicking
        WinWaitActive("MapleStory")
        MouseClick("left")
    WEnd
EndFunc  ;==>Clicker

Func _Stop()
    $Clicking = 0
EndFunc  ;==>_Stop
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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...