HyperVista Posted February 5, 2008 Share Posted February 5, 2008 Help was kinda funny: ConsoleWrite ( "data" )RemarksThe 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.Well, then, how DO you write the DOS Console! (lol) Link to comment Share on other sites More sharing options...
Valik Posted February 5, 2008 Share Posted February 5, 2008 Use beta 3.2.11.0 and the Console compilation option. Link to comment Share on other sites More sharing options...
HyperVista Posted February 5, 2008 Author Share Posted February 5, 2008 Thanks for your response Valik.Beta is not compiling Opt() at the moment.Would prefer to have an "Echo($sText)" UDF -- which outputs to the DOS Window, just like the batch command.Has someone done this? Link to comment Share on other sites More sharing options...
Valik Posted February 5, 2008 Share Posted February 5, 2008 Thanks for your response Valik.Beta is not compiling Opt() at the moment.Huh?Would prefer to have an "Echo($sText)" UDF -- which outputs to the DOS Window, just like the batch command.Has someone done this?Sigh. I want to shoot you in the face with a very large gun.For about the millionth time, AutoIt is a Windows application. Windows applications are not connected to the Console from which they are spawned. So the answer is no, you can't output to a console unless you use the beta's option to compile the script as a Console application. Link to comment Share on other sites More sharing options...
Pepinghege Posted February 28, 2008 Share Posted February 28, 2008 For about the millionth time, AutoIt is a Windows application. Windows applications are not connected to the Console from which they are spawned. So the answer is no, you can't output to a console unless you use the beta's option to compile the script as a Console application.If you gave this answer for about the millionth time, I would say that the corresponding question is a really frequently asked question. Why can't it then be found under the FAQs? Or perhaps even in the AutoIt Help. The help sentence "This does not write to a DOS console." could perhaps be supplemented by the hint, that it even is impossible to write to console by design.Sorry for talking back to you, Valik, but I had the same question and it took a long time for me to find your millionth answer above. Link to comment Share on other sites More sharing options...
MHz Posted February 28, 2008 Share Posted February 28, 2008 The help sentence "This does not write to a DOS console." could perhaps be supplemented by the hint, that it even is impossible to write to console by design.The word impossible is bad to say here because someone will prove you wrong most every time. ConsoleWrite() does not show to a CMD prompt unless you pipe with "|more" or compile it as a CLI application as the beta allows or some other method. This is not just about the knowledge of AutoIt but also knowledge of using @ComSpec. A knowledge of using VBScript/JScript helps you with Com and a knowledge of C++ helps you with DllCalls from MSDN. It is a grand mixture that the AutoIt help file will never contain as that information is too diverse into other languages which you and others need to explore. Link to comment Share on other sites More sharing options...
DaveF Posted February 28, 2008 Share Posted February 28, 2008 If you gave this answer for about the millionth time, I would say that the corresponding question is a really frequently asked question. Why can't it then be found under the FAQs?Fair enough question, I've added a post to the end of the FAQ thread on this subject. 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. Link to comment Share on other sites More sharing options...
Pepinghege Posted February 29, 2008 Share Posted February 29, 2008 Thank you, DaveF, for the new FAQ. If the next AutoIt version really has the possibility to compile a script als CLI application (as the current beta v3.2.11) it would be a really nice feature. The fact, that Windows strictly distinguishes between (old) DOS-style programs and "real" Windows programs is quite new for me. I have to admit, that I am an old DOS scripter and use AutoIt to create some neat little tools, which I use in those old-fashioned DOS batches. So I looked for a possibility to give some output to the DOS console in case of errors. Now, that I know about the backgrounds, my scripts can sure live without talking to the console...although I look forward to the new AutoIt version, which perhaps gives me this possibility. Many thanks, anyway, for the explanation. Link to comment Share on other sites More sharing options...
Pepinghege Posted February 29, 2008 Share Posted February 29, 2008 Sorry for re-posting, but I forgot:By the way: the Unix- (or Linux)-like console possibly will befall a rebirth by the release of new Windows Server 2008. Windows Server 2008 comes with the so called "Windows PowerShell". With this new shell it shall be possible to completely control a Windows Server without any GUI. Everything, which could be set up through GUIs shall also be managable with a PowerShell script. And even more, as PowerShell shall get real scripting and even programming language features. Actually it will be possible to install a Windows Server 2008 completely without GUI! After installing just the Windows Server 2008 Server Core, you end up in an "old-fashioned" console window. In fact, the GUIs (which still are accessible after installing a "normal" Windows Server 2008) execute PowerShell scripts, wenn the user clicks with his mouse. Linux and it's KDEs say hello... Link to comment Share on other sites More sharing options...
Innovative Posted February 29, 2008 Share Posted February 29, 2008 I think this should do the job. StdinWrite ( process_id[, string] ) Link to comment Share on other sites More sharing options...
Xenobiologist Posted February 29, 2008 Share Posted February 29, 2008 Compile this: #include<WinAPI.au3> Global $aResult, $hConsole If Not _WinAPI_AttachConsole() Then $ret = DllCall("Kernel32.dll", "long", "AllocConsole") If $ret = 0 Then Exit MsgBox(0, 'EXIT', "No Console allocated!") EndIf $hConsole = _WinAPI_GetStdHandle(1) $hConsoleIn = _WinAPI_GetStdHandle(0) If $hConsole = -1 Then MsgBox(0, "Error", "GetStdHandle failed") Exit EndIf _WinAPI_WriteConsole($hConsole, "Name: ") $test = DllStructCreate("char[10000]") $read = 500 _WinAPI_ReadFile($hConsoleIn, DllStructGetPtr($test), DllStructGetSize($test), $read) MsgBox(0, '', DllStructGetData($test, 1)) If Not _WinAPI_WriteConsole($hConsole, "Hello World" & @CRLF) Then MsgBox(0, "Error", "WriteConsole Failed") EndIf _WinAPI_WriteConsole($hConsole, "PAUSE: Press ENTER ") _WinAPI_ReadFile($hConsoleIn, DllStructGetPtr($test), DllStructGetSize($test), $read) Exit Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times 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