engjcowi Posted October 18, 2010 Share Posted October 18, 2010 (edited) Hi guys Firstly i apologise if this is a dumb question but its late and ive been wrecking my brain. Can anyone point me in the direction to creat an output console so th euser can see exactly whats goin on. I dont know if anyone remembers dvd decrypter but that had an output console that displayed the info on where the program was upto and what is was doing. It just needs to be small but scrollable once completed. Thanks Jamie Edited October 25, 2010 by engjcowi Drunken Frat-Boy Monkey Garbage Link to comment Share on other sites More sharing options...
enaiman Posted October 19, 2010 Share Posted October 19, 2010 EditBox SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
engjcowi Posted October 23, 2010 Author Share Posted October 23, 2010 Hi enaiman Thats for the suggestion. Ive tried creating a form and puttin in an edit box called $comconsole and then used the command GUICtrlSetData($comconsole, "this has updated") to update the information going to the edit box. My problem is that when i use the same command up to add further information such as using a command button it just overwrites whats already there. is there anyway i can tell it to keep whats there and add to a new line only please? Drunken Frat-Boy Monkey Garbage Link to comment Share on other sites More sharing options...
BrewManNH Posted October 23, 2010 Share Posted October 23, 2010 Try this - Untested: GUICtrlSetData($comconsole, GUICtrlRead($comconsole) & "this has updated") If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator Link to comment Share on other sites More sharing options...
Richard Robertson Posted October 23, 2010 Share Posted October 23, 2010 DllCall("kernel32", "int", "AllocConsole") Link to comment Share on other sites More sharing options...
jaberwacky Posted October 23, 2010 Share Posted October 23, 2010 is there anyway i can tell it to keep whats there and add to a new line only please? I use this: GUICtrlSetData($comconsole, "this has updated", ' ') Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
BrewManNH Posted October 23, 2010 Share Posted October 23, 2010 Nice tip jaberwocky, I've never used the default value parameter so I had forgotten about how it works in an edit control. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator Link to comment Share on other sites More sharing options...
engjcowi Posted October 23, 2010 Author Share Posted October 23, 2010 Jaberwocky thanks very much i didnt see that myself lol. All is now right with thte world and working and ive included an example below in case anyone would like to see. expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) #Region ### START Koda GUI section ### Form= $Form2 = GUICreate("Form2", 658, 386, 302, 218) GUISetOnEvent($GUI_EVENT_CLOSE, "Form2Close") GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form2Minimize") GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form2Maximize") GUISetOnEvent($GUI_EVENT_RESTORE, "Form2Restore") $Edit1 = GUICtrlCreateEdit("", 24, 48, 353, 217) GUICtrlSetData(-1, "Edit1" & @CRLF) GUICtrlSetOnEvent(-1, "Edit1Change") $Button1 = GUICtrlCreateButton("Button1", 160, 304, 153, 41, 0) GUICtrlSetOnEvent(-1, "Button1Click") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Sleep(100) WEnd Func Button1Click() GUICtrlSetData($edit1, "this has updated" & @CRLF, ' ') EndFunc Func Edit1Change() EndFunc Func Form2Close() exit EndFunc Func Form2Maximize() EndFunc Func Form2Minimize() EndFunc Func Form2Restore() EndFunc Drunken Frat-Boy Monkey Garbage Link to comment Share on other sites More sharing options...
engjcowi Posted October 24, 2010 Author Share Posted October 24, 2010 Hi sorry to be a pain. Ive created the following program using the bits of code above to run mkisofs. Ther is 2 attempts below, 1 is readt to run, the other is blocked by #cs and #ce so just delete the other whilw wend loop then use the commented out 1 to try. The problem is that i use ctupdate in the directory which has lots of lists with long fielnames and after a very short period the the output just stops (see attached pic) but the program continues behind the scenes. If i remove the folder containing the files then it reads the percentage fine. Is there a limit to the information a edit box can contain? Hope someone can help Thanks expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <Constants.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) #Region ### START Koda GUI section ### Form= $Form2 = GUICreate("Form2", 623, 451, 323, 153) GUISetOnEvent($GUI_EVENT_CLOSE, "Form2Close") $Button1 = GUICtrlCreateButton("Exit", 176, 360, 265, 73, 0) GUICtrlSetOnEvent(-1, "Button1Click") $Comconsole = GUICtrlCreateEdit("Console", 56, 32, 529, 297, $ES_AUTOVSCROLL + $WS_VSCROLL) GUICtrlSetData(-1, "Comconsole") GUICtrlSetOnEvent(-1, "ComconsoleChange") $Label1 = GUICtrlCreateLabel("ISO CREATION ", 264, 8, 83, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### FileChangeDir(@ScriptDir & "\files\") #cs $pid = Run('mkisofs.exe -l -J -r -V "APHC" -o "' & @DesktopDir & '\APHC.iso" ' & '"' & @ScriptDir & '"', "", @SW_hide, 0x8) ; 0x8 = $STDERR_MERGED (StdOutRead receives Stdout and stderr) $sOutput = '' While 1 Sleep(50) $sRead = StdoutRead($pid) If @error <> 0 Then ExitLoop $sOutput &= $sRead ;oolTip($sOutput) GUICtrlSetData($Comconsole, $sOutput, ' ') WEnd StdioClose($pid) ToolTip("") MsgBox(0, 'Finished', $sOutput) #ce $foo = Run('mkisofs.exe -l -J -r -V "APHC" -o"' & @DesktopDir & '\APHC.iso" ' & '"' & @ScriptDir & '"', "", @SW_Hide, $STDERR_CHILD + $STDOUT_CHILD) While 1 $line = StderrRead($foo) If @error Then ExitLoop $message = "" $message = $line GUICtrlSetData($Comconsole, $message, ' ') Wend MsgBox(0, 'ISO Created', $message) StdioClose($line) Func Button1Click() ProcessClose("mkisofs.exe") exit EndFunc Func ComconsoleChange() EndFunc Func Form2Close() ProcessClose("mkisofs.exe") exit EndFunc Drunken Frat-Boy Monkey Garbage Link to comment Share on other sites More sharing options...
enaiman Posted October 24, 2010 Share Posted October 24, 2010 (edited) Add this line, after you create the edit box: GUICtrlSetLimit(-1, 9999999) @RichardRobertson How about an UDF around that? Edited October 24, 2010 by enaiman SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
Richard Robertson Posted October 25, 2010 Share Posted October 25, 2010 Why do you need a UDF? It's a single line. After you allocate it, you just use ConsoleWrite to send data to it. Link to comment Share on other sites More sharing options...
engjcowi Posted October 25, 2010 Author Share Posted October 25, 2010 @Enaiman Thanks thats done the trick. Richard Robertson - i never knew that either thanks Drunken Frat-Boy Monkey Garbage Link to comment Share on other sites More sharing options...
enaiman Posted October 25, 2010 Share Posted October 25, 2010 @RichardRobertsonWhy do you need a UDF? It's a single line. After you allocate it, you just use ConsoleWrite to send data to it. So simple? - wow, I do need to have a closer look at that Thanks alot. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
Ascend4nt Posted October 25, 2010 Share Posted October 25, 2010 Hmm, I too was curious about this one-API-call-does-it-all, so I tested it out. But alas, it doesn't work with ConsoleWrite. Here's the way I got it to work for me: DllCall("kernel32.dll","bool","AllocConsole") $hConsole=DllCall("kernel32.dll","handle","GetStdHandle","int",-11) ConsoleWrite("Console handle:"&$hConsole[0]&", Error:"&@error&@CRLF) $aRet=DllCall("kernel32.dll","bool","WriteConsoleW","handle",$hConsole[0],"wstr","Testing123","dword",10,"dword*",0,"ptr",0) MsgBox(0,"see any consoles?","look harder!") Note that WriteConsole must be called with a handle retrieved through GetStdHandle, and the program must not be run from SciTE (otherwise you won't get a valid handle). bs27975 1 My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs |Â Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) |Â Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
enaiman Posted October 25, 2010 Share Posted October 25, 2010 @Ascend4nt Thank you very much for your input. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
Richard Robertson Posted October 26, 2010 Share Posted October 26, 2010 Well I've never tried using the console with AutoIt. I just knew the function. Link to comment Share on other sites More sharing options...
bs27975 Posted May 21, 2019 Share Posted May 21, 2019 On 10/25/2010 at 6:37 PM, Ascend4nt said:  DllCall("kernel32.dll","bool","AllocConsole") $hConsole=DllCall("kernel32.dll","handle","GetStdHandle","int",-11) ConsoleWrite("Console handle:"&$hConsole[0]&", Error:"&@error&@CRLF) $aRet=DllCall("kernel32.dll","bool","WriteConsoleW","handle",$hConsole[0],"wstr","Testing123","dword",10,"dword*",0,"ptr",0) MsgBox(0,"see any consoles?","look harder!")  Nice! Thank you. Cut, Paste, Done. Except ... How to know when (not) running running within SciTE, to know to (not) call this? i.e. Make console output / debugging establishment fire and forget regardless of the environment of the time. - permitting one to just ConsoleWrite "away" trusting it will always be displayed appropriately. Link to comment Share on other sites More sharing options...
jchd Posted May 21, 2019 Share Posted May 21, 2019 Easy: Global $CW = @Compiled ? _ConsoleWrite : ConsoleWrite Func _ConsoleWrite(ByRef $s) Local Static $hCon = __ConsoleInit() DllCall("kernel32.dll", "bool", "WriteConsoleW", "handle", $hCon, "wstr", $s, "dword", StringLen($s), "dword*", 0, "ptr", 0) Return EndFunc Func __ConsoleInit() DllCall("kernel32.dll", "bool", "AllocConsole") Return DllCall("kernel32.dll", "handle", "GetStdHandle", "int", -11) EndFunc For $i = 1 to 10 $cw($i & " - Hello world!" & @LF) Next Just invoke $CW($string_to_be_displayed) when needed. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) 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