Guest danp Posted November 9, 2004 Share Posted November 9, 2004 Newbie question: Is it commonly understood that Win2K "cmd.exe" windows are of such form/structure that AutoIt cannot see the window text? The SPY app tells me Window title is "DOS", but no Window Text, regardless of what I see. So I expect since SPY cannot see the text, neither can AutoIt. Wondering if it's part of newbie learning curve that says "nope.. can't see the text because.... ". Or maybe there's some properties of the window that need to be changed that will enable text accessibility. Thanks. Link to comment Share on other sites More sharing options...
Guest danp Posted November 9, 2004 Share Posted November 9, 2004 you are correct that you cannot automatically SEE the text in a cmd window... could try...I follow the logic, and your quick reply appreciated. Link to comment Share on other sites More sharing options...
trids Posted November 10, 2004 Share Posted November 10, 2004 You also have the option of redirecting the DOS output to a file which AU3 can then access: ;let's build an array of files in a folder $aFiles = _GetFileList("C:\WINNT") msgBox(0,"Number of files",$aFiles[0]) Func _GetFileList($psFolder) ;decide on a temp file $sTmp = @TempDir & "\~getlist.lst" ;Reroute a DIR command to the temp file RunWait(@COMSPEC & " /c DIR /B /A-D """ & $psFolder & """>""" & $sTmp & """", "", @SW_HIDE) ;Read the textfile into an array $sFileList = FileRead($sTmp, FileGetSize($sTmp)) ;Cleanup FileDelete($sTmp) ;And leave Return StringSplit(StringReplace($sFileList, @CRLF, @LF),@LF) EndFunc .. HTH Link to comment Share on other sites More sharing options...
Balachander K Posted July 7, 2006 Share Posted July 7, 2006 (edited) You also have the option of redirecting the DOS output to a file which AU3 can then access:This wont work if we are working with a DOS application..it works with dos commands though...If we have an Input box in a DOS application...AutoIT cannot recognize these controls...and getting the text is also a problem...should have the flexibility....larry's idea might work but not comprehensive....-Bala Edited July 7, 2006 by Balachander K Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 7, 2006 Share Posted July 7, 2006 This wont work if we are working with a DOS application..it works with dos commands though... If we have an Input box in a DOS application...AutoIT cannot recognize these controls...and getting the text is also a problem...should have the flexibility.... larry's idea might work but not comprehensive.... -Bala Get the latest Beta and check out the I/O redirection flags for the RUN() function: Run ( "filename" [, "workingdir" [, flag[, standard_i/o_flag]]] ) standard_i/o_flag [optional] Provide a meaningful handle to one or more STD I/O streams of the child process. 1 ($STDIN_CHILD) = Provide a handle to the child's STDIN stream 2 ($STDOUT_CHILD) = Provide a handle to the child's STDOUT stream 4 ($STDERR_CHILD) = Provide a handle to the child's STDERR stream Set the flag for $STDOUT_CHILD and then you read it with the StdoutRead() function. By setting $STDOUT_CHILD + $STDIN_CHILD, you can be interactive using StdoutRead() and StdinWrite(). Cool new stuff in the Beta! Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Balachander K Posted July 10, 2006 Share Posted July 10, 2006 (edited) i am not able to make it work. #include <Constants.au3> $foo = Run(@ComSpec & " /c abcd.defg.com 10345", "", @SW_MAXIMIZE,$STDIN_CHILD + $STDOUT_CHILD) Sleep(5000) StdinWrite($foo, "USERID{TAB}PASSWORD") Sleep(5000) While 1 $line = StdoutRead($foo) If @error = -1 Then ExitLoop MsgBox(0, "STDOUT read:", $line) Wend Its just not sending the userid and password...it exits peacefully without throwing any error... Edited July 10, 2006 by Balachander K Link to comment Share on other sites More sharing options...
MHz Posted July 10, 2006 Share Posted July 10, 2006 (edited) @Balachander K Try keeping the @ComSpec window open by using the /k switch instead of /c. Edit: Not sure, but you may need to have your StdinWrite() after the StdOutRead, as that maybe when Comspec is ready to receive the data. Edited July 10, 2006 by MHz Link to comment Share on other sites More sharing options...
nfwu Posted July 10, 2006 Share Posted July 10, 2006 @Balachander K: Looks like you want to telnet. #include <Constants.au3> $foo = Run("telnet abcd.defg.com 10345", "", @SW_MAXIMIZE,$STDIN_CHILD + $STDOUT_CHILD) Sleep(2000) MsgBox(0, "", Stdoutread($foo)) StdinWrite($foo, "USERID{TAB}PASSWORD") Sleep(5000) While 1 $line = StdoutRead($foo) If @error = -1 Then ExitLoop MsgBox(0, "STDOUT read:", $line) Wend I have not tested this, and I don't think it will even work, but give it a try anyway. #) TwitterOut of date stuff:Scripts: Sudoku Solver | Webserver | 3D library (Pure AutoIt) | Wood's GadgetsUDFs: _WoodUniqueID() | _DialogEditIni() | _Console*() | _GetIPConfigData() | _URLEncode/Decode() Link to comment Share on other sites More sharing options...
Balachander K Posted July 10, 2006 Share Posted July 10, 2006 (edited) Thanks guys...but both the suggestions are not working..... /k option does keep it visible but the telnet is not going thro... For the nfwu code...its same result like mine... I am sticking to larry's suggestion. in fact i completed my code with that and its perfectly fine as of now.... Larry/anyone can u explain what ("!{SPACE}es{ENTER}") actually does?? Thanks and Regards, Bala Edited July 10, 2006 by Balachander K 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