Loop Counter mit Anzeige

  • Hallo,
    ich habe eine Frage zur Umsetzung eines Loop Counters
    Die Anzahl der Durchgänge werden per InputBox abgefragt (bei erreichen "ESC" + MsgBox)

    Der Aktuelle Status soll kurz (10s) am unteren rechten Bildschirmrand angezeigt werden.
    Bis jetzt habe ich folgendes fertig.

    [autoit]

    $anzahl=InputBox("Anzahl der Durchgänge","Bitte gewünschte Anzahl angeben","*")

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

    HotKeySet("{ESC}","_exit")

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

    RunWait('load.exe')

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

    While True

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

    $status=DriveStatus($drive)

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

    If $status = "NOTREADY" Then _next()

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

    sleep(1000)

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

    WEnd

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

    Func _next()

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

    RunWait('load1.exe ')

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

    sleep(1000)

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

    $iCount =0

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

    Do

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

    $iCount += 1

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

    Until $iCount = $anzahl

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

    RunWait('load2.exe')

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

    sleep(1000)

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

    MouseClick("left",591,550,2)

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

    EndFunc

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

    Func _exit()

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

    Exit

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

    EndFunc

    [/autoit]

    Wie bekomme ich das mit der Anzeige & "ESC"+MsgBox hin?

  • willst du ,dass alle 10 sekunden die anzahl angezeigt wird oder dass die aktuelle anzahl angezeigt wird mit einem timeout von 10 sek. ?

  • statt dem:

    [autoit]

    Do

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

    $iCount += 1

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

    Until $iCount = $anzahl

    [/autoit]

    einfach sowas hier

    [autoit]


    for $i = 1 to $iCount
    ToolTip($i)
    sleep(10)
    Next

    [/autoit][autoit][/autoit][autoit][/autoit][autoit][/autoit]
  • Danke für die Antworten!
    Aber wie kann ich mir nun Counterstatus kurz anzeigen lassen bzw. bei erreichen der eingestellten Durchläufe das Script beenden?

  • Danke.

    Habe gerade den Code geändert. Wurde auch fehlerfrei compiliert.
    Jedoch wird nichts angezeigt.

  • Hier ist der komplette Code:

    [autoit]

    $drive=InputBox("ROBOTIC LAUFWERK","Laufwerksbuchstaben eingeben","H:")

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

    $Comport=InputBox("ROBOTIC COMPORT","Comport der Robotic eingeben","COM6")

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

    $Count=InputBox("Anzahl der Discs","Anzahl der zu verarbeitenden Discs","*")

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

    HotKeySet("{ESC}","_exit")

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

    RunWait('load.exe --comport='&$comport&' --drive='&$drive&' --command=V:X:30:2:E')

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

    sleep(1000)

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

    RunWait('load.exe --comport='&$comport&' --drive='&$drive&' --command=C:X:30:2:E')

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

    sleep(1000)

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

    RunWait('load.exe --comport='&$comport&' --drive='&$drive&' --open --command=I:X:30:2:E --ifcommandfailortimeoutskip=failedload --set=loaderrors:0:robot --skip=trayanddiscin --label=failedload --skip=loadmorediscs --label=loadmorediscs --notify="You can cancel the batch with Abort. Hit Retry only after you load more discs on the spindle and CLEAR REJECTS. Hit Ignore if the disc loaded correctly.":"Load may have failed for drive {drive} on port {comport}.":2 --set=rc:{notifyreturncode} --ifsetskip=rc:3:shutdown --ifsetskip=rc:4:resetloaderrors --ifsetskip=rc:5:trayanddiscin --skip=failedload --label=resetloaderrors --set=loaderrors:0:robot --rejectsreset --skip=doreset --label=trayanddiscin --closeblind --sleep=2 --unbindtodrive --comportrelease --label=successexit --exit=0 ')

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

    Sleep(2000)

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

    While True

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

    $status=DriveStatus($drive)

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

    If $status = "NOTREADY" Then _next()

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

    sleep(1000)

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

    WEnd

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

    Func _next()

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

    RunWait('load.exe --comport='&$comport&' --drive='&$drive&' --open --command=A:X:30:2:E --ifcommandfailortimeoutskip=failedexit --comportrelease --skip=successexit --label=failedexit --notify="Problem with robot on port {comport} for drive {drive}, shutting down..." --set=shutdown:yes:robot --skip=shutdown --exit=0 --label=successexit --exit=0 --label=shutdown --set=needsreset:yes:robot --messagefile={passerrorsback} --message="[cancel batch]" --exit')

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

    sleep(2000)

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

    $iCount =0
    for $i = 1 to $iCount

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

    ToolTip($i)

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

    sleep(10)

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

    Next

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

    RunWait('load.exe --comport='&$comport&' --drive='&$drive&' --command=I:X:30:2:E --ifcommandfailortimeoutskip=failedload --set=loaderrors:0:robot --skip=trayanddiscin --label=failedload --skip=loadmorediscs --label=loadmorediscs --notify="You can cancel the batch with Abort. Hit Retry only after you load more discs on the spindle and CLEAR REJECTS. Hit Ignore if the disc loaded correctly.":"Load may have failed for drive {drive} on port {comport}.":2 --set=rc:{notifyreturncode} --ifsetskip=rc:3:shutdown --ifsetskip=rc:4:resetloaderrors --ifsetskip=rc:5:trayanddiscin --skip=failedload --label=resetloaderrors --set=loaderrors:0:robot --rejectsreset --skip=doreset --label=trayanddiscin --closeblind --sleep=2 --unbindtodrive --comportrelease --label=successexit --exit=0')

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

    Sleep(2000)

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

    MouseClick("left",591,550,2)
    EndFunc

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

    Func _exit()

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

    Exit

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

    EndFunc

    [/autoit]
  • Für die Abfrage hatte ich schon Zeile 5 vorgesehen:
    So funzt die Abfrage jedoch nicht.

    Wie beende ich nun das Script wenn der Wert der Variable erreicht ist?

    [autoit]

    $Count=InputBox("Anzahl der Discs","Anzahl der zu verarbeitenden Discs","*")
    $iCount =$Count

    [/autoit]
  • so?

    Spoiler anzeigen
    [autoit]

    $drive = InputBox("ROBOTIC LAUFWERK", "Laufwerksbuchstaben eingeben", "H:")
    $Comport = InputBox("ROBOTIC COMPORT", "Comport der Robotic eingeben", "COM6")
    Global $Count = InputBox("Anzahl der Discs", "Anzahl der zu verarbeitenden Discs", "*")

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

    HotKeySet("{ESC}", "_exit")
    RunWait('load.exe --comport=' & $Comport & ' --drive=' & $drive & ' --command=V:X:30:2:E')
    Sleep(1000)
    RunWait('load.exe --comport=' & $Comport & ' --drive=' & $drive & ' --command=C:X:30:2:E')
    Sleep(1000)
    RunWait('load.exe --comport=' & $Comport & ' --drive=' & $drive & ' --open --command=I:X:30:2:E --ifcommandfailortimeoutskip=failedload --set=loaderrors:0:robot --skip=trayanddiscin --label=failedload --skip=loadmorediscs --label=loadmorediscs --notify="You can cancel the batch with Abort. Hit Retry only after you load more discs on the spindle and CLEAR REJECTS. Hit Ignore if the disc loaded correctly.":"Load may have failed for drive {drive} on port {comport}.":2 --set=rc:{notifyreturncode} --ifsetskip=rc:3:shutdown --ifsetskip=rc:4:resetloaderrors --ifsetskip=rc:5:trayanddiscin --skip=failedload --label=resetloaderrors --set=loaderrors:0:robot --rejectsreset --skip=doreset --label=trayanddiscin --closeblind --sleep=2 --unbindtodrive --comportrelease --label=successexit --exit=0 ')
    Sleep(2000)

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

    While True
    $status = DriveStatus($drive)
    If $status = "NOTREADY" Then _next()
    Sleep(1000)
    WEnd

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

    Func _next()
    RunWait('load.exe --comport=' & $Comport & ' --drive=' & $drive & ' --open --command=A:X:30:2:E --ifcommandfailortimeoutskip=failedexit --comportrelease --skip=successexit --label=failedexit --notify="Problem with robot on port {comport} for drive {drive}, shutting down..." --set=shutdown:yes:robot --skip=shutdown --exit=0 --label=successexit --exit=0 --label=shutdown --set=needsreset:yes:robot --messagefile={passerrorsback} --message="[cancel batch]" --exit')
    Sleep(2000)
    $iCount = 0
    For $i = 1 To $Count
    ToolTip($i)
    Sleep(10)
    Next
    Exit; hier ist der wert der variable erreicht
    RunWait('load.exe --comport=' & $Comport & ' --drive=' & $drive & ' --command=I:X:30:2:E --ifcommandfailortimeoutskip=failedload --set=loaderrors:0:robot --skip=trayanddiscin --label=failedload --skip=loadmorediscs --label=loadmorediscs --notify="You can cancel the batch with Abort. Hit Retry only after you load more discs on the spindle and CLEAR REJECTS. Hit Ignore if the disc loaded correctly.":"Load may have failed for drive {drive} on port {comport}.":2 --set=rc:{notifyreturncode} --ifsetskip=rc:3:shutdown --ifsetskip=rc:4:resetloaderrors --ifsetskip=rc:5:trayanddiscin --skip=failedload --label=resetloaderrors --set=loaderrors:0:robot --rejectsreset --skip=doreset --label=trayanddiscin --closeblind --sleep=2 --unbindtodrive --comportrelease --label=successexit --exit=0')
    Sleep(2000)
    MouseClick("left", 591, 550, 2)
    EndFunc ;==>_next

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

    Func _exit()
    Exit
    EndFunc ;==>_exit

    [/autoit]
  • Hallo,
    ich habe vorsichtshalber den Variablennamen geändert.
    es sieht jetzt so aus:

    [autoit]

    $Anzahl=InputBox("Anzahl der Discs","Anzahl der zu verarbeitenden Discs","*")
    $iCount =$Anzahl

    [/autoit]


    In de ToolTip Anzeige wird immer die gesamte Anzahl der "Anzahl=InputBox" angezeigt sie verändert sich nicht.

  • Zitat

    so wie ichs gepostet hab verändert sie sich

    [autoit]

    $iCount = Inputbox("Gib den wert ein", "")

    [/autoit]

    Habe den Code geändert.
    Aber irgendwooo ist da noch ein problemchen..
    Jetzt fragt er bei jedem Durchlauf die Inputbox("Gib den wert ein", "" ab.

    • Offizieller Beitrag

    Hallo,

    sollte das nicht etwa so was werden?

    Spoiler anzeigen
    [autoit]

    $drive = InputBox("ROBOTIC LAUFWERK", "Laufwerksbuchstaben eingeben", "H:")
    $Comport = InputBox("ROBOTIC COMPORT", "Comport der Robotic eingeben", "COM6")
    $Anzahl = InputBox("Anzahl der Discs", "Anzahl der zu verarbeitenden Discs", "*")

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

    HotKeySet("{ESC}", "_exit")

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

    Global $iCount = 1

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

    RunWait('load.exe --comport=' & $Comport & ' --drive=' & $drive & ' --command=V:X:30:2:E')
    Sleep(1000)

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

    RunWait('load.exe --comport=' & $Comport & ' --drive=' & $drive & ' --command=C:X:30:2:E')
    Sleep(1000)

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

    RunWait('load.exe --comport=' & $Comport & ' --drive=' & $drive & ' --open --command=I:X:30:2:E --ifcommandfailortimeoutskip=failedload --set=loaderrors:0:robot --skip=trayanddiscin --label=failedload --skip=loadmorediscs --label=loadmorediscs --notify="You can cancel the batch with Abort. Hit Retry only after you load more discs on the spindle and CLEAR REJECTS. Hit Ignore if the disc loaded correctly.":"Load may have failed for drive {drive} on port {comport}.":2 --set=rc:{notifyreturncode} --ifsetskip=rc:3:shutdown --ifsetskip=rc:4:resetloaderrors --ifsetskip=rc:5:trayanddiscin --skip=failedload --label=resetloaderrors --set=loaderrors:0:robot --rejectsreset --skip=doreset --label=trayanddiscin --closeblind --sleep=2 --unbindtodrive --comportrelease --label=successexit --exit=0 ')
    Sleep(2000)
    ToolTip("Disk " & $iCount)

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

    While True
    $status = DriveStatus($drive)
    If ($status = "NOTREADY") Then
    If $iCount < $Anzahl Then
    _next()
    $iCount += 1
    ToolTip("Disk " & $iCount)
    Else
    ExitLoop
    EndIf
    EndIf
    Sleep(1000)
    WEnd

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

    Func _next()
    RunWait('load.exe --comport=' & $Comport & ' --drive=' & $drive & ' --open --command=A:X:30:2:E --ifcommandfailortimeoutskip=failedexit --comportrelease --skip=successexit --label=failedexit --notify="Problem with robot on port {comport} for drive {drive}, shutting down..." --set=shutdown:yes:robot --skip=shutdown --exit=0 --label=successexit --exit=0 --label=shutdown --set=needsreset:yes:robot --messagefile={passerrorsback} --message="[cancel batch]" --exit')
    Sleep(2000)

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

    RunWait('load.exe --comport=' & $Comport & ' --drive=' & $drive & ' --command=I:X:30:2:E --ifcommandfailortimeoutskip=failedload --set=loaderrors:0:robot --skip=trayanddiscin --label=failedload --skip=loadmorediscs --label=loadmorediscs --notify="You can cancel the batch with Abort. Hit Retry only after you load more discs on the spindle and CLEAR REJECTS. Hit Ignore if the disc loaded correctly.":"Load may have failed for drive {drive} on port {comport}.":2 --set=rc:{notifyreturncode} --ifsetskip=rc:3:shutdown --ifsetskip=rc:4:resetloaderrors --ifsetskip=rc:5:trayanddiscin --skip=failedload --label=resetloaderrors --set=loaderrors:0:robot --rejectsreset --skip=doreset --label=trayanddiscin --closeblind --sleep=2 --unbindtodrive --comportrelease --label=successexit --exit=0')
    Sleep(2000)

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

    MouseClick("left", 591, 550, 2)
    EndFunc ;==>_next

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

    Func _exit()
    Exit
    EndFunc ;==>_exit

    [/autoit]