Fortschrittsanzeigen Problem

  • Hi,
    Ich versuche ein Script zu schreiben das den Systemlausprecher zum Piepsen bringt.
    Der Ende Button und die Fortschrittsanzeige gehen nicht.
    Was kann ich machen?


    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>

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

    $2 = "0.0031480198954857394698734496002015" ;~ wenn man 0,0031480198954857394698734496002015 * 31766 kommt (fast) 100(%) für $Progress1 raus.

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

    $Form1 = GUICreate("Explosion", 637, 30, 193, 125)
    $Button1 = GUICtrlCreateButton("Start", 0, 0, 75, 25, 0)
    $Button2 = GUICtrlCreateButton("Ende", 560, 0, 75, 25, 0)
    $Progress1 = GUICtrlCreateProgress(80, 0, 478, 25)
    GUISetState(@SW_SHOW)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $Button1
    $beep = "27"
    ton()
    Case $Button2
    Exit
    EndSwitch
    WEnd

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

    Func ton()
    While 1
    $s = GUICtrlRead($Progress1)
    $s = $s + $2
    GUICtrlSetData( $Progress1, $s )
    $beep = $beep + 10
    If $beep > 31766 Then ExitLoop ;Frequenz
    Beep($beep,10)
    WEnd
    EndFunc

    [/autoit]

    Einmal editiert, zuletzt von senden9 (26. März 2008 um 21:31)

  • Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>

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

    $2 = "0.0031480198954857394698734496002015" ;~ wenn man 0,0031480198954857394698734496002015 * 31766 kommt (fast) 100(%) für $Progress1 raus.

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

    $Form1 = GUICreate("Explosion", 637, 30, 193, 125)
    $Button1 = GUICtrlCreateButton("Start", 0, 0, 75, 25, 0)
    $Button2 = GUICtrlCreateButton("Ende", 560, 0, 75, 25, 0)
    $Progress1 = GUICtrlCreateProgress(80, 0, 478, 25)

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

    GUISetState(@SW_SHOW)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $Button1
    $beep = "27"
    ton()
    Case $Button2
    Exit
    EndSwitch
    WEnd

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

    Func ton()
    $s = GUICtrlRead($Progress1)
    while 1
    $s += $2
    GUICtrlSetData( $Progress1, $s )
    $beep = $beep + 10
    If $beep > 31766 Then ExitLoop ;Frequenz
    Beep($beep,10)
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $Button2
    Exit
    EndSwitch
    WEnd
    EndFunc

    [/autoit]

    mfg,

    blubbstar

    Edit: Ohne beep funktionierts, mit nicht. lol^^

  • das s brauchst du doch gar nicht 8|

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    $2 = "0.0031480198954857394698734496002015" ;~ wenn man 0,0031480198954857394698734496002015 * 31766 kommt (fast) 100(%) für $Progress1 raus.

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

    $Form1 = GUICreate("Explosion", 637, 30, 193, 125)
    $Button1 = GUICtrlCreateButton("Start", 0, 0, 75, 25, 0)
    $Button2 = GUICtrlCreateButton("Ende", 560, 0, 75, 25, 0)
    $Progress1 = GUICtrlCreateProgress(80, 0, 478, 25)
    GUISetState(@SW_SHOW)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $Button1
    $beep = "27"
    ton()
    Case $Button2
    Exit
    EndSwitch
    WEnd

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

    Func ton()
    While 1
    $beep = $beep + 10
    If $beep > 31766 Then ExitLoop ;Frequenz
    Beep($beep,10)
    GUICtrlSetData($Progress1, ($beep*100)/31766)
    WEnd
    EndFunc

    [/autoit]
  • is ja klar :D
    du kommst so nicht auf der While-Schleife in der Func raus.

    Habs mal so gelöst.
    Geht denke ich sicher noch anders :P

    Spoiler anzeigen
    [autoit]

    #include<GUIConstants.au3>

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

    $Form1 = GUICreate("Explosion", 637, 30, 193, 125)
    $Button1 = GUICtrlCreateButton("Start", 0, 0, 75, 25, 0)
    $Button2 = GUICtrlCreateButton("Ende", 560, 0, 75, 25, 0)
    $Progress1 = GUICtrlCreateProgress(80, 0, 478, 25)
    GUISetState(@SW_SHOW)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $Button1
    $beep = "27"
    ton()
    Case $Button2
    Exit
    EndSwitch
    WEnd

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

    Func ton()
    While 1
    GUICtrlSetData( $Progress1, $beep/31766*100)
    $beep = $beep + 10
    If $beep > 31766 Then ExitLoop ;Frequenz
    Beep($beep,10)

    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $Button2
    Exit
    EndSwitch
    WEnd
    EndFunc

    [/autoit]
  • Habs mal so gelöst.
    Geht denke ich sicher noch anders :P

    So etwa:

    Spoiler anzeigen
    [autoit]

    #include<GUIConstants.au3>

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

    $Form1 = GUICreate("Explosion", 637, 30, 193, 125)
    $Button1 = GUICtrlCreateButton("Start", 0, 0, 75, 25, 0)
    $Button2 = GUICtrlCreateButton("Ende", 560, 0, 75, 25, 0)
    $Progress1 = GUICtrlCreateProgress(80, 0, 478, 25)
    GUISetState(@SW_SHOW)
    Dim $beep
    While 1
    _GUIMSGCheck()
    WEnd

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

    Func ton()
    While 1
    GUICtrlSetData( $Progress1, $beep/31766*100)
    $beep = $beep + 10
    If $beep > 31766 Then ExitLoop ;Frequenz
    Beep($beep,10)
    _GUIMSGCheck()
    WEnd
    EndFunc

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

    Func _GUIMSGCheck()
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $Button1
    $beep = "27"
    ton()
    Case $Button2
    Exit
    EndSwitch
    EndFunc

    [/autoit]

    //Edit: Auch net so toll :( Beim Klick auf Start rekursion...