Sign in to follow this  
Followers 0
LiveOnTheFly

[Plugin]SetConsoleColor

10 posts in this topic

#1 ·  Posted (edited)

This is my first contribution to the autoit forums. It allows you to set the console color of a CUI program like some dos programs do.

Example:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Change2CUI=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
$p = PluginOpen("setconsolecolor.dll")
$number = InputBox("Number","Number go to: 0-enter here",255)
$number = Number($number)
for $i = 1 to $number
    setconsolecolor($i)
    ConsoleWrite($i & " ")
    sleep(10)
Next
MsgBox(0,"","Done!")
PluginClose($p)

If you put the number above 255 it will just keep repeating the colors

DLL is attached in the zipfile

setconsolecolor.zip

source.zip

Edited by LiveOnTheFly

Share this post


Link to post
Share on other sites



I get an error:

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /prod /in "C:\Coding\Scripts\AU3\Console\SetConsoleColor\SetConsoleColor.au3" /autoit3dir "C:\Program Files\AutoIt3"

+>19:42:51 Starting AutoIt3Wrapper v.2.0.0.0 Environment(Language:0409 Keyboard:00000407 OS:WIN_VISTA/ CPU:X86)

>Running AU3Check (1.54.14.0) from:C:\Program Files\AutoIt3

C:\Coding\Scripts\AU3\Console\SetConsoleColor\SetConsoleColor.au3(9,20) : ERROR: setconsolecolor(): undefined function.

setconsolecolor($i)

~~~~~~~~~~~~~~~~~~^

C:\Coding\Scripts\AU3\Console\SetConsoleColor\SetConsoleColor.au3 - 1 error(s), 0 warning(s)

!>19:42:51 AU3Check ended.rc:2

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

I get an error:

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /prod /in "C:\Coding\Scripts\AU3\Console\SetConsoleColor\SetConsoleColor.au3" /autoit3dir "C:\Program Files\AutoIt3"

+>19:42:51 Starting AutoIt3Wrapper v.2.0.0.0 Environment(Language:0409 Keyboard:00000407 OS:WIN_VISTA/ CPU:X86)

>Running AU3Check (1.54.14.0) from:C:\Program Files\AutoIt3

C:\Coding\Scripts\AU3\Console\SetConsoleColor\SetConsoleColor.au3(9,20) : ERROR: setconsolecolor(): undefined function.

setconsolecolor($i)

~~~~~~~~~~~~~~~~~~^

C:\Coding\Scripts\AU3\Console\SetConsoleColor\SetConsoleColor.au3 - 1 error(s), 0 warning(s)

!>19:42:51 AU3Check ended.rc:2

UEZ

Did you have the dll and the script in the same folder?

Share this post


Link to post
Share on other sites

Did you have the dll and the script in the same folder?

Yes of course!

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Yes of course!

UEZ

Oh wait I just reread your error. Just click Continue. AutoitWrapper cant detect plugins.

Share this post


Link to post
Share on other sites

This way it is working but how can you save the console state before printing out the characters? Because when the loop is finished the prompt is not the initial prompt (color)?

Is there any description of the DLL?

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

This way it is working but how can you save the console state before printing out the characters? Because when the loop is finished the prompt is not the initial prompt (color)?

Is there any description of the DLL?

UEZ

default color is 15(white text black background)

What do yuo mean by description of the DLL?(oh wait I forgot to post source silly me I'll do that in a sec)

Edit: there. Source available from first post

Edited by LiveOnTheFly

Share this post


Link to post
Share on other sites

default color is 15(white text black background)

What do yuo mean by description of the DLL?(oh wait I forgot to post source silly me I'll do that in a sec)

Edit: there. Source available from first post

I've a different default console :D

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

I've a different default console :D

UEZ

hmm I dont know then.

Edit: oh wait. Default color is 8 not 15. 8 is grey text with black bg

Edited by LiveOnTheFly

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Very nice, exactly what im looking for. Would be nice to see a UDF for this.

Edited by Warmonger

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