112 lines
5.2 KiB
AutoIt
112 lines
5.2 KiB
AutoIt
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
|
|
#AutoIt3Wrapper_Change2CUI=y
|
|
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
|
|
;Dos Farb Test 2
|
|
;2011 BLinz
|
|
#Include <WinAPI.au3>
|
|
|
|
Local Const $FOREGROUND_BLUE = 0x1
|
|
Local Const $FOREGROUND_GREEN = 0x2
|
|
Local Const $FOREGROUND_RED = 0x4
|
|
Local Const $BACKGROUND_BLUE = 0x10
|
|
Local Const $BACKGROUND_GREEN = 0x20
|
|
Local Const $BACKGROUND_RED = 0x40
|
|
Local Const $BACKGROUND_INTENSITY = 0x80
|
|
Local Const $BACKGROUND_SEARCH = 0x20
|
|
Local Const $FOREGROUND_INTENSITY = 0x8
|
|
Local Const $FOREGROUND_SEARCH = 0x10
|
|
Local Const $ENABLE_LINE_INPUT = 0x2
|
|
Local Const $ENABLE_ECHO_INPUT = 0x4
|
|
Local Const $ENABLE_MOUSE_INPUT = 0x10
|
|
Local Const $ENABLE_PROCESSED_INPUT = 0x1
|
|
Local Const $ENABLE_WINDOW_INPUT = 0x8
|
|
Local Const $ENABLE_PROCESSED_OUTPUT = 0x1
|
|
Local Const $ENABLE_WRAP_AT_EOL_OUTPUT = 0x2
|
|
Local Const $STD_OUTPUT_HANDLE = -11
|
|
Local Const $STD_INPUT_HANDLE = -10
|
|
Local Const $STD_ERROR_HANDLE = -12
|
|
;Local Const $INVALID_HANDLE_VALUE = -1
|
|
|
|
;Danke an BugFix für die obigen Werte aus seiner Console.au3 -> http://www.autoit.de/index.php?page=Thread&threadID=13415
|
|
;Ich hatte mit "einen Wolf" gesucht nach dem Inhalt der Konstanten
|
|
|
|
;Nun die Vereinfachung - gefunden auf http://www.buha.info/board/showthread.php?t=49849 (für C)
|
|
|
|
;Vordergrundfarben F ore G round = FG_
|
|
Local Const $FG_BLACK = 0
|
|
Local Const $FG_BLUE = BitOR($FOREGROUND_BLUE, $FOREGROUND_INTENSITY)
|
|
Local Const $FG_BROWN = BitOR($FOREGROUND_RED, $FOREGROUND_GREEN)
|
|
Local Const $FG_DARKBLUE = $FOREGROUND_BLUE
|
|
Local Const $FG_DARKGREY = $FOREGROUND_INTENSITY
|
|
Local Const $FG_GREEN = $FOREGROUND_GREEN
|
|
Local Const $FG_GREY = BitOR($FOREGROUND_RED, $FOREGROUND_GREEN, $FOREGROUND_BLUE)
|
|
Local Const $FG_LIGHTBLUE = BitOR($FOREGROUND_BLUE, $FOREGROUND_GREEN, $FOREGROUND_INTENSITY)
|
|
Local Const $FG_LIGHTGREEN = BitOR($FOREGROUND_GREEN, $FOREGROUND_INTENSITY)
|
|
Local Const $FG_PINK = BitOR($FOREGROUND_RED, $FOREGROUND_BLUE, $FOREGROUND_INTENSITY)
|
|
Local Const $FG_RED = $FOREGROUND_RED
|
|
Local Const $FG_ROSE = BitOR($FOREGROUND_RED, $FOREGROUND_INTENSITY)
|
|
Local Const $FG_TURQUOISE = BitOR($FOREGROUND_BLUE, $FOREGROUND_GREEN)
|
|
Local Const $FG_VIOLET = BitOR($FOREGROUND_RED, $FOREGROUND_BLUE)
|
|
Local Const $FG_WHITE = BitOR($FOREGROUND_RED, $FOREGROUND_GREEN, $FOREGROUND_BLUE, $FOREGROUND_INTENSITY)
|
|
Local Const $FG_YELLOW = BitOR($FOREGROUND_RED, $FOREGROUND_GREEN, $FOREGROUND_INTENSITY)
|
|
|
|
;Hintergrundfarben B ack Ground = BG_
|
|
Local Const $BG_BLACK = 0
|
|
Local Const $BG_BLUE = BitOR($BACKGROUND_BLUE, $BACKGROUND_INTENSITY)
|
|
Local Const $BG_BROWN = BitOR($BACKGROUND_RED, $BACKGROUND_GREEN)
|
|
Local Const $BG_DARKBLUE = $BACKGROUND_BLUE
|
|
Local Const $BG_DARKGREY = $BACKGROUND_INTENSITY
|
|
Local Const $BG_GREEN = $BACKGROUND_GREEN
|
|
Local Const $BG_GREY = BitOR($BACKGROUND_RED, $BACKGROUND_GREEN, $BACKGROUND_BLUE)
|
|
Local Const $BG_LIGHTBLUE = BitOR($BACKGROUND_BLUE, $BACKGROUND_GREEN, $BACKGROUND_INTENSITY)
|
|
Local Const $BG_LIGHTGREEN = BitOR($BACKGROUND_GREEN, $BACKGROUND_INTENSITY)
|
|
Local Const $BG_PINK = BitOR($BACKGROUND_RED, $BACKGROUND_BLUE, $BACKGROUND_INTENSITY)
|
|
Local Const $BG_RED = $BACKGROUND_RED
|
|
Local Const $BG_ROSE = BitOR($BACKGROUND_RED, $BACKGROUND_INTENSITY)
|
|
Local Const $BG_TURQUOISE = BitOR($BACKGROUND_BLUE, $BACKGROUND_GREEN)
|
|
Local Const $BG_VIOLET = BitOR($BACKGROUND_RED, $BACKGROUND_BLUE)
|
|
Local Const $BG_WHITE = BitOR($BACKGROUND_RED, $BACKGROUND_GREEN, $BACKGROUND_BLUE, $BACKGROUND_INTENSITY)
|
|
Local Const $BG_YELLOW = BitOR($BACKGROUND_RED, $BACKGROUND_GREEN, $BACKGROUND_INTENSITY)
|
|
|
|
Global $DefaultWerte
|
|
Global $DefaultBackGround
|
|
|
|
Func _Console_ChangeColor ($zConsole, $Color)
|
|
; BLinz
|
|
Local $aRes = DllCall("kernel32.dll", "bool", "SetConsoleTextAttribute","handle", $zConsole, "word", $Color)
|
|
EndFunc
|
|
|
|
|
|
; 10 20 30 40 50 60 70 80
|
|
; 12345678901234567890123456789012345678901234567890123456789012345678901234567890
|
|
Dim $Teil1 = @CRLF & _
|
|
@CRLF & _
|
|
"Dieser Text erschein in der voreingestellten Farbe" & @CRLF & _
|
|
@CRLF
|
|
|
|
; 10 20 30 40 50 60 70 80
|
|
; 12345678901234567890123456789012345678901234567890123456789012345678901234567890
|
|
Dim $Teil2 = "Dieser in einer anderen " & @crlf
|
|
Dim $ZeigerConsole
|
|
|
|
$DefaultWerte = RegRead("HKEY_CURRENT_USER\Console","ScreenColors")
|
|
; Beispiel
|
|
_WinAPI_AttachConsole()
|
|
$ZeigerConsole = _WinAPI_GetStdHandle(1)
|
|
_WinAPI_WriteConsole($ZeigerConsole,$Teil1)
|
|
|
|
_Console_ChangeColor($ZeigerConsole,BitOR($FG_BLACK,$BG_WHITE))
|
|
_WinAPI_WriteConsole($ZeigerConsole," Schwarz auf Weiss ")
|
|
_Console_ChangeColor($ZeigerConsole,BitOR($FG_WHITE,$BG_BLACK))
|
|
_WinAPI_WriteConsole($ZeigerConsole," Weiss auf Schwarz " & @CRLF)
|
|
|
|
_Console_ChangeColor($ZeigerConsole,BitOR($FG_RED,$BG_YELLOW))
|
|
_WinAPI_WriteConsole($ZeigerConsole," Rot auf Gelb ")
|
|
_Console_ChangeColor($ZeigerConsole,BitOR($FG_LIGHTBLUE,$BG_BLACK))
|
|
_WinAPI_WriteConsole($ZeigerConsole," Hellblau auf Schwarz " & @CRLF)
|
|
_Console_ChangeColor($ZeigerConsole,$DefaultWerte)
|
|
ConsoleWrite("und noch eine Zeile mit ConsoleWrite" & @CRLF)
|
|
;Send("{Enter}")
|
|
|
|
|