Jump to content

what does ConsoleWrite do ?


jennico
 Share

Recommended Posts

sure i missed something, but can anyone please help me out ?

there are lots of scripts with ConsoleWrite, but does not do anything to me, so i have to change the lines to msgbox.

The purpose for this function is to write to the STDOUT stream. Many popular text editors can read this stream. Scripts compiled as Console applications also have a STDOUT stream.

ScIte is a text editor, but does not do it. what am i supposed to do ?

thx j.

Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

sorry, no !!!! so i am supposed to see it in scite ?

Yeah, do you see all the other stuff in the console?

For example do you see:

Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

$a[1]=0

^ ERROR

in the console when you run:

Local $a[1]
$a[1]=0

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

since i can't see it i am probably not the only one.

there are so many possibilities to show messages: use tooltips, labels, editboxes, messageboxes or winsettitle. i would ask the community not to use ConsoleWrite as a standard.

j.

Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

monoceres:

no, i get a messagebox.

i can use the console for running from scite or wrapper or tidy or anything. but not ConsoleWrite.

j.

Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

since i can't see it i am probably not the only one.

there are so many possibilities to show messages: use tooltips, labels, editboxes, messageboxes or winsettitle. i would ask the community not to use ConsoleWrite as a standard.

j.

Seriously? We should stop using the without question best debugging function in autoit just because something is broken on yours (and possible others) system?

:)

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

well, i would prefer a different solution. what can i do ?

edit:

the without question best debugging function in autoit

i cannot agrre to that, of course :) and without question cannot be, because i am asking.

Edited by jennico
Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

well....... wait.

of course, if i paste the code to scite, then save it and then run from scite....

okay, then no messagebox, i have the error in the console.....

is this what it's meant to be ?

j.

edit: i usually run the scripts from clipboard (see ClipRun in my sign.). if i have to paste every little piece of code to scite and then save it before .... wow, what a waste of time and space !

no, i think, ConsoleWrite is useless for example scripts ! maybe it's okay for scripting, but it is useless in example scripts !

Edited by jennico
Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

well, i would prefer a different solution. what can i do ?

Try reinstalling AutoIt & SciTe. You could also test to compile a script to a CUI exe to see if autoit even writes to the stream.

edit:

i cannot agrre to that, of course :) and without question cannot be, because i am asking.

It's simple, fast, doesn't disappear after execution and doesn't need to be turned of when released to users.

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

well....... wait.

of course, if i paste the code to scite, that save it and the run from scite....

okay, then no messagebox, i have the error in the console.....

is this what it's meant to be ?

j.

Yeah. The info from ConsoleWrite is there too.

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

well, thank you, my problem is solved now.

but since i think it is very inconvenient to use, i pledge the scripters to use the other display options. in other words: Consolewrite maybe practical in some cases, but in general i find it useless, redundant.

thx anyway. j. :)

Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

well, thank you, my problem is solved now.

but since i think it is very inconvenient to use, i pledge the scripters to use the other display options. in other words: Consolewrite maybe practical in some cases, but in general i find it useless, redundant.

thx anyway. j. :)

I think there might be some usefullness with the ConsoleWrite function depending on how you want to debug your script. However, I can also understand how you might find it not so practical as well. I personally don't use it all either. I would much rather use a simple msgbox which helps me see the debug output and the timing of that output at the same time.

My Projects: [topic="89413"]GoogleHack Search[/topic], [topic="67095"]Swiss File Knife GUI[/topic], [topic="69072"]Mouse Location Pointer[/topic], [topic="86040"]Standard Deviation Calculator[/topic]

Link to comment
Share on other sites

I tend to write a couple of functions like so:

Global $_dbgon = 1
Global $_dbg

_dbgmsg(@ScriptLineNumber,"This is a test message")
_dbgvar(@ScriptLineNumber,"$_dbgon",$_dbgon)

Func _dbgmsg($_dbg,$message)
    If $_dbgon = 1 Then
        MsgBox(0,"Code Debug","Debug Values : " & @CRLF & _ 
            "Script Line # " & $_dbg & @CRLF & _
            @CRLF & _
            $message)
    EndIf
