Jump to content

Stopping a Function


Recommended Posts

Hey. I'm new here. I'd like to ask how do you stop a function after clicking the Stop button?

I tried this

$Form1 = GUICreate("Simple Bot", 615, 438, 192, 124)
$Group1 = GUICtrlCreateGroup("Auto Press Up", 8, 8, 305, 121)
$Button1 = GUICtrlCreateButton("Start", 24, 32, 75, 25)
$Button2 = GUICtrlCreateButton("Stop", 112, 32, 75, 25)
$Input1 = GUICtrlCreateInput("Not Started", 192, 32, 65, 21)
GUICtrlSetState(-1, $GUI_DISABLE)
$Label1 = GUICtrlCreateLabel("Delay (s)", 24, 72, 45, 17)
$Input2 = GUICtrlCreateInput("5", 24, 88, 233, 21)
GUICtrlSetLimit(-1, 10000)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)

    Dim $On
    $On = False

While 1
$DelayVal = GUICtrlRead($Input2)
$DelayVal = $DelayVal
$nMsg = GUIGetMsg()
    If $On = True Then
        WinWaitActive("BLAH")
        Send ("{UP}")
        Sleep (5000)
        Send ("{UP}")
        Sleep ($DelayVal * 1000)
    EndIf
    Select
        Case $nMsg = $Button1
            GUICtrlSetData($Input1, "Started!")
            $On = True

        Case $nMsg = $Button2
            GUICtrlSetData($Input1,"Not Started")
            If $On = True Then
                $On = False
            EndIf

        Case $nMsg = $GUI_EVENT_CLOSE
            Exit

    EndSelect

WEnd

After trying it, I notice right after I click START, I couldn't get it to stop even after clicking the STOP button. I can't even close it. Any idea why? Thanks in advance. =)

Link to comment
Share on other sites

Hey. I'm new here. I'd like to ask how do you stop a function after clicking the Stop button?

I tried this

[autoit]$Form1 = GUICreate("Simple Bot", 615, 438, 192, 124)

$Group1 = GUICtrlCreateGroup("Auto Press Up", 8, 8, 305, 121)

$Button1 = GUICtrlCreateButton("Start", 24, 32, 75, 25)

$Button2 = GUICtrlCreateButton("Stop", 112, 32, 75, 25)

$Input1 = GUICtrlCreateInput("Not Started", 192, 32, 65, 21)

....

First line of your code has a naughty word: Bot.

http://www.autoitscript.com/forum/forum-2/announcement-13-forum-rules/

#include <ByteMe.au3>

Link to comment
Share on other sites

  • Developers

Oh come on.. I'm just trying to play around with AutoIT since I just downloaded it and learnt a few things. And how does automatically pressing UP harm anything? :)

The rules are clear...

As to your question. Since you constantly active window "blah" you probably are unable to click on anything else.

Use a Hotkey.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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