Guten Abend zusammen,
ich möchte gern einen Timer in einer IF THEN ELSEIF Abfrage einbauen.
Zur Funktion:
Der ElseIf -Zweig also die Funktion _fertig() soll nur ausgeführt werden wenn der ($status = "NOTREADY") für eine gewisse Zeit besteht.
Diese Zeit soll per Timer einstellbar sein.
Also Z.B der ($status = "NOTREADY") muß 10 s bestehen And Not WinExists("Backup","disc and press OK.") Then
_fertig()
Hier nun der code
siehe Zeile 53!
Danke für Eure Hilfe
Spoiler anzeigen
$file=FileOpen(@ScriptDir & "\config.txt",0)
$drive=FileReadLine(@ScriptDir & "\config.txt",4)
$Comport=FileReadLine(@ScriptDir & "\config.txt",6)
$Version=('V:X:30:2:E');Robotic Version Info Command
$Calibration=('C:X:30:2:E');Calibration Command
$Load=('I:X:30:2:E');Get Input (load) Command
$Unload=('A:X:30:2:E');Unload the Drive Command
HotKeySet("{ESC}","_exit")
Global $iCount = 1
if $file=-1 Then
MsgBox(0,"Error","Unable to open the config.txt")
Exit
EndIf
$vardrive=DriveStatus($drive)
If ($vardrive = "INVALID") Then
MsgBox(16,"Error","Invalid Optical Drive!"&@CRLF& $drive)
Exit
EndIf
If ($vardrive = "READY") Then
MsgBox(48,"Info", "Please unload the Drive" &@CRLF& $drive)
CDTray($drive,"open")
Exit
EndIf
RunWait('load.exe --comport='&$comport&' --drive='&$drive&' --command='&$Version&'')
sleep(1000)
RunWait('load.exe --comport='&$comport&' --drive='&$drive&' --command='&$Calibration&'')
sleep(1000)
RunWait('load.exe --comport='&$comport&' --drive='&$drive&' --open --command='&$Load&' --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)
If WinExists("Backup","disc and press OK.") Then
ControlClick("Backup","OK","Button1")
EndIf
ToolTip("Disc" &$iCount)
While True
$status=DriveStatus($drive)
sleep(500)
If WinExists("Backup","disc and press OK.") Then
$iCount += 1
ToolTip("Disc" &$iCount)
_next()
ElseIf ($status = "NOTREADY") And Not WinExists("Backup","disc and press OK.") Then
_fertig()
ExitLoop
EndIf
EndIf
sleep(500)
WEnd
Func _next()
RunWait('load.exe --comport='&$comport&' --drive='&$drive&' --open --command='&$Unload&' --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')
RunWait('load.exe --comport='&$comport&' --drive='&$drive&' --command='&$Load&' --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)
ControlClick("Backup","OK","Button1")
EndFunc
Func _fertig()
RunWait('load.exe --comport='&$comport&' --drive='&$drive&' --open --command='&$Unload&' --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(1000)
CDTray($drive,"close")
sleep(1000)
MsgBox(64,"Programminfo","Backup" &@CRLF& "Finished",10)
EndFunc
Func _exit()
Exit
EndFunc