sandman Posted June 5, 2007 Share Posted June 5, 2007 (edited) Here is a very simple method, along with example, to respond to a command typed in a DOS (aka cmd) window. Normally AutoIt cannot do this but now it is very simple to do! Here's an example:If $cmdline[0] > 0 Then If $cmdline[1] = "talk" Then $bat = "echo Hello World" FileWrite("respond.bat", $bat) If Not @error Then Send("respond.bat") Send("{ENTER}") EndIf EndIf EndIf Although it's kind of messy, it will serve its purpose. If anyone knows of an easier way, please tell me about it. note: ConsoleWrite(), although it sounds like it would work, is not seen by the DOS commandline window. this is how it will look:C:\>myscript respond C:\>respond.bat C:\>echo Hello World Hello World C:\> The respond.bat and echo are automated, as you can see in the script above. See, it's not perfect, but it can get the job done. Thanks, SANDMAN! Edited June 5, 2007 by sandman [center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center] Link to comment Share on other sites More sharing options...
lod3n Posted June 5, 2007 Share Posted June 5, 2007 Take a look at this discussion regarding this issue:http://www.autoitscript.com/forum/index.php?showtopic=31607 [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
lod3n Posted June 5, 2007 Share Posted June 5, 2007 (edited) Even better, take a look at PaulIA's method for ACTUALLY writing to the console.http://www.autoitscript.com/forum/index.php?showtopic=42542It isn't perfect (the command line returns before the characters are written), but it is the best pure AutoIt implementation that I've seen posted. Edited June 5, 2007 by lod3n [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] 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