Hallo,
ich habe folgende Frage:
Wie kann ich aus einem CLI das ich zuvor mit RunWait gestartet habe etwas auslesen?
Der Parameter den ich auslesen möchte erscheint jedoch erst kurz bevor das Programm (CLI) beendet wird!
Danke.
Sonyman
Hallo,
ich habe folgende Frage:
Wie kann ich aus einem CLI das ich zuvor mit RunWait gestartet habe etwas auslesen?
Der Parameter den ich auslesen möchte erscheint jedoch erst kurz bevor das Programm (CLI) beendet wird!
Danke.
Sonyman
Du musst Run statt RunWait verwenden ![]()
$iPID = Run("...", "...", @SW_HIDE, 0x8) ; 0x8 = $STDERR_MERGED
$sAusgabe=''
Do
$sAusgabe &= StdoutRead($iPID)
Until @error
StdioClose($iPID)
If ProcessExists($iPID) Then ProcessWaitClose($iPID)
MsgBox(0, '', $sAusgabe)
[/autoit]OK ,
und wie kann ich das programmiertechnisch umsetzen?
Danke.
Sonyman
Ich hab dir doch Beispielcode im Spoiler gepostet. Den Parameter musst du nur noch selbst mit String-Funktionen aus $sAusgabe rausfinden.
Sorry,
hatte ich übersehen!
Muß ich noch die Zeile und die Stelle angeben, wo der Parameter im CLI angezeigt wird?
Da meine Parameter nur "1 stellig" ist sprich "X" Done
"E" Error
ist, kann es mit Sicherheit vorkommen das im CLI Text mehr als ein "E" bzw "X" angezeigt wird.
Plan ist, bei "X" wird (AutoIT) Programm weiter abgearbeitet bei "E" MsgBox (Fehler..)
Danke!
Gruß
Sonyman
Ich kenne die Ausgabe des programms nicht, also weiß ich jetzt nicht, wie man die Stelle rausfiltern kann. Eventuell steht der Buchstabe an einer bestimmten Stele vom Ende her oder nac oder vor einem bestimmten Text, ... daran kann man es dann festmachen. Poste doch mal eine Beispielausgabe.
Der gesuchte Parameter ist immer
das letzte Zeichen vor dem Curser.
Habe das CLI auf einer anderen Kiste.
Poste Morgen ein Foto!
Danke
Gruß
Sonyman
Anderer Rechner war noch am Netz,
anbei 2 Fotos.
Das" I" auf dem 1. Bild ist ein Befehl, nach erfolgreicher Ausführung folgt das "X" (2.Bild)
Gruß
Sonyman
Dann könnte folgendes funktionieren:
[autoit]Switch StringRight($sAusgabe, 1)
Case 'X'
; X
Case 'E'
; E
EndSwitch
Hallo progandy,
Danke für die schnelle Antwort.
Kann ich das einfach unter den Aufruf Run... kopieren?
[autoit]Run("load.exe --comport="&$comport&" --comspeed=9600 --drive="&$drive&" --command=V::5:2 --command=C:X:30:2:E") ;Calibrieren der Robotic
Switch StringRight($sAusgabe, 1)
Case 'X'
; X
Case 'E'
; E
EndSwitch
Bleibt die Abfrage solange aktiv bis ein "X" oder ein "E" kommt?
Das CLI gibt notify return Code aus damit lässt sich mit Sicherheit auch die Abfrage realisieren.
Aber nur wenn man sich damit auskennt!
Variables
--clear=name[:scope] (clear a variable)
scope of variable is optional - can be global, bank or drive. drive is default
it determines which other ULCLI processes handling other drives can see the variable.
--clearall[=scope] (clear all variables, default scope is drive)
--set=varname:value[:scope] (set a variable)
* --varname=value (special shortcut for --set=varname:value, always in a scope of 'drive')
Any variable set via the above two methods can be used by enclosing in curly braces.
e.g. --set=inputstack:2:global
e.g. --command=_MOVE{inputstack}:$S.{inputstack}:15:5
e.g. --notify="An error occurred loading from stack {inputstack}."
You can also also return a subset of the variable: {VARNAME,START,LENGTH}.
e.g. --notify="An error occurred loading from drive letter {drive,1,1}."
Implicitly set Variables (that is, set by ULCLI)
{drive} = drive letter
{drivebank} = drive bank (1 or 2)
{comport} = e.g. COM2
{notifyreturncode} = button pressed by operator during last --notify= call
Complex Flow of Control using Variables
--ifsetskip=name:value:sv[:scope] (use variables as execution conditionals)
--ifnotsetskip=name:value:sv[:scope] (use variables as execution conditionals)
Notifications
--notify=message[:title[:type[:timeout]]] (notify operator with message and beep)
Message and Title are double quote-enclosed strings (no colons allowed), timeout is in s)
Button press sets the variable {notifyreturncode})
Types can be:
0 - OK
1 - OK and Cancel (the default)
2 - Abort, Retry, and Ignore
3 - Yes, No, and Cancel
4 - Yes and No
5 - Retry and Cancel
6 - Cancel, Try Again, Continue
The {notifyreturncode} set by Operator's button press will be:
1 - OK
2 - CANCEL
3 - ABORT
4 - RETRY
5 - IGNORE
6 - YES
7 - NO
10 - TRY AGAIN
11 - CONTINUE
--beep[=*blooper*] (*blooper* is hertz)
* --messagefile=filepath in quotes (used to send messages back to calling programs)
--message=text in quotes (written to the file specified in messagefile)
Alles anzeigen
DANKE!
Gruß
Sonyman
Du solltest vielleicht einmal die AutoIt-Hilfe lesen.
Hier ein Tip: StdOutRead