EndFunc

Func _dbgvar($_dbg,$varname,$varvalue)
    If $_dbgon = 1 Then
        MsgBox(0,"Code Debug","Debug Values : " & @CRLF & _ 
            "Script Line # " & $_dbg & @CRLF & _
            @CRLF & _
            $varname & " = " & $varvalue)
    EndIf
EndFunc

Then I just write out which function I want to use within the code and turn the debug on or off with 1 or 0.

My Projects: [topic="89413"]GoogleHack Search[/topic], [topic="67095"]Swiss File Knife GUI[/topic], [topic="69072"]Mouse Location Pointer[/topic], [topic="86040"]Standard Deviation Calculator[/topic]

Link to comment
Share on other sites

I tend to write a couple of functions like so:

Global $_dbgon = 1
Global $_dbg

_dbgmsg(@ScriptLineNumber,"This is a test message")
_dbgvar(@ScriptLineNumber,"$_dbgon",$_dbgon)

Func _dbgmsg($_dbg,$message)
    If $_dbgon = 1 Then
        MsgBox(0,"Code Debug","Debug Values : " & @CRLF & _ 
            "Script Line # " & $_dbg & @CRLF & _
            @CRLF & _
            $message)
    EndIf
EndFunc

Func _dbgvar($_dbg,$varname,$varvalue)
    If $_dbgon = 1 Then
        MsgBox(0,"Code Debug","Debug Values : " & @CRLF & _ 
            "Script Line # " & $_dbg & @CRLF & _
            @CRLF & _
            $varname & " = " & $varvalue)
    EndIf
EndFunc

Then I just write out which function I want to use within the code and turn the debug on or off with 1 or 0.

That is only better than using ConsoleWrite if you want the script to keep stopping, but in many cases you will take hours instead of minutes to sort your script out if you only use MsgBox and never use ConsoleWrite.
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

That is only better than using ConsoleWrite if you want the script to keep stopping, but in many cases you will take hours instead of minutes to sort your script out if you only use MsgBox and never use ConsoleWrite.

Correct.

If you don't want to stop the script at all you would use ConsoleWrite. If you want to see the debug and the timing of the script you would use something similar to what I do. Obviously, the usefullness of ConsoleWrite is there and it's been noted by a few others. I'm just explaining to some of the new folks using autoit what the difference between the two would be.

ConsoleWrite = Debug with output in Scite Console that does not stop or pause the script from continuing.

Other debug functions like mine pause the script at the debug handler, give you some data and allow you to continue on.

For the OP, I believe he was trying to say that he didn't find ConsoleWrite useful because it appeared redundant to him. I can understand why he would feel that way (in certain situations..)

My Projects: [topic="89413"]GoogleHack Search[/topic], [topic="67095"]Swiss File Knife GUI[/topic], [topic="69072"]Mouse Location Pointer[/topic], [topic="86040"]Standard Deviation Calculator[/topic]

Link to comment
Share on other sites

yes, that was my plan for today ! :) i will implement console read.

but still.... lets say you have your compilation of example scripts on your hard disk. what you would expect is: double click them and see whats happening.

instead, if you have consolewrite in the script (you can't see this before opening), nothing happens and you might come to the wrong conclusion that it does not work. u have to open it in scite first. this is not practical at all !

personally, i always have up to 20 open scripts in scite and i am glad if i don't have to open another little example scriptie in a new tab (and consequently, on hard disk).

for me, i use winsettitle if i don't want a messagebox to stop the script. or, which is very nice (gary likes to to this), ToolTip. works without gui and the message is right by your mouse.

another reason: the console is hard to read !! you have to scroll the lines to find the message, and the message is not marked or colored in any way. well, i really don't like it.

of course, it's not redundant, that was a bit exagerated, it's the wrong word. it's okay for debugging, but please, please, avoid to use it in example scripts in the forum.

j.

Edited by jennico
Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...