Jump to content
Sign in to follow this  
Danith

STDOUT not showing up on command line?

Recommended Posts

Danith

I have instructions for my script print out using the ConsoleWrite command. When you run it, nothing shows up on screen. If you do a "<scripname> >> output.txt" the instructions will show up. How do I just have it output and display to the screen? Or do I have to do something where it writes the info to a text file then displays it by calling "more <textfile>" ?

Edited by Danith

Share this post


Link to post
Share on other sites
Mat

Have you tried compiling it as a console app? The option is there in Aut2Exe.

Alternatively if you use scite, you can see it there.

[advertisement]Or use this :) [/advertisement]

MDiesel

Share this post


Link to post
Share on other sites
Danith

Have you tried compiling it as a console app? The option is there in Aut2Exe.

Alternatively if you use scite, you can see it there.

[advertisement]Or use this :) [/advertisement]

MDiesel

Yes, compiled it has the same behavior as uncompiled. :) Text only shows if I redirect stdout to a file (thats what >> does, right?)

Oh, and to clarify. The output does show up in the output box in scite. It doesn't show up if I execute the script from the command line (c:\program files\autoit\autoit3.exe myscript.au3) or if I compile it into an exe and then run it from the command line.

I guess for what I'll be using it for it doesn't really matter that much but I'm curious

Edited by Danith

Share this post


Link to post
Share on other sites
Lars

Did you run it from the command line or just double clicked it in explorer?

If so add a pause or sleep at the end of your script so the dosbox won't flash away before youy can see it.

Share this post


Link to post
Share on other sites
Danith

Did you run it from the command line or just double clicked it in explorer?

If so add a pause or sleep at the end of your script so the dosbox won't flash away before youy can see it.

Yes :) .

C:\>report_run.exe

C:\>

This demonstrates it :)

If $CmdLine[0] = 0 Then
    ConsoleWrite("Error:  Enter reports you want to run")
    _Help()
    Exit 1
EndIf


Func _Help()
    ConsoleWrite( @CRLF & "Usage: " & @ScriptFullPath & " ""report name 1"" ""report name 2"" .. etc " & @CRLF & _
    "This will hopefully" & @CRLF & _
    "output to the console/command line" & @CRLF & _
    "but it doesn't seem to work" & @CRLF & _
    "you can see the text by directing it" & @CRLF & _
    "to a file." & @CRLF & _
    "i.e. """ & @ScriptFullPath & " >> text.txt""" & @CRLF & _
    "blah blah" & @CRLF & _
    "more stuff" & @CRLF )
EndFunc

Share this post


Link to post
Share on other sites
Skruge

Did you compile it as a Console App as MDiesel suggested?

Add this to your script and recompile it:

#AutoIt3Wrapper_Change2CUI=y

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites
Danith

Did you compile it as a Console App as MDiesel suggested?

Add this to your script and recompile it:

#AutoIt3Wrapper_Change2CUI=y
Ahh thanks.. put me on the right track :) Adding that option to my script didn't do anything, but manually compiling made it work with the following options:

/comp 4 /pack /console

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×