cprowse Posted October 24, 2006 Share Posted October 24, 2006 Hi all, I am looking for an alternative to ConsoleWrite that will successfully output when calling a compiled script from a cmd prompt. I have successfully got output going to a log using '_FileWriteLog', but cannot get anything to output to the cmd screen. Also, I seem to be having trouble getting exit codes to be picked up in the cmd screen. I compiled a script simply with the line: "Exit 10" Running this in Scite exits with the error code 10 (as expected) - however, calling the compiled script from a cmd prompt, and then running 'echo %ERRORLEVEL%' returns 0 (zero) every time. Am I just doing something stupidly? Thanks all - apologies for so many newbie questions -Chris Link to comment Share on other sites More sharing options...
logi Posted October 24, 2006 Share Posted October 24, 2006 Lets start basic... run("cmd.exe") WinWait("C:\WINDOWS\system32\cmd.exe") WinActivate("C:\WINDOWS\system32\cmd.exe") send("test") If this isn't wat you wanted to do, please give us the script (or the part you have trouble with). Link to comment Share on other sites More sharing options...
cprowse Posted October 24, 2006 Author Share Posted October 24, 2006 Logi, Thanks for the reply - the problem I am having is getting output into the cmd window (on XP) in which I am calling a compiled script. For example, create a new AutoIT script containing nothing more than: ConsoleWrite("Printing something to the command line" & @LF) And run this in an editor such as Scite - you get a nice output in the debug window showing the expected sentence. However, now compile this script into an .exe. Open a cmd window, change to the directory containing the .exe and run it here. No output is printed - it simply returns from the script. The ConsoleWrite help says "This does not write to a DOS console." - I'm just looking for an alternative? Also, if this script were to use the Exit ($error_code) function - could I get the exit code in the cmd window when the script returns? echo %ERRORLEVEL% always seems to print '0' Kind Regards, -Chris Link to comment Share on other sites More sharing options...
logi Posted October 24, 2006 Share Posted October 24, 2006 okay if i understand your problem correctly:You start the program from the commandprompt but the consolewrite doesn't work...The ConsoleWrite help says "This does not write to a DOS console." - I'm just looking for an alternative?This means the consolewrite doesnt write TO a CMD window. Link to comment Share on other sites More sharing options...
cprowse Posted October 24, 2006 Author Share Posted October 24, 2006 Exactly - is there any alternative that I can use that will output to a cmd window? Kind Regards, -Chris Link to comment Share on other sites More sharing options...
lod3n Posted October 24, 2006 Share Posted October 24, 2006 Yes: 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...
cprowse Posted October 24, 2006 Author Share Posted October 24, 2006 Thanks for this - not quite sure how I didn't come by that thread myself.... 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