am632 Posted January 23, 2012 Share Posted January 23, 2012 Hi, If I use the command... FileWrite(@ScriptDir & "\example.bat", "commands" & ">log.txt") & then I run the generated batch file, I get a log.txt file of the command which has run. However I want to get the info from a cmd box which hasnt been started by autoit. How can I do this? I wan thinking something like.. If ProcessExists("example.exe") Then 'Get log.txt from example.exe's cmd box' but I dont know how to do the code for that bit. The example.exe runs in command prompt but isnt a .bat file Can anyone help please? Thanks Link to comment Share on other sites More sharing options...
hannes08 Posted January 23, 2012 Share Posted January 23, 2012 (edited) Hello am632, if you want to grab the outputs of example.exe you might want to have a look at StdoutRead() or StderrRead() in the helpfile. Edited January 23, 2012 by hannes08 Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
am632 Posted January 23, 2012 Author Share Posted January 23, 2012 ok thanks for that, ill have a read after lunch. cheers Link to comment Share on other sites More sharing options...
am632 Posted January 23, 2012 Author Share Posted January 23, 2012 Hi, I have looked at those in the help file but im afraid I cant see how this would work for what i'm trying to do. From what I can read these commands work for a child process which is run through the autoit script. I want to capture the command output from the example.exe which hasnt been executed by the script. If im incorrect and this can be achieved by the code you said could you possibly provide an example because I cant 'see' it. Thanks for ur help Link to comment Share on other sites More sharing options...
kwas Posted February 21, 2012 Share Posted February 21, 2012 Hi,I have looked at those in the help file but im afraid I cant see how this would work for what i'm trying to do. From what I can read these commands work for a child process which is run through the autoit script. I want to capture the command output from the example.exe which hasnt been executed by the script.If im incorrect and this can be achieved by the code you said could you possibly provide an example because I cant 'see' it.Thanks for ur helpI am not the guru, but searching for insights I noticed your question and wanna help, if you still interested.If I get your point, your example.exe is running separately. If it was started in cmd shell, then "example.exe" should be a part of window title.Else maybe you can identify it some other way around.Anyway, you could try to get its PID, or PID of its CMD shell (using WinGetProcess and Opt (WinTitleMatchMode) and proceed with it to get Stdout/Stderr output.Hope it helps. 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