_CountDown() UDF

  • Hi alle Mann^^,

    Ich habe mich mal bemüht eine UDF zumachen. :D
    Die UDF heißt _CountDown() (mir is kein anderer Name eingefallen :rolleyes: )
    sie erspart uns

    [autoit]

    For $for = 1 to 10
    GUICtrlSetData($label, $for)
    Sleep(1000)
    Next

    [/autoit]


    zu schreiben.

    Hoffentlich gefällt euch die Func oder wißt was damit anzufangen. :D

    Hier die UDF

    Spoiler anzeigen
    [autoit]


    ;===========================================================================
    ; Function : _CountDown( controlID , Start number,End number,Sleep time,"Text for reason","Time units for example: s = seconds" )
    ; Description :
    ; Author : [KdD]Wolf (René L. Hoffmann)
    ; Date : 25. September 2007 (last update: 14. October 2007/3:48 PM)
    ; Version : V 2.1
    ;===========================================================================
    Dim $countdown,$dE,$ds,$for,$ST,$GuiID_2
    Func _CountDown($GuiID_2 = -1,$ds = 0,$dE = 100,$ST = 50,$countdown = "",$somoh = "" )
    For $for = $ds to $dE
    GUICtrlSetData($GuiID_2,$countdown & $for &$somoh)
    Sleep($ST)
    Next
    EndFunc

    [/autoit]

    Und hier mal ein Example:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    #include "_CountDown.au3"

    [/autoit] [autoit][/autoit] [autoit]

    $MainGUI = GUICreate("Function: _CountDown Example", 196, 115, 194, 126)
    $exitbutton = GUICtrlCreateButton("a button", 24, 80, 145, 25)
    GUICtrlSetState(-1,$GUI_DISABLE)
    $pressmebutton = GUICtrlCreateButton("press me! ;)", 24, 51, 145, 25)
    $Progress1 = GUICtrlCreateProgress(8, 8, 177, 17, $PBS_SMOOTH)
    GUICtrlSetLimit(-1, 100, 0)
    $Label1 = GUICtrlCreateLabel("0", 16, 32, 36, 17)
    GUISetState(@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $pressmebutton
    GUICtrlSetState($pressmebutton,$GUI_DISABLE)
    _CountDown($Progress1,1,100,5)
    _CountDown($Label1,1,10,1000)
    _CountDown($pressmebutton,1,10,1000,"Wait 10s: ","s")
    GUICtrlSetState($exitbutton,$GUI_ENABLE)
    GUICtrlSetData($exitbutton,"Exit")

    Case $exitbutton
    Exit
    EndSwitch
    WEnd

    [/autoit]