Zeitrange

  • Hallo
    Ich möchte das dieses Script nur in der Zeit zwischen 06:00 bis 00:00 startbar ist. Ansonsten soll eine Msgbox kommen und Exit.
    Doch leider bekomm ich immer Error angezeigt:
    Local $Intime = 05 ":" 59 ":" 59
    Local $Intime = ^ ERROR
    Was mach ich falsch ? Ich möchte nicht mit TimerInit/Diff "arbeiten"

    Spoiler anzeigen
    [autoit]


    #include <Constants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <StaticConstants.au3>
    #include <Date.au3>

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

    Guicreate("Size")
    $vsize=GUICtrlCreateInput("Time", 90 , 10 , 50 , 20)
    $OK=GUICtrlCreateButton("OK" , 40 , 100 , 80 , 20)
    $Cancel=GUICtrlCreateButton("Cancel" , 150 , 100 , 80 , 20)

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

    GUISetState(@SW_SHOW)

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

    While 1
    Local $time = @hour & ":" & @Min & ":" & @Sec
    Local $Intime = 05 ":" 59 ":" 59
    Local $Outtime = 23 ":" 59 ":" 59
    $Lab = GUICtrlCreateLabel(@hour & ":" & @Min & ":" & @Sec , 16 , 140 , 100 , 30)
    If $Intime >= $time And _
    $Outtime <= $time Then
    MsgBox(0 , "" , "In Time")
    Else
    MsgBox(0 , "" , "Out Time")
    Exit
    EndIf
    Sleep(800)
    WEnd

    [/autoit]

    Thx for Help

    Einmal editiert, zuletzt von Dial (14. Dezember 2010 um 01:56)

  • Hallo Dial,

    die Variablen $inTime und $outTime sind falsch initialisiert es fehlt der & Operator zum verketten, bei $time hast du es richtig gemacht. Du brauchst aber für beide Variablen nicht unbedingt den & Operator du kannst die Zeit auch "am Stück" in einen String schreiben. Desweiteren hast du meines Erachtens einen Logikfehler, sprich es muss immer Out Time herauskommen. So wäre es richtig:

    Spoiler anzeigen
    [autoit]

    #include <Constants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <StaticConstants.au3>
    #include <Date.au3>

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

    GUICreate("Size")
    $vsize = GUICtrlCreateInput("Time", 90, 10, 50, 20)
    $OK = GUICtrlCreateButton("OK", 40, 100, 80, 20)
    $Cancel = GUICtrlCreateButton("Cancel", 150, 100, 80, 20)

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

    GUISetState(@SW_SHOW)

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

    While 1
    Local $time = @HOUR & ":" & @MIN & ":" & @SEC
    Local $Intime = "00:59:59"
    Local $Outtime = "23:59:59"
    $Lab = GUICtrlCreateLabel(@HOUR & ":" & @MIN & ":" & @SEC, 16, 140, 100, 30)
    If $time >= $Intime And _
    $time <= $Outtime Then
    MsgBox(0, "", "In Time")
    Else
    MsgBox(0, "", "Out Time")
    Exit
    EndIf
    Sleep(800)
    WEnd

    [/autoit]

    mfg autoBert

  • Ja so hauts hin. Super
    Danke, nur komm ich nun bei "Intime" nicht mehr aus der While.
    Heisst es kommt immer die In Msgbox.
    Mit ExitLoop ist gleich ganz aus.
    Und eine 2.te While in der While klappt auch irgendwie nicht 8|

    Edit: Aber ok hab eine Idee, ich starte einfach eine zweite GUI.
    #Gelöst

    Einmal editiert, zuletzt von Dial (14. Dezember 2010 um 01:55)