Sign in to follow this  
Followers 0
Guest Mixture63

Mx63.dll - Combine Plugin

23 posts in this topic

#1 ·  Posted (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.zip

Au3Console.au3

Edited by Mixture63

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Their is only, Mx63.dll , is that the Au3Console.dll file? do i need to rename it or soemthing?

Edited by CHRIS95219

Share this post


Link to post
Share on other sites

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)

;===============================================================================
;
; 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

Share this post


Link to post
Share on other sites

ah. i see. thanks! I was'nt sure how to do that.. i appreciate it

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

o, i see what ur saying... yeah, it just exits the cmd console, and then sits in the tray...

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Simple Error:

#include <Console.au3>

$plugin = PluginOpen ( "C:\Program Files\AutoIt3\beta\include\MX63.dll" )

ConsoleLoad("hi")

ConsoleFree() <-- ERROR: This Frees the console

println("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 by nfwu

Share this post


Link to post
Share on other sites

but would'nt that still only close the CONSOLE and not the actual program?

Share this post


Link to post
Share on other sites

#14 ·  Posted (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 by nfwu

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

ok, this just isnt working for me.

;~ 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 by theguy0000

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites

;~ 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"?

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#19 ·  Posted (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 :o

Edited by jaenster

-jaenster

Share this post


Link to post
Share on other sites

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.

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