Guest Mixture63 Posted December 31, 2005 Share Posted December 31, 2005 (edited) OK, I know I shouldn't keep posting these new topics but now I am not going to make new ones for the plug in for a long time I promise. This is the combined plugin of the console plugin and the buffer plugin with a few extra functions. I requested that a moderator delete the other topics. (Thanx JPM) Now, I know that these things can probably be done with DLL call but I am providing an alternative API that is more convient than DLL call but at the price of having a seperate DLL. This DLL will grow to extend AutoIt's functionality in the near future. I intend to implement things that you cannot do with AutoIt alone. As soon as Jon implements callbacks for the plugins, you can be rest assured that multithreading will be made possible through this plugin, but not now. Here is the plugin. From now on, (For a while) I will just update this topic when I have updates I promise. But when this topic has gone far off and ignored, I will create a new one. That will take weeks. nfwu's include script for the plugin is here too.Mx63.zipAu3Console.au3 Edited December 31, 2005 by Mixture63 Link to comment Share on other sites More sharing options...
theguy0000 Posted January 16, 2006 Share Posted January 16, 2006 cool, ive wanted one of these. The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
cppman Posted February 24, 2006 Share Posted February 24, 2006 where is Au3Console.dll? Miva OS Project Link to comment Share on other sites More sharing options...
nfwu Posted February 24, 2006 Share Posted February 24, 2006 (edited) In the zip folder: Mx63.zip Edited February 24, 2006 by nfwu TwitterOut of date stuff:Scripts: Sudoku Solver | Webserver | 3D library (Pure AutoIt) | Wood's GadgetsUDFs: _WoodUniqueID() | _DialogEditIni() | _Console*() | _GetIPConfigData() | _URLEncode/Decode() Link to comment Share on other sites More sharing options...
cppman Posted February 24, 2006 Share Posted February 24, 2006 (edited) Their is only, Mx63.dll , is that the Au3Console.dll file? do i need to rename it or soemthing? Edited February 24, 2006 by CHRIS95219 Miva OS Project Link to comment Share on other sites More sharing options...
cppman Posted February 24, 2006 Share Posted February 24, 2006 okay... im confused. how do i set this up? Miva OS Project Link to comment Share on other sites More sharing options...
nfwu Posted February 24, 2006 Share Posted February 24, 2006 Fine, i'll explain. First line of the file you are going to use this, you put: (u need mx63.dll in the same directory as the au3 file or exe.) PluginOpen ( "MX63.dll" ) Then you can use these functions: ConsoleLoad($Title) - Loads a console window. ConsoleFree() - Frees the console. ConsoleInput($nBytes) - Prompts the user in the conse window, and then returns the string. ConsolePrint($String) - Prints a string to the console window. some useful functions you could use: (most are in au3console.au3) expandcollapse popup;=============================================================================== ; ; Description: : A list of colour values for the console ; Requirement: : AutoIt Console Plugin - By: Mixture63 (Au3Console.dll) ; Note(s): : $CC_* stands for console color * ; For use with ConsoleSetColours and ConsoleSetColor ; ;=============================================================================== Global Const $CC_BLACK = 0 Global Const $CC_DARKBLUE = 1 Global Const $CC_DARKGREEN = 2 Global Const $CC_DARKBLUEGREEN = 3 Global Const $CC_DARKBROWN = 4 Global Const $CC_PURPLE = 5 Global Const $CC_BROWN = 6 Global Const $CC_GREY = 7 Global Const $CC_DARKGREY = 8 Global Const $CC_BLUE = 9 Global Const $CC_GREEN = 10 Global Const $CC_BLUEGREEN = 11 Global Const $CC_RED = 12 Global Const $CC_PINK = 13 Global Const $CC_YELLOW = 14 Global Const $CC_WHITE = 15 ;=============================================================================== ; ; Description: : Sets the colors of a "console" ; Parameter(s): : $fg - Foreground Color ; $bg - Background Color ; Requirement: : mx63.dll ; Return Value(s): : n/a ; Author(s): : nfwu ; Note(s): : Notice the 's' in the name... colors. ; ;=============================================================================== Func ConsoleSetColors($fg, $bg) ConsoleSetColor($fg+$bg*16) EndFunc ;=============================================================================== ; ; Description: : Prints a line to the "console" followed by a @CRLF ; Parameter(s): : $data - The data to print ; Requirement: : mx63.dll ; Return Value(s): : n/a ; Author(s): : nfwu ; Note(s): : You cannot use ConsoleClearCurrentLine to clear data ; printed by this as it positions the cursor at a new line ; after printing. ; ;=============================================================================== Func ConsolePrintLine($data) ConsolePrint($data&@CRLF) EndFunc ;=============================================================================== ; ; Description: : Reads a line of input from the "console" ; Parameter(s): : - ; Requirement: : mx63.dll ; Return Value(s): : The line that is read from the console ; Author(s): : nfwu ; ;=============================================================================== Func ConsoleInputLine() Local $ret_val = "" Local $data = ConsoleInput(1) While $data <> @CR $ret_val &= $data $data = ConsoleInput(1) WEnd ConsoleInput(1);;Get rid of the LineFeed (@LF) Return $ret_val EndFunc TwitterOut of date stuff:Scripts: Sudoku Solver | Webserver | 3D library (Pure AutoIt) | Wood's GadgetsUDFs: _WoodUniqueID() | _DialogEditIni() | _Console*() | _GetIPConfigData() | _URLEncode/Decode() Link to comment Share on other sites More sharing options...
cppman Posted February 24, 2006 Share Posted February 24, 2006 ah. i see. thanks! I was'nt sure how to do that.. i appreciate it Miva OS Project Link to comment Share on other sites More sharing options...
cppman Posted February 24, 2006 Share Posted February 24, 2006 This is pretty nice. good job! Miva OS Project Link to comment Share on other sites More sharing options...
theguy0000 Posted February 25, 2006 Share Posted February 25, 2006 what exactly is wrong here? #include <Console.au3> $plugin = PluginOpen ( "C:\Program Files\AutoIt3\beta\include\MX63.dll" ) ConsoleLoad("hi") ConsoleFree() println("Hello. What is your name?") $input = ConsoleInputLine() println("Hi there, "&$input) PluginClose($plugin) When I run it, it just sits there and does nothing...no errors, nothing. it doesnt exit until I tell it to. What have I done wrong? The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
cppman Posted February 25, 2006 Share Posted February 25, 2006 o, i see what ur saying... yeah, it just exits the cmd console, and then sits in the tray... Miva OS Project Link to comment Share on other sites More sharing options...
nfwu Posted February 25, 2006 Share Posted February 25, 2006 (edited) Simple Error:#include <Console.au3>$plugin = PluginOpen ( "C:\Program Files\AutoIt3\beta\include\MX63.dll" )ConsoleLoad("hi")ConsoleFree() <-- ERROR: This Frees the consoleprintln("Hello. What is your name?")$input = ConsoleInputLine()println("Hi there, "&$input)PluginClose($plugin)Do this instead:#include <Console.au3> ;~ Open Console $plugin = PluginOpen ( "C:\Program Files\AutoIt3\beta\include\MX63.dll" ) ConsoleLoad("hi") ;~ Do Stuff ConsolePrintLine("Hello. What is your name?") $input = ConsoleInputLine() ConsolePrintLine("Hi there, "&$input) Sleep(5000);Sleep for 5 seconds to let user see output. ;~ Close Console ConsoleFree() PluginClose($plugin)#) Edited February 25, 2006 by nfwu TwitterOut of date stuff:Scripts: Sudoku Solver | Webserver | 3D library (Pure AutoIt) | Wood's GadgetsUDFs: _WoodUniqueID() | _DialogEditIni() | _Console*() | _GetIPConfigData() | _URLEncode/Decode() Link to comment Share on other sites More sharing options...
cppman Posted February 25, 2006 Share Posted February 25, 2006 but would'nt that still only close the CONSOLE and not the actual program? Miva OS Project Link to comment Share on other sites More sharing options...
nfwu Posted February 26, 2006 Share Posted February 26, 2006 (edited) Once the code reaches the end of the file, the program is automatically closed. The reason why the previous version did not close was because he had put ConsoleInputLine() after freeing the console, causing it to end up in and infinite loop and not reciving any input. If you still insist, add an explict "Exit" at the end of the application #include <Au3Console.au3> ;~ Open Console $plugin = PluginOpen ( "MX63.dll" ) ;;Mx63.dll must be in same directory and script/exe!!!!! ConsoleLoad("hi") ;~ Do Stuff ConsolePrintLine("Hello. What is your name?") $input = ConsoleInputLine() ConsolePrintLine("Hi there, "&$input) Sleep(5000);Sleep for 5 seconds to let user see output. ;~ Close Console ConsoleFree() PluginClose($plugin) Exit EDIT: typo #) Edited February 26, 2006 by nfwu TwitterOut of date stuff:Scripts: Sudoku Solver | Webserver | 3D library (Pure AutoIt) | Wood's GadgetsUDFs: _WoodUniqueID() | _DialogEditIni() | _Console*() | _GetIPConfigData() | _URLEncode/Decode() Link to comment Share on other sites More sharing options...
theguy0000 Posted February 26, 2006 Share Posted February 26, 2006 (edited) ok, this just isnt working for me. expandcollapse popup;~ Open Console $plugin = PluginOpen ( "C:\Program Files\AutoIt3\beta\include\MX63.dll" ) ConsoleLoad("hi") ;~ Do Stuff println("Hello. What is your name?") $input = getln() println("Hi there, "&$input) Sleep(5000);Sleep for 5 seconds to let user see output. ;~ Close Console ConsoleFree() ;=============================================================================== ; ; Description: : A list of colour values for the console ; Requirement: : AutoIt Console Plugin - By: Mixture63 (MX63.dll) ; Note(s): : $CC_* stands for console color * ; I'm red-green color blind, so some names may be wrong ; For use with ConsoleSetColours and ConsoleSetColor ; ;=============================================================================== Global Const $CC_BLACK = 0 Global Const $CC_DARKBLUE = 1 Global Const $CC_DARKGREEN = 2 Global Const $CC_DARKBLUEGREEN = 3 Global Const $CC_DARKBROWN = 4 Global Const $CC_PURPLE = 5 Global Const $CC_BROWN = 6 Global Const $CC_GREY = 7 Global Const $CC_DARKGREY = 8 Global Const $CC_BLUE = 9 Global Const $CC_GREEN = 10 Global Const $CC_BLUEGREEN = 11 Global Const $CC_RED = 12 Global Const $CC_PINK = 13 Global Const $CC_YELLOW = 14 Global Const $CC_WHITE = 15 ;=============================================================================== ; ; Description: : Sets the colors of a "console" ; Parameter(s): : $fg - Foreground Color ; $bg - Background Color ; Requirement: : AutoIt Console Plugin - By: Mixture63 (MX63.dll) ; Return Value(s): : n/a ; Author(s): : nfwu ; Note(s): : Notice the 's' in the name... colors. ; ;=============================================================================== Func ConsoleSetColors($fg, $bg) ConsoleSetColor($fg+$bg*16) EndFunc ;=============================================================================== ; ; Description: : Prints a string of text to the "console" ; Parameter(s): : $data - The data to print ; Requirement: : AutoIt Console Plugin - By: Mixture63 (MX63.dll) ; Return Value(s): : n/a ; Author(s): : nfwu ; Note(s): : None. ; ;=============================================================================== Func echo($data) ConsolePrint($data) EndFunc ;=============================================================================== ; ; Description: : Prints a line to the "console" followed by a @CRLF ; Parameter(s): : $data - The data to print ; Requirement: : AutoIt Console Plugin - By: Mixture63 (MX63.dll) ; Return Value(s): : n/a ; Author(s): : nfwu ; Note(s): : You cannot use ConsoleClearCurrentLine to clear data ; printed by this as it positions the cursor at a new line ; after printing. ; ;=============================================================================== Func println($data) ConsolePrint($data&@CRLF) EndFunc ;=============================================================================== ; ; Description: : Reads a line of input from the "console" ; Parameter(s): : - ; Requirement: : AutoIt Console Plugin - By: Mixture63 (MX63.dll) ; Return Value(s): : The line that is read from the console ; Author(s): : nfwu ; Note(s): : - ; ;=============================================================================== Func getln() Local $ret_val = "" Local $data = ConsoleInput(1) While $data <> @CR $ret_val &= $data $data = ConsoleInput(1) WEnd ConsoleInput(1);;Get rid of the LineFeed (@LF) Return $ret_val EndFunc ;=============================================================================== ; ; Description: : Clears the current line the cursor is on in the "console" ; Parameter(s): : - ; Requirement: : AutoIt Console Plugin - By: Mixture63 (MX63.dll) ; Return Value(s): : n/a ; Author(s): : nfwu ; Note(s): : You can only clear what you printed to the console if you ; used ConsolePrint and did not have any @CR, @LF or @CRLF ; in the output. ; ;=============================================================================== Func io_clearln() For $i = 1 To 100 ConsolePrint( Chr(8) ) Next For $i = 1 To 100 ConsolePrint( " " ) Next For $i = 1 To 100 ConsolePrint( Chr(8) ) Next EndFunc ;=============================================================================== ; ; Description: : Clears the "console" by restarting it. ; Parameter(s): : $t - the title of the "console" window ; Requirement: : AutoIt Console Plugin - By: Mixture63 (MX63.dll) ; Return Value(s): : n/a ; Author(s): : nfwu ; Note(s): : - ; ;=============================================================================== Func io_clear($t) ConsoleFree() ConsoleLoad($t) EndFunc PluginClose($plugin) (as you can see, I renamed most of the functions) It just does nothing and doesnt close until I quit the process... edit: it doesnt recognize any console*() functions, but I am positive that the dll exists... Edited February 26, 2006 by theguy0000 The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
nfwu Posted February 26, 2006 Share Posted February 26, 2006 expandcollapse popup;~ Open Console $plugin = PluginOpen ( "C:\Program Files\AutoIt3\beta\include\MX63.dll" ) ConsoleLoad("hi") ;~ Do Stuff println("Hello. What is your name?") $input = getln() println("Hi there, "&$input) Sleep(5000);Sleep for 5 seconds to let user see output. ;~ Close Console ConsoleFree() Global Const $CC_BLACK = 0 Global Const $CC_DARKBLUE = 1 Global Const $CC_DARKGREEN = 2 Global Const $CC_DARKBLUEGREEN = 3 Global Const $CC_DARKBROWN = 4 Global Const $CC_PURPLE = 5 Global Const $CC_BROWN = 6 Global Const $CC_GREY = 7 Global Const $CC_DARKGREY = 8 Global Const $CC_BLUE = 9 Global Const $CC_GREEN = 10 Global Const $CC_BLUEGREEN = 11 Global Const $CC_RED = 12 Global Const $CC_PINK = 13 Global Const $CC_YELLOW = 14 Global Const $CC_WHITE = 15 Func ConsoleSetColors($fg, $bg) ConsoleSetColor($fg+$bg*16) EndFunc Func echo($data) ConsolePrint($data) EndFunc Func println($data) ConsolePrint($data&@CRLF) EndFunc Func getln() Local $ret_val = "" Local $data = ConsoleInput(1) While $data <> @CR $ret_val &= $data $data = ConsoleInput(1) WEnd ConsoleInput(1);;Get rid of the LineFeed (@LF) Return $ret_val EndFunc Func io_clearln() For $i = 1 To 100 ConsolePrint( Chr(8) ) Next For $i = 1 To 100 ConsolePrint( " " ) Next For $i = 1 To 100 ConsolePrint( Chr(8) ) Next EndFunc Func io_clear($t) ConsoleFree() ConsoleLoad($t) EndFunc PluginClose($plugin) Did you put mx63.dll into "C:\Program Files\AutoIt3\beta\include\MX63.dll"? TwitterOut of date stuff:Scripts: Sudoku Solver | Webserver | 3D library (Pure AutoIt) | Wood's GadgetsUDFs: _WoodUniqueID() | _DialogEditIni() | _Console*() | _GetIPConfigData() | _URLEncode/Decode() Link to comment Share on other sites More sharing options...
mikeytown2 Posted February 26, 2006 Share Posted February 26, 2006 This will not work for me if i run it out of SciTe. Beta Compile it and then run the exe. Thats how i got this to work. This is all you need, to get the idea on how this works. Compile this code into an exe using the latest beta. Have MX63.dll in the same dir as the compiled exe. ;~ Open Console $plugin = PluginOpen ( "MX63.dll" ) ConsoleLoad("hi") ;~ Do Stuff println("Hello. What is your name?") ToolTip("Waiting for input from keyboard") $input = getln() println("Hi there, "&$input) ToolTip("Sleep for 5 seconds") Sleep(5000);Sleep for 5 seconds to let user see output. ;~ Close Console Func println($data) ConsolePrint($data&@CRLF) EndFunc Func getln() Local $ret_val = "" Local $data = ConsoleInput(1) While $data <> @CR $ret_val &= $data $data = ConsoleInput(1) WEnd ConsoleInput(1);;Get rid of the LineFeed (@LF) Return $ret_val EndFunc PluginClose($plugin) If you try to run this from scite it will take 100% of your cpu and the black console window will never pop up. Compile it to an exe! Email: POP3 & SMTP using SSL/TLS (OpenSSL)Email: IMAPEmail: Base64 & SMTP login & Send email direct to MX Server (thanks blindwig)Win: Hook Registry ChangesWin: Read/Write to Alternate Data Streams (ini example)Utility: GPS Distance Calculations, Vincenty and Haversine formulas; angles and elevationUtility: Dell Laser Printer (3000-5100) - Print LoggerUtility: Reset Router when Wireless Link FailsUtility: ImageMagick Batch jpg ProcessorVideo HCenc Batch FrontendVideo: *DEAD* YouTube Video Encoder (avs/avi to flv)Software On CD's I Like<<back|track3 Ultimate Boot CD for Windows SpinRite Ubuntu ophcrack Link to comment Share on other sites More sharing options...
theguy0000 Posted February 26, 2006 Share Posted February 26, 2006 I KNOW! it doesnt work when you run it from SCiTE because of SCiTE's StdOut! the exact same script works when i run it direct from autoit but not from SCiTE. The only explaination that I can possibly think of is that SCiTE's StdOut is causing the problems. The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
jaenster Posted February 26, 2006 Share Posted February 26, 2006 (edited) My windows xp blocks the progam Please tell Microsoft about this problem. Edit : Found it , dont work if you start it from scite , nice progam Edited February 26, 2006 by jaenster -jaenster Link to comment Share on other sites More sharing options...
DaveF Posted February 26, 2006 Share Posted February 26, 2006 If you try to run this from scite it will take 100% of your cpu and the black console window will never pop up. Compile it to an exe!SciTE is/has a console, and when you run a script from SciTE the child AutoIt3.exe process inherits connection to that console. Knowing that and that AllocConsole fails if the calling process already has a console, I'm guessing that the problem here is that the plugin doesn't recover properly if its call to AllocConsole fails. 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...
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