CyRus@Home Posted September 14, 2006 Share Posted September 14, 2006 (edited) Hi, i am a newbie in programming autoit. I want to program a script that opens a dos-program from a CD, the dosprogram waits for entering data,after pressing enter, the program will response with data, now autoit should filter that Data (i need only some Letters of the responsed Letters) and send it to a Infobox in windows (or anything similar) to read this code. Could please someone tell me how to do that ? UPDATE : Now i'm able to open the program with this script : $drive = StringMid(@ScriptDir,1,1) Run($drive & ":\start.exe") But what do i have to do, to read the text which is displayed in the dos window,and show this seperately in a Windows MsgBox. Thanks in advance CyRus Edited September 14, 2006 by CyRus@Home Link to comment Share on other sites More sharing options...
Paulie Posted September 14, 2006 Share Posted September 14, 2006 Hi,i am a newbie in programming autoit. I want to program a script that opens a dos-program from a CD, the dosprogram waits for entering data,after pressing enter, the program will response with data, now autoit should filter that Data (i need only some Letters of the responsed Letters) and send it to a Infobox in windows (or anything similar) to read this code.Could please someone tell me how to do that ? UPDATE : Now i'm able to open the program with this script :$drive = StringMid(@ScriptDir,1,1)Run($drive & ":\start.exe")But what do i have to do, to read the text which is displayed in the dos window,and show this seperately in a Windows MsgBox.Thanks in advanceCyRusDon't know if "WinGetText()" works on a dos window, but it's worth a shot Link to comment Share on other sites More sharing options...
CyRus@Home Posted September 14, 2006 Author Share Posted September 14, 2006 (edited) I think i'm not finished yet, what's wrong with this code ? #include <Constants.au3> Dim $text $drive = StringMid(@ScriptDir,1,1) $stream = RunWait($drive & ":\data.exe") While 1 $textline = StdoutRead($stream) $text = $text & @CRLF & $textline If @error Then ExitLoop Wend MsgBox(0, "your data is", $text) The Dos-Program waits for entering my Data,but after pressing enter,the MsgBox opens with no text in it. Edited September 14, 2006 by CyRus@Home Link to comment Share on other sites More sharing options...
herewasplato Posted September 14, 2006 Share Posted September 14, 2006 I think i'm not finished yet, what's wrong with this code ? #include <Constants.au3> Dim $text $drive = StringMid(@ScriptDir,1,1) $stream = RunWait($drive & ":\data.exe") While 1 $textline = StdoutRead($stream) $text = $text & @CRLF & $textline If @error Then ExitLoop Wend MsgBox(0, "your data is", $text) The Dos-Program waits for entering my Data,but after pressing enter,the MsgBox opens with no text in it.StdoutRead requires the PID of the process it is to work with StdoutRead ( process_id[, count[, peek = false]] ) Run will return the PID... RunWait does not Run ( "filename" [, "workingdir" [, flag[, standard_i/o_flag]]] ) [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
CyRus@Home Posted September 14, 2006 Author Share Posted September 14, 2006 StdoutRead requires the PID of the process it is to work with StdoutRead ( process_id[, count[, peek = false]] ) Run will return the PID... RunWait does not Run ( "filename" [, "workingdir" [, flag[, standard_i/o_flag]]] ) mmmhhh, and how do i solve this problem ? If i try it with the standard run-function, autoit waits not for entering data ?! Link to comment Share on other sites More sharing options...
herewasplato Posted September 14, 2006 Share Posted September 14, 2006 mmmhhh, and how do i solve this problem ? If i try it with the standard run-function, autoit waits not for entering data ?!I'm probably not the best person to advise you on this function as I've only worked with it once or twice. Here is a little sample from one script where I "read" the output of the process and let AutoIt make the input for me. While 1 $CMDoutput &= StdoutRead($ProcessID) If StringInStr($CMDoutput, "HIT ENTER TO CONTINUE") Then StdinWrite($ProcessID, "{ENTER}") $CMDoutput = "" ExitLoop EndIf Sleep(10) WEndmaybe an input box would work for you [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
CyRus@Home Posted September 14, 2006 Author Share Posted September 14, 2006 (edited) I'm probably not the best person to advise you on this function as I've only worked with it once or twice. Here is a little sample from one script where I "read" the output of the process and let AutoIt make the input for me. While 1 $CMDoutput &= StdoutRead($ProcessID) If StringInStr($CMDoutput, "HIT ENTER TO CONTINUE") Then StdinWrite($ProcessID, "{ENTER}") $CMDoutput = "" ExitLoop EndIf Sleep(10) WEndmaybe an input box would work for youI have no clue how to do that,sorry Who can help me ?? Edited September 14, 2006 by CyRus@Home Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now