Jump to content

Recommended Posts

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
Posted

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

Posted

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?
Posted

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

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
Posted

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

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
  • 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
  • Recently Browsing   0 members

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