Sign in to follow this  
Followers 0
layer

CosnoleWrite -- I don't understand it

15 posts in this topic

Hey guys... I've never really bothered to look at ConsoleWrite... But I now see a good number of scripts using it to debug or whatnot... But I don't fully understand where something is written to using ConsoleWrite? Could I get a further explanation please? Thanks. :)


FootbaG

Share this post


Link to post
Share on other sites



I don't know, because the help file says:

Remarks

The purpose for this function is to write to a console which many popular text editors can read.

This does not write to a DOS console.

anybody else?

FootbaG

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

console write writes to Scite ...

also autoit has the /stdout when it is ran

so i guessed Stdout.

but yeah i want to know what is can do exept write to scite :)

Edited by w0uter

My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

Share this post


Link to post
Share on other sites

I use it to write to the bottom of my SciTe editor for testing

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Its written to the stdout handle (Simple C printf() call). By default, Windows applications do not have anything which reads their stdout handle. However, most (good) text editors do read the stdout handle of a "tool" they run. That means text editors would be able to see text from AutoIt if it was sent to stdout. ConsoleWrite() is the gateway through which this is achieved.

Share this post


Link to post
Share on other sites

Ohhh... So you have to start the AutoIt script from ScIte in order to see what scite is going to output to you, or what scite has "caught"... Thanks guys, you cleared it up a bunch :)


FootbaG

Share this post


Link to post
Share on other sites

Alternatively if you don't use SciTe to run your script's (like me) or don't use SciTe at all you can replace ConsoleWrite() with a simple message box.


[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
Share on other sites

A little clarification, in 32-bit Windows any app that you run from the shell (double-click or DOS box) gets assessed by the shell as to whether it's a console app or a GUI app. If it's a GUI app (and any compiled AutoIt3 script is) then its standard input/output pipes get disconnected, Windows making the presumption that you won't need them, even if the app was started from a DOS box. This is why there's no console output from your compiled script if you use ConsoleWrite.

If you run your compiled script another way (like from another script using Run() ) that doesn't invoke the shell, then the STDOUT pipe doesn't get disconnected and any output from ConsoleWrite is available for further processing...


Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Ohhh... So you have to start the AutoIt script from ScIte in order to see what scite is going to output to you, or what scite has "caught"... Thanks guys, you cleared it up a bunch :)

You can get CosnoleWrite output when running from a DOS console but you have to pipe it to another command. I have cygwin installed on my window machine so I just piped it through cat thus:

AutoIt3.exe MyScript.au3 | cat

Note that you have to use @CRLF for line ends.

(I realise this is probably too late for the original poster but I leave it here for anyone googling the same problem as I was)

Edited by Sam Hasler

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

How to display text to the current DOS console, where my au3 is running, like the DIR command do ?

I cannot find in the help

Edited by NextQuestion

Share this post


Link to post
Share on other sites

Any have a list of (simple) text editors that support this?

I use MetaPad, because it has a goto line function, don`t want all the extra wizz bang stuff... (yet) :)


2015 - Still no flying cars, instead blankets with sleeves.

Share this post


Link to post
Share on other sites

Alternatively if you don't use SciTe to run your script's (like me) or don't use SciTe at all you can replace ConsoleWrite() with a simple message box.

what editor do you use?

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

How to display text to the current DOS console, where my au3 is running, like the DIR command do ?

I cannot find in the help

I want to stab you multiple times. This question has been asked about 403 thousand times. There are at least two work-arounds and the subject is covered in multiple threads. Not only that, but your question is off topic in this thread since it's about ConsoleWrite() and the documentation clearly states that ConsoleWrite() does not output to DOS.

Share this post


Link to post
Share on other sites

I want to stab you multiple times.

i know you don't do this to amuse us valik, but seriously, you are awesome. [/blah] oh yeah and welcome to the forum NextQuestion.

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

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  
Followers 0