Jump to content

[Plugin]SetConsoleColor


LiveOnTheFly
 Share

Recommended Posts

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
Link to comment
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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
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?
Link to comment
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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
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

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
Link to comment
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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

  • 2 years later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...