System console output
System console output
How to make my MUI program outputs messages to the system console/Shell widnow? Print() seems to output the Hollywood display which I don't need and have it hidden.
Re: System console output
I use DebugPrint... If you're using, for example, Cubic IDE then it outputs to its debug window, but when running a compiled program, it outputs to console window.
Re: System console output
Thank You! It works. I wouldn't ever think to have a look at DebugPrint() since it's looksto be intended for debug purposes only.
Yes, I use CubicIDE.
Yes, I use CubicIDE.
Re: System console output
Although now when the debug output is disabled by default for compiled programs (since 7.1, and with some good reasons), I'm also wondering what command should I use to print text to the console I have commandline support for almost all of my programs, and I've just been using DebugPrint to display some info and list the available commands etc. Any ideas? Of course I could enable the debug output manually, but it would be cleaner to have it disabled as suggested. Maybe some new shell/console support commands Andreas?
- airsoftsoftwair
- Posts: 5626
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: System console output
Yes, it would make sense to add some specific console functions now because currently you can't have DebugPrint() enabled without also enabling DebugOutput() which could expose algorithms in your script.
Re: System console output
I'm also not glad about the fact, that explicit debug messages now can only be output if implicit are also allowed.
First of all: Though DebugPrint will not output to Shell window any more it is still possible to print to Cubic Output section even without enabling DebugOutput() !
For printing to the shell window your program was started from or to open a Console Window when started from Desktop, you could simply use this code:
BTW, instead of "CONSOLE:" you could also simply use "*"
If you don't want to adapt your program to much, you could add these line of code:
If your script does not use ISO 8859-1 encoding but UTF8 try this:
Hope this helps...
First of all: Though DebugPrint will not output to Shell window any more it is still possible to print to Cubic Output section even without enabling DebugOutput() !
For printing to the shell window your program was started from or to open a Console Window when started from Desktop, you could simply use this code:
Code: Select all
Output=Function(string) StringToFile(string,"CONSOLE:") EndFunction
OutputN=Function(string) Output(string .. "\n") EndFunction
If you don't want to adapt your program to much, you could add these line of code:
Code: Select all
OrigDebugPrint=DebugPrint ; for the case we want still to do real debug output ,e.g. in Cubic Output section
DebugPrint=OutputN
Code: Select all
Output=Function(string)
Local fh=OpenFile(Nil,"*",#MODE_WRITE)
WriteString(fh,ConvertStr(string,#ENCODING_UTF8,#ENCODING_AMIGA))
CloseFile(fh)
EndFunction
Re: System console output
Thanks! That was a good tip.
Another option is to print like this:
But the problem with these workarounds is that they aren't universal and will fail on other platforms.
I've just loved the way that DebugPrint did print in Cubic's output window when coding, and then to console when running a compiled binary. It's been very handy and hopefully we get some similar option again. Pure console output functions would be nice, but this kind of combined usage would be even nicer.
Another option is to print like this:
Code: Select all
Echo=Function(string) Execute("echo \""..ReplaceStr(string,"\n","*N").."\"") EndFunction
I've just loved the way that DebugPrint did print in Cubic's output window when coding, and then to console when running a compiled binary. It's been very handy and hopefully we get some similar option again. Pure console output functions would be nice, but this kind of combined usage would be even nicer.
- airsoftsoftwair
- Posts: 5626
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: System console output
Well, to all who want the old behaviour back: All you have to do is to set "EnableDebug" to TRUE in @OPTIONS and everything will be exactly as before. So no big deal, actually.I've just loved the way that DebugPrint did print in Cubic's output window when coding, and then to console when running a compiled binary. It's been very handy and hopefully we get some similar option again. Pure console output functions would be nice, but this kind of combined usage would be even nicer.
That being said, I agree that disabling all debug functions globally by default when compiling probably wasn't the best idea. I think it would have been better to just disable DebugOutput() and its console counterpart by default when compiling and keep all other functions working. Maybe I'll do it like that in the next version. Having DebugPrint() and the likes enabled by default doesn't pose any security risk anyway so the only thing that should really be disabled by default is DebugOutput().
Re: System console output
WTF happened to debugprint?
I have tried debugoutput(true) and that doesn't work either!
Cannot live without a debugger :S
Edit: I see that @OPTIONS works, but setting DebugOutput does not.
I have tried debugoutput(true) and that doesn't work either!
Cannot live without a debugger :S
Edit: I see that @OPTIONS works, but setting DebugOutput does not.
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
http://myevolve.wordpress.com
- airsoftsoftwair
- Posts: 5626
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: System console output
If you set "EnableDebug" to TRUE in @OPTIONS, everything should be as before.