TerarinK Posted March 21, 2009 Share Posted March 21, 2009 First your writing to the autoit screen and that is it, even if you execute it from the command line ConsoleWrite doesn't work that way. 0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E Link to comment Share on other sites More sharing options...
KaFu Posted March 21, 2009 Share Posted March 21, 2009 ConsoleWrite doesn't work that way.Yes it does, but you have to compile the script as a CUI (command line user-interface), right click 'compile with options'. OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
monoceres Posted March 21, 2009 Share Posted March 21, 2009 Here's a better way to clear the console (when running in cmd.exe that is) Global Const $STD_OUTPUT_HANDLE = 2^32-11 Global Const $CONSOLE_SCREEN_BUFFER_INFO = "short dwSizeX;short dwSizeY;short dwCursorPositionX;short dwCursorPositionY;" & _ "ushort wAttributes;short srWindowLeft;short srWindowTop;short srWindowRight;short srWindowBottom;" & _ "short dwMaximumWindowSizeX;short dwMaximumWindowSizeY;" Func _ClearConsole() $hConsole = DllCall("Kernel32.dll", "ptr", "GetStdHandle", "dword", $STD_OUTPUT_HANDLE) $hConsole = $hConsole[0] $csbi = DllStructCreate($CONSOLE_SCREEN_BUFFER_INFO) $call = DllCall("Kernel32.dll", "int", "GetConsoleScreenBufferInfo", "ptr", $hConsole, "ptr", DllStructGetPtr($csbi)) $call = DllCall("Kernel32.dll", "int", "FillConsoleOutputCharacterW", "ptr", $hConsole, "short", 0, _ "dword", DllStructGetData($csbi, "dwSizeX") * DllStructGetData($csbi, "dwSizeY"), "dword", 0, "dword*", 0) $call = DllCall("Kernel32.dll", "int", "CloseHandle", "ptr", $hConsole) EndFunc ;==>_ClearConsole Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
martin Posted March 21, 2009 Share Posted March 21, 2009 Here's a better way to clear the console (when running in cmd.exe that is) Global Const $STD_OUTPUT_HANDLE = 2^32-11 Global Const $CONSOLE_SCREEN_BUFFER_INFO = "short dwSizeX;short dwSizeY;short dwCursorPositionX;short dwCursorPositionY;" & _ "ushort wAttributes;short srWindowLeft;short srWindowTop;short srWindowRight;short srWindowBottom;" & _ "short dwMaximumWindowSizeX;short dwMaximumWindowSizeY;" Func _ClearConsole() $hConsole = DllCall("Kernel32.dll", "ptr", "GetStdHandle", "dword", $STD_OUTPUT_HANDLE) $hConsole = $hConsole[0] $csbi = DllStructCreate($CONSOLE_SCREEN_BUFFER_INFO) $call = DllCall("Kernel32.dll", "int", "GetConsoleScreenBufferInfo", "ptr", $hConsole, "ptr", DllStructGetPtr($csbi)) $call = DllCall("Kernel32.dll", "int", "FillConsoleOutputCharacterW", "ptr", $hConsole, "short", 0, _ "dword", DllStructGetData($csbi, "dwSizeX") * DllStructGetData($csbi, "dwSizeY"), "dword", 0, "dword*", 0) $call = DllCall("Kernel32.dll", "int", "CloseHandle", "ptr", $hConsole) EndFunc ;==>_ClearConsole Have a look at post #15, you need to add a lot more lines to compete with Rover. 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 More sharing options...
monoceres Posted March 21, 2009 Share Posted March 21, 2009 Have a look at post #15, you need to add a lot more lines to compete with Rover.Oh, I totally missed Rover's post Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
Draygoes Posted March 21, 2009 Author Share Posted March 21, 2009 But I still dont understand why my method works so well. You would think that using the run command would start a NEW instance of cmd, not send commands to the currently open one. It just doesnt make sence. Spoiler "If a vegetarian eats vegetables,What the heck does a humanitarian eat?" "I hear voices in my head, but I ignore them and continue on killing." "You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring." An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist. Link to comment Share on other sites More sharing options...
monoceres Posted March 21, 2009 Share Posted March 21, 2009 But I still dont understand why my method works so well.You would think that using the run command would start a NEW instance of cmd, not send commands to the currently open one. It just doesnt make sence.It's very simple, you can even write cls.exe for yourself. What it does is attaching to the console of the parent process (which in this case is your script) and then use a method similar to Rover's and mine. Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
Draygoes Posted March 22, 2009 Author Share Posted March 22, 2009 Ah I see. Thank you. Spoiler "If a vegetarian eats vegetables,What the heck does a humanitarian eat?" "I hear voices in my head, but I ignore them and continue on killing." "You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring." An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist. 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