2 Probleme

  • Hi habe hier einen script der nicht funktioniert.Er soll die Zeit, den Namen und einen Geldbetrag anzeigen. Doch bei der Zeit klappt etwas nicht.Und zwar:
    1. Der skript sollte immer 10 min. aufrechnen, der rechnet aber erst 20min. dann immer 10min. auf.
    2. das einstellen der Zeit mit dem Button Info(Hab ich einfach mal ausprobiert) geht aber nicht mit dem Button +(egal welchen)
    Kann mir einer das vielleicht erklären?

    Der skript:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    #include <WindowsConstants.au3>
    #include <StaticConstants.au3>
    #include <GUIConstants.au3>
    #include <GUIButton.au3>
    #Region
    $Form = GUICreate("", 578, 391, 193, 125)
    $Name1 = GUICtrlCreateInput("", 192, 40, 121, 21)
    $del1 = GUICtrlCreateButton("del", 536, 40, 35, 25, 0)
    $Stop1 = GUICtrlCreateButton("Stop", 480, 40, 51, 25, 0)
    $Start1 = GUICtrlCreateButton("Start", 424, 40, 51, 25, 0)
    $Zeitmin1 = GUICtrlCreateInput("00", 128, 40, 41, 21)
    $Geld1 = GUICtrlCreateInput("", 328, 40, 81, 21)
    $Name2 = GUICtrlCreateInput("", 192, 75, 121, 21)
    $del2 = GUICtrlCreateButton("del", 536, 75, 35, 25, 0)
    $Stop2 = GUICtrlCreateButton("Stop", 480, 75, 51, 25, 0)
    $Start2 = GUICtrlCreateButton("Start", 424, 75, 51, 25, 0)
    $Zeitmin2 = GUICtrlCreateInput("00", 128, 75, 41, 21)
    $Geld2 = GUICtrlCreateInput("", 328, 75, 81, 21)
    $Name3 = GUICtrlCreateInput("", 192, 110, 121, 21)
    $del3 = GUICtrlCreateButton("del", 536, 110, 35, 25, 0)
    $Stop3 = GUICtrlCreateButton("Stop", 480, 110, 51, 25, 0)
    $Start3 = GUICtrlCreateButton("Start", 424, 110, 51, 25, 0)
    $Zeitmin3 = GUICtrlCreateInput("00", 128, 110, 41, 21)
    $Geld3 = GUICtrlCreateInput("", 328, 110, 81, 21)
    $Name4 = GUICtrlCreateInput("", 192, 145, 121, 21)
    $del4 = GUICtrlCreateButton("del", 536, 145, 35, 25, 0)
    $Stop4 = GUICtrlCreateButton("Stop", 480, 145, 51, 25, 0)
    $Start4 = GUICtrlCreateButton("Start", 424, 145, 51, 25, 0)
    $Zeitmin4 = GUICtrlCreateInput("00", 128, 145, 41, 21)
    $Geld4 = GUICtrlCreateInput("", 328, 145, 81, 21)
    $Name5 = GUICtrlCreateInput("", 192, 181, 121, 21)
    $del5 = GUICtrlCreateButton("del", 536, 181, 35, 25, 0)
    $Stop5 = GUICtrlCreateButton("Stop", 480, 181, 51, 25, 0)
    $Start5 = GUICtrlCreateButton("Start", 424, 181, 51, 25, 0)
    $Zeitmin5 = GUICtrlCreateInput("00", 128, 181, 41, 21)
    $Geld5 = GUICtrlCreateInput("", 328, 181, 81, 21)
    $Name6 = GUICtrlCreateInput("", 192, 224, 121, 21)
    $del6 = GUICtrlCreateButton("del", 536, 224, 35, 25, 0)
    $Stop6 = GUICtrlCreateButton("Stop", 480, 224, 51, 25, 0)
    $Start6 = GUICtrlCreateButton("Start", 425, 224, 51, 25, 0)
    $Zeitmin6 = GUICtrlCreateInput("00", 128, 224, 41, 21)
    $Geld6 = GUICtrlCreateInput("", 328, 224, 81, 21)
    $Name7 = GUICtrlCreateInput("", 192, 263, 121, 21)
    $del7 = GUICtrlCreateButton("del", 536, 263, 35, 25, 0)
    $Stop7 = GUICtrlCreateButton("Stop", 480, 263, 51, 25, 0)
    $Start7 = GUICtrlCreateButton("Start", 424, 263, 51, 25, 0)
    $Zeitmin7 = GUICtrlCreateInput("00", 128, 263, 41, 21)
    $Geld7 = GUICtrlCreateInput("", 328, 263, 81, 21)
    $Umsatz = GUICtrlCreateInput("", 328, 304, 81, 21)
    $Exit = GUICtrlCreateButton("Exit", 448, 360, 75, 25, 0)
    $Info = GUICtrlCreateButton("Info", 528, 368, 43, 17, 0)
    GUICtrlCreateLabel("Umsatz:", 280, 304, 42, 17)
    $Ausrechnen = GUICtrlCreateButton("Ausrechnen", 328, 328, 83, 25, 0)
    GUICtrlCreateLabel(" ", 328, 280, 79, 17)
    GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
    $Zeith1 = GUICtrlCreateInput("00", 56, 40, 41, 21)
    $Zeith2 = GUICtrlCreateInput("00", 56, 75, 41, 21)
    $Zeith3 = GUICtrlCreateInput("00", 56, 110, 41, 21)
    $Zeith4 = GUICtrlCreateInput("00", 56, 144, 41, 21)
    $Zeith5 = GUICtrlCreateInput("00", 56, 181, 41, 21)
    $Zeith6 = GUICtrlCreateInput("00", 56, 224, 41, 21)
    $Zeith7 = GUICtrlCreateInput("00", 56, 264, 41, 21)
    GUICtrlCreateLabel(":", 105, 40, 13, 17)
    GUICtrlCreateLabel(":", 105, 78, 13, 17)
    GUICtrlCreateLabel(":", 105, 114, 13, 17)
    GUICtrlCreateLabel(":", 105, 144, 13, 17)
    GUICtrlCreateLabel(":", 105, 181, 13, 17)
    GUICtrlCreateLabel(":", 105, 226, 13, 17)
    GUICtrlCreateLabel(":", 105, 264, 13, 17)
    $M1 = GUICtrlCreateButton("-", 32, 40, 19, 25, 0)
    $P1 = GUICtrlCreateButton("+", 8, 40, 19, 25, 0)
    $M2 = GUICtrlCreateButton("-", 32, 75, 19, 25, 0)
    $P2 = GUICtrlCreateButton("+", 8, 75, 19, 25, 0)
    $M3 = GUICtrlCreateButton("-", 32, 110, 19, 25, 0)
    $P3 = GUICtrlCreateButton("+", 8, 110, 19, 25, 0)
    $M4 = GUICtrlCreateButton("-", 32, 144, 19, 25, 0)
    $P4 = GUICtrlCreateButton("+", 8, 144, 19, 25, 0)
    $M5 = GUICtrlCreateButton("-", 32, 176, 19, 25, 0)
    $P5 = GUICtrlCreateButton("+", 8, 176, 19, 25, 0)
    $M6 = GUICtrlCreateButton("-", 32, 219, 19, 25, 0)
    $P6 = GUICtrlCreateButton("+", 8, 219, 19, 25, 0)
    $M7 = GUICtrlCreateButton("-", 32, 264, 19, 25, 0)
    $P7 = GUICtrlCreateButton("+", 8, 264, 19, 25, 0)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Ausrechnen
    $1 = GUICtrlRead($Geld1)
    $2 = GUICtrlRead($Geld2)
    $3 = GUICtrlRead($Geld3)
    $4 = GUICtrlRead($Geld4)
    $5 = GUICtrlRead($Geld5)
    $6 = GUICtrlRead($Geld6)
    $7 = GUICtrlRead($Geld7)
    $gUmsatz = GUICtrlRead($Umsatz)
    If $gUmsatz = "" Then
    $Ausgerechnet=$1+$2+$3+$4+$5+$6+$7
    GUICtrlSetData($Umsatz,$Ausgerechnet)
    Else
    $Ausgerechnet=$1+$2+$3+$4+$5+$6+$7+$gUmsatz
    GUICtrlSetData($Umsatz,$Ausgerechnet)
    EndIf
    Case $P1,$Info
    Plus($Zeitmin1,$Zeith1)
    EndSwitch
    WEnd

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

    Func Plus($HWD,$HWD2)
    $P1=GUICtrlRead($HWD)
    $P2=GUICtrlRead($HWD2)
    $neu = $P1 +10
    $neu2 = $P2
    If $neu >= 60 Then
    $neu2 = $neu2 +1
    $neu = 00
    GUICtrlSetData($HWD,$neu)
    GUICtrlSetData($HWD2,$neu2)
    Else
    GUICtrlSetData($HWD,$neu)
    GUICtrlSetData($HWD2,$neu2)
    EndIf
    EndFunc

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

    Func Minus($HWD,$HWD2)
    $P1=GUICtrlRead($HWD)
    $P2=GUICtrlRead($HWD2)
    $neu = $P1 -10
    $neu2 = $P2
    If $neu >= 00 Then
    $neu2 = $neu2 -1
    $neu = 60
    GUICtrlSetData($HWD,$neu)
    GUICtrlSetData($HWD2,$neu2)
    Else
    GUICtrlSetData($HWD,$neu)
    GUICtrlSetData($HWD2,$neu2)
    EndIf
    EndFunc

    [/autoit]

    MfG
    Conan (Nur Mitlesend)
    Schon lange dabei

  • du benutzt die variable $P1, $P1 (und noch einige mehr) doppelt! Einmal als Plus Button und zusätzlich in der Function Plus als Variable...
    Anstrengend zu lesen dein code. Ich finde es immer einfach, wenn man zb. einen Button z.B. der Variable $btn_text zuweist. Damit verhindert man solche Fehler.

    ---
    In "Independence Day" konnten die Windows-Erdcomputer problemlos mit denen der Außerirdischen kommunizieren. Was sagt uns das über unseren lieben Bill Gates? :D
    ---