Jump to content

Exit from while loop


AarOnly
 Share

Recommended Posts

Hey,

im new and i was trying to make an simple script. Thats the Code:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
HotKeySet("0", "_Exit")
Local $hDLL = DllOpen("user32.dll")
WinActivate("Counter-Strike: Global Offensive")
#Region ### START Koda GUI section ### Form=C:\Users\Aaron Can\Desktop\Form2.kxf
$Form2 = GUICreate("§!", 170, 101, 307, 215)
GUISetBkColor(0x000000)
$start = GUICtrlCreateButton("Start", 8, 8, 75, 41)
GUICtrlSetBkColor(-1, 0x008000)
GUICtrlSetCursor(-1, 3)
$stop = GUICtrlCreateButton("Stop", 88, 8, 75, 41)
GUICtrlSetBkColor(-1, 0xFF0000)
GUICtrlSetCursor(-1, 3)
$Label2 = GUICtrlCreateLabel("by AarOnly", 56, 64, 55, 17)
GUICtrlSetBkColor(-1, 0x808080)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

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

        Case $stop
            Exit

        Case $start

            ;Wswitch
            While 1
                If _IsPressed("4", $hDLL) Then
                    MouseClick("left")
                    Sleep(10)
                    Send("3")
                    Sleep(100)
                    Send("1")
                EndIf
            WEnd

    EndSwitch
WEnd

DllClose($hDLL)
Func _Exit()
    Exit
EndFunc   ;==>_Exit

but when i try to press the stop button nothing happens.

pls help me

 

Edited by Jos
Fixed dub posts and codebox
Link to comment
Share on other sites

  • Developers

I've done a little cleanup of your double posts and your code and as you can see you start a While-Wend loop when start is activated and you don't read the GUI messages anymore. An option could be to use the event mode for GUI's.

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

  • Moderators

@AarOnly you seem to have missed the forum rules on your way in. I suggest you read them now, especially the part about game automation, and you'll see why this thread is locked. Hope to see you with a legitimate thread in the future.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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