Jump to content

Not working in loop


ssah8
 Share

Recommended Posts

Also not runable, there is no GUI. Make a runable (reproducer script) for get better help. Until this learn the basics maybe this script helps:

;https://autoit.de/index.php/Thread/83656-Button-Klick-erkennen-wenn-Funktion-l%C3%A4uft-so-wie-ein-Hotkey/?postID=669356#post669356
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$gui = GUICreate("KLeines 1 X 1", 400, 130)
$Start = GUICtrlCreateButton("&Start", 10, 10)
$PauseResume = GUICtrlCreateButton("&Pause", 10, 40)
$Label = GUICtrlCreateLabel("", 100, 70, 280, 22)
$Anzeige = GUICtrlCreateLabel("", 10, 95, 380, 22)
GUISetState()
Global $sIPAddress


While 1
    _EventHandler()
WEnd

Func _EventHandler()
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Start
            GUICtrlSetState($Start, $GUI_DISABLE)
            For $i = 1 To 10
                For $j = 1 To 10
                    GUICtrlSetData($Anzeige, $j & " * " & $i & " = " & $i * $j)
                    _MySleep(500)
                Next
            Next
            GUICtrlSetState($Start, $GUI_ENABLE)
        Case $PauseResume
            If GUICtrlRead($PauseResume) = "&Pause" Then
                GUICtrlSetData($PauseResume, "&Weiter")
                While GUICtrlRead($PauseResume) <> "&Pause"
                    _MySleep(50)
                WEnd
            Else
                GUICtrlSetData($PauseResume, "&Pause")
            EndIf
    EndSwitch
EndFunc   ;==>_EventHandler

Func _MySleep($iMSec)
    Local $iStart = TimerInit()
    Do
        _EventHandler()
    Until TimerDiff($iStart) >= $iMSec
EndFunc   ;==>_MySleep

 

Edited by AutoBert
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...