first commit
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.bak
|
515
ColorEcho.au3
Normal file
@ -0,0 +1,515 @@
|
||||
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
|
||||
#AutoIt3Wrapper_Icon=ColorEcho.ico
|
||||
#AutoIt3Wrapper_UseUpx=n
|
||||
#AutoIt3Wrapper_Change2CUI=y
|
||||
#AutoIt3Wrapper_Res_Comment=http://znil.net/index.php?title=ZnilTools:ColorEcho.exe
|
||||
#AutoIt3Wrapper_Res_Description=http://znil.net/index.php?title=ZnilTools:ColorEcho.exe
|
||||
#AutoIt3Wrapper_Res_Fileversion=1.2.0.2
|
||||
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=p
|
||||
#AutoIt3Wrapper_Res_Language=1031
|
||||
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
|
||||
#Include <WinAPI.au3>
|
||||
|
||||
;Grundfarben
|
||||
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
|
||||
|
||||
|
||||
;Vordergrundfarben F ore G round = FG_
|
||||
Global Const $FG_BLACK = 0
|
||||
Global Const $FG_BLUE = BitOR($FOREGROUND_BLUE, $FOREGROUND_INTENSITY)
|
||||
Global Const $FG_BROWN = BitOR($FOREGROUND_RED, $FOREGROUND_GREEN)
|
||||
Global Const $FG_DARKBLUE = $FOREGROUND_BLUE
|
||||
Global Const $FG_DARKGREY = $FOREGROUND_INTENSITY
|
||||
Global Const $FG_GREEN = $FOREGROUND_GREEN
|
||||
Global Const $FG_GREY = BitOR($FOREGROUND_RED, $FOREGROUND_GREEN, $FOREGROUND_BLUE)
|
||||
Global Const $FG_LIGHTBLUE = BitOR($FOREGROUND_BLUE, $FOREGROUND_GREEN, $FOREGROUND_INTENSITY)
|
||||
Global Const $FG_LIGHTGREEN = BitOR($FOREGROUND_GREEN, $FOREGROUND_INTENSITY)
|
||||
Global Const $FG_PINK = BitOR($FOREGROUND_RED, $FOREGROUND_BLUE, $FOREGROUND_INTENSITY)
|
||||
Global Const $FG_RED = $FOREGROUND_RED
|
||||
Global Const $FG_ROSE = BitOR($FOREGROUND_RED, $FOREGROUND_INTENSITY)
|
||||
Global Const $FG_TURQUOISE = BitOR($FOREGROUND_BLUE, $FOREGROUND_GREEN)
|
||||
Global Const $FG_VIOLET = BitOR($FOREGROUND_RED, $FOREGROUND_BLUE)
|
||||
Global Const $FG_WHITE = BitOR($FOREGROUND_RED, $FOREGROUND_GREEN, $FOREGROUND_BLUE, $FOREGROUND_INTENSITY)
|
||||
Global Const $FG_YELLOW = BitOR($FOREGROUND_RED, $FOREGROUND_GREEN, $FOREGROUND_INTENSITY)
|
||||
|
||||
;Hintergrundfarben B ack Ground = BG_
|
||||
Global Const $BG_BLACK = 0
|
||||
Global Const $BG_BLUE = BitOR($BACKGROUND_BLUE, $BACKGROUND_INTENSITY)
|
||||
Global Const $BG_BROWN = BitOR($BACKGROUND_RED, $BACKGROUND_GREEN)
|
||||
Global Const $BG_DARKBLUE = $BACKGROUND_BLUE
|
||||
Global Const $BG_DARKGREY = $BACKGROUND_INTENSITY
|
||||
Global Const $BG_GREEN = $BACKGROUND_GREEN
|
||||
Global Const $BG_GREY = BitOR($BACKGROUND_RED, $BACKGROUND_GREEN, $BACKGROUND_BLUE)
|
||||
Global Const $BG_LIGHTBLUE = BitOR($BACKGROUND_BLUE, $BACKGROUND_GREEN, $BACKGROUND_INTENSITY)
|
||||
Global Const $BG_LIGHTGREEN = BitOR($BACKGROUND_GREEN, $BACKGROUND_INTENSITY)
|
||||
Global Const $BG_PINK = BitOR($BACKGROUND_RED, $BACKGROUND_BLUE, $BACKGROUND_INTENSITY)
|
||||
Global Const $BG_RED = $BACKGROUND_RED
|
||||
Global Const $BG_ROSE = BitOR($BACKGROUND_RED, $BACKGROUND_INTENSITY)
|
||||
Global Const $BG_TURQUOISE = BitOR($BACKGROUND_BLUE, $BACKGROUND_GREEN)
|
||||
Global Const $BG_VIOLET = BitOR($BACKGROUND_RED, $BACKGROUND_BLUE)
|
||||
Global Const $BG_WHITE = BitOR($BACKGROUND_RED, $BACKGROUND_GREEN, $BACKGROUND_BLUE, $BACKGROUND_INTENSITY)
|
||||
Global Const $BG_YELLOW = BitOR($BACKGROUND_RED, $BACKGROUND_GREEN, $BACKGROUND_INTENSITY)
|
||||
|
||||
Global $DefaultWerte = RegRead("HKEY_CURRENT_USER\Console","ScreenColors")
|
||||
Global $DefaultBackground = Int("0x000000" & Stringmid(hex($DefaultWerte),7,1) & "0")
|
||||
Global $DefaultForeground = Int(Stringmid(hex($DefaultWerte),8,1))
|
||||
Global $ZeigerConsole
|
||||
Global $ZeigerCmdLine = 1
|
||||
Global $NewBackground
|
||||
Global $NewForeground
|
||||
|
||||
; ###################################################################################
|
||||
; H I L F E - T E X T
|
||||
; ###################################################################################
|
||||
|
||||
|
||||
; 10 20 30 40 50 60 70 80
|
||||
; 12345678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
Dim $Header = "+------------------------------------------------------------------------------" & @CRLF & _
|
||||
"| ColorEcho - Version " & FileGetVersion(@ScriptName) & @CRLF & _
|
||||
"+------------------------------------------------------------------------------" & @CRLF & _
|
||||
"| 2011 von Bernhard Linz für http://znil.net - Kontakt: Bernhard@znil.net" & @CRLF & _
|
||||
"+------------------------------------------------------------------------------" & @CRLF & _
|
||||
@CRLF
|
||||
|
||||
; 10 20 30 40 50 60 70 80
|
||||
; 12345678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
Dim $HilfeText = "Kann wie das normale Echo Text in einer Eingabeaufforderung / DOS-Box ausgeben." & @CRLF & _
|
||||
"Dabei kann aber die Hintergundfarbe und Textfarbe im Rahmen der DOS-Farbtabelle" & @CRLF & _
|
||||
"gewählt werden." & @CRLF & _
|
||||
"-------------------------------------------------------------------------------" & @CRLF & _
|
||||
@CRLF & _
|
||||
"1. Normaler Aufruf:" & @CRLF & _
|
||||
@ScriptName & " [Hintergrundfarbe] [Vordergrundfarbe] [Text]" & @CRLF & _
|
||||
@CRLF & _
|
||||
"2. Aufruf ohne neue Zeile: (Nachfolgender Text erscheint dahinter)" & @CRLF & _
|
||||
@ScriptName & " /NoCRLF [Hintergrundfarbe] [Vordergrundfarbe] [Text]" & @CRLF & _
|
||||
@CRLF & _
|
||||
"3. Farben pauschal ändern: (Standardfarben werden nicht wieder hergestellt)" & @CRLF & _
|
||||
@ScriptName & " /change [Hintergrundfarbe] [Vordergrundfarbe]" & @CRLF & _
|
||||
@CRLF & _
|
||||
"4. Voreinstellung wieder herstellen: (Standard bei 1. und 2.)" & @CRLF & _
|
||||
@ScriptName & " /reset" & @CRLF & _
|
||||
"-------------------------------------------------------------------------------" & @CRLF & _
|
||||
@CRLF & _
|
||||
"[Hintergundfarbe] : eine der 16 DOS Farben, siehe Farbtabelle" & @CRLF & _
|
||||
"[Vordergrundfarbe] : eine der 16 DOS Farben, siehe Farbtabelle" & @CRLF & _
|
||||
"[Text] : Der Text der ausgegeben werden soll" & @CRLF & _
|
||||
"/NoCRLF : Unterdrückt das Erzeugen einer neuen Zeile, z.B." & @CRLF & _
|
||||
" für verschiedene Farben innerhalb einer Zeile" & @CRLF & _
|
||||
"/change : Stellt die Farben für alle nachfolgenden Ausgaben" & @CRLF & _
|
||||
" um, also auch Text anderer Programme." & @CRLF & _
|
||||
"/reset : Voreingestellte Farben werden wieder verwendet," & @CRLF & _
|
||||
" wird autoamtisch nach jeder Zeile ausgeführt," & @CRLF & _
|
||||
" /change unterdrückt dies." & @CRLF & _
|
||||
@CRLF & _
|
||||
"Beispiele:" & @CRLF & _
|
||||
"----------" & @CRLF
|
||||
|
||||
|
||||
; 10 20 30 40 50 60 70 80
|
||||
; 12345678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
$Disclaimer = "+------------------------------------------------------------------------------" & @CRLF & _
|
||||
"| ColorEcho.exe ist FREEWARE! Kopieren, weitergeben ausdrücklich erlaubt!" & @CRLF & _
|
||||
"| Die jeweils aktuelleste Version und Anleitungen findet Ihr unter:" & @CRLF & _
|
||||
"| http://znil.net/index.php?title=ZnilTools:ColorEcho.exe" & @CRLF & _
|
||||
"+------------------------------------------------------------------------------" & @CRLF
|
||||
|
||||
; ###################################################################################
|
||||
; F U N C T I O N E N / S U B R O U T I N E N
|
||||
; ###################################################################################
|
||||
|
||||
; ###################################################################################
|
||||
; Der eigentliche Farbwechsel
|
||||
Func _Console_ChangeColor ($zConsole, $Color)
|
||||
; BLinz
|
||||
Local $aRes = DllCall("kernel32.dll", "bool", "SetConsoleTextAttribute","handle", $zConsole, "word", $Color)
|
||||
EndFunc
|
||||
|
||||
; ###################################################################################
|
||||
; _ANSI2OEM löst das Problem mit dem Umlauten und anderen Sonderzeichen. Es wandelt Text so um das er korrekt in der DOS-Box dargestellt wird
|
||||
; So können hier im Quellcode auch Umlaute verwendet werden (in den Textausgaben) und diese werden dann korrekt dargestellt
|
||||
; Dank an Xenobiologist von AutoIt.de für diese Lösung: http://www.autoit.de/index.php?page=Thread&threadID=9461&highlight=ANSI2OEM
|
||||
Func _ANSI2OEM($text)
|
||||
$text = DllCall('user32.dll', 'Int', 'CharToOem', 'str', $text, 'str', '')
|
||||
Return $text[2]
|
||||
EndFunc ;==>_ANSI2OEM
|
||||
|
||||
; ###################################################################################
|
||||
; Hilfsroutine die den Hilfetext ausgibt
|
||||
Func _HilfeAusgeben()
|
||||
ConsoleWrite(_ANSI2OEM($Header))
|
||||
ConsoleWrite(_ANSI2OEM($HilfeText))
|
||||
; 10 20 30 40 50 60 70 80
|
||||
; 12345678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
ConsoleWrite(_ANSI2OEM("Beispiel 1 : Blauer Text mit voreingestellten Hintergrund" & @CRLF))
|
||||
ConsoleWrite(_ANSI2OEM("Aufruf : ColorEcho BLUE Dieser Text ist BLAU!" & @CRLF))
|
||||
ConsoleWrite(_ANSI2OEM("Ergebnis : "))
|
||||
_Console_ChangeColor($ZeigerConsole,BitOR($DefaultBackground,$FG_BLUE))
|
||||
ConsoleWrite(_ANSI2OEM("Dieser Text ist BLAU!" & @CRLF))
|
||||
_Console_ChangeColor($ZeigerConsole,$DefaultWerte)
|
||||
ConsoleWrite(@CRLF)
|
||||
|
||||
ConsoleWrite(_ANSI2OEM("Beispiel 2 : Roter Text mit gelben Hintergrund" & @CRLF))
|
||||
ConsoleWrite(_ANSI2OEM("Aufruf : ColorEcho YELLOW BLUE Dieser Text ist ROT auf GELB!" & @CRLF))
|
||||
ConsoleWrite(_ANSI2OEM("Ergebnis : "))
|
||||
_Console_ChangeColor($ZeigerConsole,BitOR($BG_YELLOW,$FG_RED))
|
||||
ConsoleWrite(_ANSI2OEM("Dieser Text ist ROT auf GELB!"))
|
||||
_Console_ChangeColor($ZeigerConsole,$DefaultWerte)
|
||||
ConsoleWrite(@CRLF)
|
||||
ConsoleWrite(@CRLF)
|
||||
|
||||
ConsoleWrite(_ANSI2OEM("Beispiel 3 : Nur ein Wort einfärben (3 Befehlszeilen, vorher 'echo off')" & @CRLF))
|
||||
ConsoleWrite(_ANSI2OEM('Aufruf : @echo off' & @CRLF))
|
||||
ConsoleWrite(_ANSI2OEM(" ColorEcho /NoCRLF LIGHTGREEN Dieser hellgrüne Text hat ein" & @CRLF))
|
||||
ConsoleWrite(_ANSI2OEM(' ColorEcho /NoCRLF PINK PINKES ' & @CRLF))
|
||||
ConsoleWrite(_ANSI2OEM(" ColorEcho LIGHTGREEN Wort in der Mitte!" & @CRLF))
|
||||
ConsoleWrite(_ANSI2OEM("Ergebnis : "))
|
||||
_Console_ChangeColor($ZeigerConsole,BitOR($DefaultBackground,$FG_LIGHTGREEN))
|
||||
ConsoleWrite(_ANSI2OEM("Dieser grüne Text hat ein"))
|
||||
_Console_ChangeColor($ZeigerConsole,BitOR($DefaultBackground,$FG_PINK))
|
||||
ConsoleWrite(_ANSI2OEM(" PINKES "))
|
||||
_Console_ChangeColor($ZeigerConsole,BitOR($DefaultBackground,$FG_LIGHTGREEN))
|
||||
ConsoleWrite(_ANSI2OEM("Wort in der Mitte!" & @CRLF))
|
||||
_Console_ChangeColor($ZeigerConsole,$DefaultWerte)
|
||||
ConsoleWrite(@CRLF)
|
||||
|
||||
ConsoleWrite(_ANSI2OEM("Beispiel 4 : Nur ein Wort einfärben 2 (3 Befehlszeilen, vorher '@echo off')" & @CRLF))
|
||||
ConsoleWrite(_ANSI2OEM('Aufruf : @echo off' & @CRLF))
|
||||
ConsoleWrite(_ANSI2OEM(' ColorEcho /NoCRLF LIGHTBLUE "Dieser hellblaue Text hat ein "' & @CRLF))
|
||||
ConsoleWrite(_ANSI2OEM(' ColorEcho /NoCRLF WHITE PINK PINKES ' & @CRLF))
|
||||
ConsoleWrite(_ANSI2OEM(' ColorEcho LIGHTBLUE " Wort in der Mitte!"' & @CRLF))
|
||||
ConsoleWrite(_ANSI2OEM("Ergebnis : "))
|
||||
_Console_ChangeColor($ZeigerConsole,BitOR($DefaultBackground,$FG_LIGHTBLUE))
|
||||
ConsoleWrite(_ANSI2OEM("Dieser hellblaue Text hat ein "))
|
||||
_Console_ChangeColor($ZeigerConsole,BitOR($BG_WHITE,$FG_PINK))
|
||||
ConsoleWrite(_ANSI2OEM(" PINKES "))
|
||||
_Console_ChangeColor($ZeigerConsole,BitOR($DefaultBackground,$FG_LIGHTBLUE))
|
||||
ConsoleWrite(_ANSI2OEM(" Wort in der Mitte!" & @CRLF))
|
||||
_Console_ChangeColor($ZeigerConsole,$DefaultWerte)
|
||||
ConsoleWrite(@CRLF)
|
||||
|
||||
ConsoleWrite(_ANSI2OEM("Beispiel 5 : Blau / Weiss für nachfolgende Befehle" & @CRLF))
|
||||
ConsoleWrite(_ANSI2OEM("Aufruf : ColorEcho /change DARKBLUE WHITE" & @CRLF))
|
||||
ConsoleWrite(_ANSI2OEM("Ergebnis : "))
|
||||
_Console_ChangeColor($ZeigerConsole,BitOR($BG_DARKBLUE,$FG_WHITE))
|
||||
ConsoleWrite(_ANSI2OEM("Alle Befehle wie z.B. echo oder dir erscheinen in" & @CRLF))
|
||||
_Console_ChangeColor($ZeigerConsole,$DefaultWerte)
|
||||
ConsoleWrite(_ANSI2OEM(" "))
|
||||
_Console_ChangeColor($ZeigerConsole,BitOR($BG_DARKBLUE,$FG_WHITE))
|
||||
ConsoleWrite("dieser Farbe bis 'ColorEcho /reset' aufgerufen wird.")
|
||||
_Console_ChangeColor($ZeigerConsole,$DefaultWerte)
|
||||
ConsoleWrite(@CRLF)
|
||||
ConsoleWrite(@CRLF)
|
||||
|
||||
ConsoleWrite(_ANSI2OEM('Hinweis 1 : Leerzeichen werden mit Übergeben, es sind keine " " nötig' & @CRLF))
|
||||
ConsoleWrite(_ANSI2OEM('Hinweis 2 : /NoCRLF funktioniert nur in Batch-Dateien richtig' & @CRLF))
|
||||
ConsoleWrite(@CRLF)
|
||||
|
||||
;ConsoleWrite("$DefaultWerte:" & $DefaultWerte & " " & Hex($DefaultWerte) & @CRLF)
|
||||
;ConsoleWrite("$DefaultBackground:" & $DefaultBackground & " " & Hex($DefaultBackground) & @CRLF)
|
||||
|
||||
; Farbtabelle
|
||||
; 10 20 30 40 50 60 70 80
|
||||
; 12345678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
ConsoleWrite(_ANSI2OEM("Farbtabelle:" & @CRLF))
|
||||
ConsoleWrite(_ANSI2OEM("-------------------------------------------------------------------------------" & @CRLF))
|
||||
ConsoleWrite(@CRLF)
|
||||
; ConsoleWrite(" 1 2 3 4 5 6 7 8" & @CRLF)
|
||||
; ConsoleWrite("12345678901234567890123456789012345678901234567890123456789012345678901234567890" & @CRLF)
|
||||
ConsoleWrite(" BLACK [")
|
||||
_Console_ChangeColor($ZeigerConsole,BitOR($BG_BLACK,$FG_BLACK))
|
||||
ConsoleWrite(" ")
|
||||
_Console_ChangeColor($ZeigerConsole,$DefaultWerte)
|
||||
ConsoleWrite("] BLUE [")
|
||||
_Console_ChangeColor($ZeigerConsole,BitOR($BG_BLUE,$FG_BLUE))
|
||||
ConsoleWrite(" ")
|
||||
_Console_ChangeColor($ZeigerConsole,$DefaultWerte)
|
||||
ConsoleWrite("]" & @CRLF)
|
||||
|
||||
ConsoleWrite(" BROWN [")
|
||||
_Console_ChangeColor($ZeigerConsole,BitOR($BG_BROWN,$FG_BROWN))
|
||||
ConsoleWrite(" ")
|
||||
_Console_ChangeColor($ZeigerConsole,$DefaultWerte)
|
||||
ConsoleWrite("] DARKBLUE [")
|
||||
_Console_ChangeColor($ZeigerConsole,BitOR($BG_DARKBLUE,$FG_DARKBLUE))
|
||||
ConsoleWrite(" ")
|
||||
_Console_ChangeColor($ZeigerConsole,$DefaultWerte)
|
||||
ConsoleWrite("]" & @CRLF)
|
||||
|
||||
ConsoleWrite(" DARKGREY [")
|
||||
_Console_ChangeColor($ZeigerConsole,BitOR($BG_DARKGREY,$FG_DARKGREY))
|
||||
ConsoleWrite(" ")
|
||||
_Console_ChangeColor($ZeigerConsole,$DefaultWerte)
|
||||
ConsoleWrite("] GREEN [")
|
||||
_Console_ChangeColor($ZeigerConsole,BitOR($BG_GREEN,$FG_GREEN))
|
||||
ConsoleWrite(" ")
|
||||
_Console_ChangeColor($ZeigerConsole,$DefaultWerte)
|
||||
ConsoleWrite("]" & @CRLF)
|
||||
|
||||
ConsoleWrite(" GREY [")
|
||||
_Console_ChangeColor($ZeigerConsole,BitOR($BG_GREY,$FG_GREY))
|
||||
ConsoleWrite(" ")
|
||||
_Console_ChangeColor($ZeigerConsole,$DefaultWerte)
|
||||
ConsoleWrite("] LIGHTBLUE [")
|
||||
_Console_ChangeColor($ZeigerConsole,BitOR($BG_LIGHTBLUE,$FG_LIGHTBLUE))
|
||||
ConsoleWrite(" ")
|
||||
_Console_ChangeColor($ZeigerConsole,$DefaultWerte)
|
||||
ConsoleWrite("]" & @CRLF)
|
||||
|
||||
ConsoleWrite(" LIGHTGREEN [")
|
||||
_Console_ChangeColor($ZeigerConsole,BitOR($BG_LIGHTGREEN,$FG_LIGHTGREEN))
|
||||
ConsoleWrite(" ")
|
||||
_Console_ChangeColor($ZeigerConsole,$DefaultWerte)
|
||||
ConsoleWrite("] PINK [")
|
||||
_Console_ChangeColor($ZeigerConsole,BitOR($BG_PINK,$FG_PINK))
|
||||
ConsoleWrite(" ")
|
||||
_Console_ChangeColor($ZeigerConsole,$DefaultWerte)
|
||||
ConsoleWrite("]" & @CRLF)
|
||||
|
||||
ConsoleWrite(" RED [")
|
||||
_Console_ChangeColor($ZeigerConsole,BitOR($BG_RED,$FG_RED))
|
||||
ConsoleWrite(" ")
|
||||
_Console_ChangeColor($ZeigerConsole,$DefaultWerte)
|
||||
ConsoleWrite("] ROSE [")
|
||||
_Console_ChangeColor($ZeigerConsole,BitOR($BG_ROSE,$FG_ROSE))
|
||||
ConsoleWrite(" ")
|
||||
_Console_ChangeColor($ZeigerConsole,$DefaultWerte)
|
||||
ConsoleWrite("]" & @CRLF)
|
||||
|
||||
ConsoleWrite(" TURQUOISE [")
|
||||
_Console_ChangeColor($ZeigerConsole,BitOR($BG_TURQUOISE,$FG_TURQUOISE))
|
||||
ConsoleWrite(" ")
|
||||
_Console_ChangeColor($ZeigerConsole,$DefaultWerte)
|
||||
ConsoleWrite("] VIOLET [")
|
||||
_Console_ChangeColor($ZeigerConsole,BitOR($BG_VIOLET,$FG_VIOLET))
|
||||
ConsoleWrite(" ")
|
||||
_Console_ChangeColor($ZeigerConsole,$DefaultWerte)
|
||||
ConsoleWrite("]" & @CRLF)
|
||||
|
||||
ConsoleWrite(" WHITE [")
|
||||
_Console_ChangeColor($ZeigerConsole,BitOR($BG_WHITE,$FG_WHITE))
|
||||
ConsoleWrite(" ")
|
||||
_Console_ChangeColor($ZeigerConsole,$DefaultWerte)
|
||||
ConsoleWrite("] YELLOW [")
|
||||
_Console_ChangeColor($ZeigerConsole,BitOR($BG_YELLOW,$FG_YELLOW))
|
||||
ConsoleWrite(" ")
|
||||
_Console_ChangeColor($ZeigerConsole,$DefaultWerte)
|
||||
ConsoleWrite("]" & @CRLF)
|
||||
ConsoleWrite(@CRLF)
|
||||
ConsoleWrite(_ANSI2OEM($Disclaimer))
|
||||
EndFunc ;==>_HilfeAusgeben
|
||||
|
||||
|
||||
; ###################################################################################
|
||||
; Hilfsroutine die die Farben findet
|
||||
Func _FindColors($a,$b)
|
||||
;1. Parameter testen - sollte immer eine Farbe sein
|
||||
$ZeigerCmdLine = $a
|
||||
If $CmdLine[0] >= $a Then
|
||||
Select
|
||||
Case $CmdLine[$a] = "BLACK"
|
||||
$NewBackground = $BG_BLACK
|
||||
Case $CmdLine[$a] = "BLUE"
|
||||
$NewBackground = $BG_BLUE
|
||||
Case $CmdLine[$a] = "BROWN"
|
||||
$NewBackground = $BG_BROWN
|
||||
Case $CmdLine[$a] = "DARKBLUE"
|
||||
$NewBackground = $BG_DARKBLUE
|
||||
Case $CmdLine[$a] = "DARKGREY"
|
||||
$NewBackground = $BG_DARKGREY
|
||||
Case $CmdLine[$a] = "GREEN"
|
||||
$NewBackground = $BG_GREEN
|
||||
Case $CmdLine[$a] = "GREY"
|
||||
$NewBackground = $BG_GREY
|
||||
Case $CmdLine[$a] = "LIGHTBLUE"
|
||||
$NewBackground = $BG_LIGHTBLUE
|
||||
Case $CmdLine[$a] = "LIGHTGREEN"
|
||||
$NewBackground = $BG_LIGHTGREEN
|
||||
Case $CmdLine[$a] = "PINK"
|
||||
$NewBackground = $BG_PINK
|
||||
Case $CmdLine[$a] = "RED"
|
||||
$NewBackground = $BG_RED
|
||||
Case $CmdLine[$a] = "ROSE"
|
||||
$NewBackground = $BG_ROSE
|
||||
Case $CmdLine[$a] = "TURQUOISE"
|
||||
$NewBackground = $BG_TURQUOISE
|
||||
Case $CmdLine[$a] = "VIOLET"
|
||||
$NewBackground = $BG_VIOLET
|
||||
Case $CmdLine[$a] = "WHITE"
|
||||
$NewBackground = $BG_WHITE
|
||||
Case $CmdLine[$a] = "YELLOW"
|
||||
$NewBackground = $BG_YELLOW
|
||||
Case Else
|
||||
ConsoleWrite(_ANSI2OEM("Unbekannte Farbe: " & $CmdLine[$a]) & @CRLF)
|
||||
Exit
|
||||
EndSelect
|
||||
Else
|
||||
$NewBackground = $DefaultBackground
|
||||
$NewForeground = $DefaultForeground
|
||||
$ZeigerCmdLine = $a - 1
|
||||
EndIf
|
||||
If $CmdLine[0] >= $b Then
|
||||
Select
|
||||
Case $CmdLine[$b] = "BLACK"
|
||||
$NewForeground = $FG_BLACK
|
||||
$ZeigerCmdLine = $b + 1
|
||||
Case $CmdLine[$b] = "BLUE"
|
||||
$NewForeground = $FG_BLUE
|
||||
$ZeigerCmdLine = $b + 1
|
||||
Case $CmdLine[$b] = "BROWN"
|
||||
$NewForeground = $FG_BROWN
|
||||
$ZeigerCmdLine = $b + 1
|
||||
Case $CmdLine[$b] = "DARKBLUE"
|
||||
$NewForeground = $FG_DARKBLUE
|
||||
$ZeigerCmdLine = $b + 1
|
||||
Case $CmdLine[$b] = "DARKGREY"
|
||||
$NewForeground = $FG_DARKGREY
|
||||
$ZeigerCmdLine = $b + 1
|
||||
Case $CmdLine[$b] = "GREEN"
|
||||
$NewForeground = $FG_GREEN
|
||||
$ZeigerCmdLine = $b + 1
|
||||
Case $CmdLine[$b] = "GREY"
|
||||
$NewForeground = $FG_GREY
|
||||
$ZeigerCmdLine = $b + 1
|
||||
Case $CmdLine[$b] = "LIGHTBLUE"
|
||||
$NewForeground = $FG_LIGHTBLUE
|
||||
$ZeigerCmdLine = $b + 1
|
||||
Case $CmdLine[$b] = "LIGHTGREEN"
|
||||
$NewForeground = $FG_LIGHTGREEN
|
||||
$ZeigerCmdLine = $b + 1
|
||||
Case $CmdLine[$b] = "PINK"
|
||||
$NewForeground = $FG_PINK
|
||||
$ZeigerCmdLine = $b + 1
|
||||
Case $CmdLine[$b] = "RED"
|
||||
$NewForeground = $FG_RED
|
||||
$ZeigerCmdLine = $b + 1
|
||||
Case $CmdLine[$b] = "ROSE"
|
||||
$NewForeground = $FG_ROSE
|
||||
$ZeigerCmdLine = $b + 1
|
||||
Case $CmdLine[$b] = "TURQUOISE"
|
||||
$NewForeground = $FG_TURQUOISE
|
||||
$ZeigerCmdLine = $b + 1
|
||||
Case $CmdLine[$b] = "VIOLET"
|
||||
$NewForeground = $FG_VIOLET
|
||||
$ZeigerCmdLine = $b + 1
|
||||
Case $CmdLine[$b] = "WHITE"
|
||||
$NewForeground = $FG_WHITE
|
||||
$ZeigerCmdLine = $b + 1
|
||||
Case $CmdLine[$b] = "YELLOW"
|
||||
$NewForeground = $FG_YELLOW
|
||||
$ZeigerCmdLine = $b + 1
|
||||
Case Else
|
||||
$NewForeground = Int("0x0000000" & StringMid(Hex($NewBackground),7,1))
|
||||
$NewBackground = $DefaultBackground
|
||||
$ZeigerCmdLine = $b
|
||||
;ConsoleWrite("Hier2" & @CRLF)
|
||||
;ConsoleWrite("$NewBackground:" & Hex($NewBackground) & @CRLF)
|
||||
;ConsoleWrite("$NewForeground:" & Hex($NewForeground) & @CRLF)
|
||||
|
||||
EndSelect
|
||||
Else
|
||||
$NewForeground = Int("0x0000000" & StringMid(Hex($NewBackground),7,1))
|
||||
$NewBackground = $DefaultBackground
|
||||
$ZeigerCmdLine = $b
|
||||
;ConsoleWrite("Hier1" & @CRLF)
|
||||
EndIf
|
||||
EndFunc
|
||||
|
||||
; ###################################################################################
|
||||
; Hilfsroutine die den Text des Benutzers ausgibt
|
||||
Func _EchoText($crlfYesOrNo)
|
||||
Dim $LineTextBegin
|
||||
Dim $LineText
|
||||
For $i = 1 to ($ZeigerCmdLine - 1)
|
||||
$LineTextBegin = $LineTextBegin & $CmdLine[$i] & " "
|
||||
Next
|
||||
$LineText = StringMid($CmdLineRaw,StringLen($LineTextBegin) + 1)
|
||||
;~ For $i = $ZeigerCmdLine To $CmdLine[0]
|
||||
;~ $LineText = $LineText & $CmdLine[$i] & " "
|
||||
;~ Next
|
||||
;~ If StringRight($LineText,1) = " " Then
|
||||
;~ $LineText = StringMid($LineText,1,StringLen($LineText) - 1)
|
||||
;~ EndIf
|
||||
ConsoleWrite(_ANSI2OEM($LineText))
|
||||
If $crlfYesOrNo = "Yes" Then
|
||||
ConsoleWrite(@CRLF)
|
||||
EndIf
|
||||
EndFunc
|
||||
|
||||
|
||||
; ######################################################################################################################################################################
|
||||
; ######################################################################################################################################################################
|
||||
; ######################################################################################################################################################################
|
||||
; H A U P T P R O G R A M M
|
||||
; ######################################################################################################################################################################
|
||||
; ######################################################################################################################################################################
|
||||
; ######################################################################################################################################################################
|
||||
|
||||
|
||||
_WinAPI_AttachConsole()
|
||||
$ZeigerConsole = _WinAPI_GetStdHandle(1)
|
||||
$ZeigerCmdLine = 1
|
||||
|
||||
; ###################################################################################
|
||||
; H I L F E
|
||||
; ###################################################################################
|
||||
|
||||
;testen ob wir überhaupt mit einem Parameter gestartet wurden - sonst Hilfe ausgeben
|
||||
If $CmdLine[0] = 0 Then
|
||||
_HilfeAusgeben()
|
||||
Exit
|
||||
EndIf
|
||||
|
||||
;testen ob der Parameter 1 ist auf "/?" testen und ebenfalls Hilfe ausgeben
|
||||
If $CmdLine[1] = "/?" Then
|
||||
_HilfeAusgeben()
|
||||
Exit
|
||||
EndIf
|
||||
|
||||
; ###################################################################################
|
||||
; R E S E T
|
||||
; ###################################################################################
|
||||
If $CmdLine[1] = "/reset" Then
|
||||
_Console_ChangeColor($ZeigerConsole,$DefaultWerte)
|
||||
Exit
|
||||
EndIf
|
||||
|
||||
; ###################################################################################
|
||||
; C H A N G E
|
||||
; ###################################################################################
|
||||
If $CmdLine[1] = "/change" Then
|
||||
_FindColors(2,3)
|
||||
_Console_ChangeColor($ZeigerConsole,BitOR($NewBackground,$NewForeground))
|
||||
Exit
|
||||
EndIf
|
||||
|
||||
; ###################################################################################
|
||||
; N O C R L F
|
||||
; ###################################################################################
|
||||
If $CmdLine[1] = "/NoCRLF" Then
|
||||
_FindColors(2,3)
|
||||
_Console_ChangeColor($ZeigerConsole,BitOR($NewBackground,$NewForeground))
|
||||
_EchoText("No")
|
||||
_Console_ChangeColor($ZeigerConsole,$DefaultWerte)
|
||||
Exit
|
||||
EndIf
|
||||
|
||||
; ###################################################################################
|
||||
; NICHTS VORHER PASSTE
|
||||
; ###################################################################################
|
||||
|
||||
_FindColors(1,2)
|
||||
_Console_ChangeColor($ZeigerConsole,BitOR($NewBackground,$NewForeground))
|
||||
_EchoText("Yes")
|
||||
_Console_ChangeColor($ZeigerConsole,$DefaultWerte)
|
||||
Exit
|
BIN
ColorEcho.exe
Normal file
BIN
ColorEcho.ico
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
ColorEcho.zip
Normal file
134
Console.au3
Normal file
@ -0,0 +1,134 @@
|
||||
#cs
|
||||
Funktioniert nur, wenn es kompiliert wird!
|
||||
#ce
|
||||
|
||||
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
|
||||
|
||||
Global $hConsoleOutput, $hConsoleInput
|
||||
|
||||
; Console starten und Handle für In / Out holen
|
||||
If AllocConsole() Then
|
||||
$hConsoleOutPut = GetStdHandle($STD_OUTPUT_HANDLE)
|
||||
If $hConsoleOutPut = $INVALID_HANDLE_VALUE Then MsgBox(0, 'Fehler', "STDOUT-Handle nicht möglich")
|
||||
$hConsoleInPut = GetStdHandle($STD_INPUT_HANDLE)
|
||||
If $hConsoleOutPut = $INVALID_HANDLE_VALUE Then MsgBox(0, 'Fehler', "STDIN-Handle nicht möglich")
|
||||
Else
|
||||
MsgBox(0, 'Fehler', "Console konnte nicht erstellt werden!")
|
||||
EndIf
|
||||
|
||||
; Titel setzen und Textattribute gelbe Schrift auf blauem Grund
|
||||
SetConsoleTitle('Meine Test-Console')
|
||||
If @error Then MsgBox(0, 'Fehler', 'Titel fehlgeschlagen')
|
||||
SetConsoleTextAttribute($hConsoleOutPut, BitOR($FOREGROUND_RED,$FOREGROUND_GREEN,$FOREGROUND_INTENSITY,$BACKGROUND_BLUE))
|
||||
If @error Then MsgBox(0, 'Fehler', 'Attribute fehlgeschlagen')
|
||||
|
||||
; Text in Console schreiben
|
||||
ConsoleWriteLine("Hallo Welt!")
|
||||
If @error Then MsgBox(0, 'Fehler', 'Schreibe Zeile fehlgeschlagen')
|
||||
_ConsoleWrite("Bitte gib deinen Namen ein: ")
|
||||
If @error Then MsgBox(0, 'Fehler', 'Schreiben fehlgeschlagen')
|
||||
|
||||
; Text aus Console in MsgBox verwenden
|
||||
MsgBox(0, '', "Dein Name: " & ConsoleReadLine() )
|
||||
|
||||
; alles schließen
|
||||
CloseHandle($hConsoleOutPut)
|
||||
CloseHandle($hConsoleInPut)
|
||||
FreeConsole()
|
||||
|
||||
|
||||
|
||||
#region - Console Funcs
|
||||
|
||||
Func AllocConsole()
|
||||
Local $ret = DllCall("kernel32", "long", "AllocConsole")
|
||||
If $ret[0] = 0 Then Return SetError(1,0,0)
|
||||
Return 1
|
||||
EndFunc
|
||||
|
||||
Func FreeConsole()
|
||||
DllCall("kernel32", "long", "FreeConsole")
|
||||
EndFunc
|
||||
|
||||
Func CloseHandle($hObject)
|
||||
DllCall("kernel32", "long", "CloseHandle", "long", $hObject)
|
||||
EndFunc
|
||||
|
||||
Func GetStdHandle($nStdHandle)
|
||||
Local $ret = DllCall("kernel32", "long", "GetStdHandle", "long", $nStdHandle)
|
||||
If $ret[0] = 0 Then Return SetError(1,0,0)
|
||||
Return $ret[0]
|
||||
EndFunc
|
||||
|
||||
Func WriteConsole($hConsoleOutPut, $sText)
|
||||
Local $lpBuffer = DllStructCreate("char[" & StringLen($sText) & "]"), $lpNumberOfCharsWritten = DllStructCreate('int')
|
||||
DllStructSetData($lpBuffer, 1, $sText)
|
||||
Local $ret = DllCall("kernel32", "long", "WriteConsoleA", "long", $hConsoleOutPut, "ptr", DllStructGetPtr($lpBuffer), _
|
||||
"long", StringLen($sText), "ptr", DllStructGetPtr($lpNumberOfCharsWritten), "long", 0)
|
||||
If $ret[0] = 0 Then Return SetError(1,0,0)
|
||||
Return $ret[0]
|
||||
EndFunc
|
||||
|
||||
Func ConsoleWriteLine($sInput)
|
||||
_ConsoleWrite($sInput & @CRLF)
|
||||
If @error Then Return SetError(1,0,0)
|
||||
EndFunc
|
||||
|
||||
Func _ConsoleWrite($sInput)
|
||||
WriteConsole($hConsoleOutPut, $sInput)
|
||||
If @error Then Return SetError(1,0,0)
|
||||
EndFunc
|
||||
|
||||
Func ReadConsole($hConsoleInPut, $ConsoleReadLine)
|
||||
Local $lpBuffer = DllStructCreate("char[80]"), $lpNumberOfCharsRead = DllStructCreate('int')
|
||||
DllStructSetData($lpBuffer, 1, $ConsoleReadLine)
|
||||
Local $ret = DllCall("kernel32", "long", "ReadConsoleA", "long", $hConsoleInPut, "ptr", DllStructGetPtr($lpBuffer), _
|
||||
"long", StringLen($ConsoleReadLine), "ptr", DllStructGetPtr($lpNumberOfCharsRead), 'long', 0)
|
||||
If $ret[0] = 0 Then Return SetError(1,0,0)
|
||||
Return DllStructGetData($lpBuffer, 1)
|
||||
EndFunc
|
||||
|
||||
Func ConsoleReadLine()
|
||||
Local $ZeroPos, $ConsoleReadLine = ''
|
||||
For $i = 0 To 79
|
||||
$ConsoleReadLine &= Chr(0)
|
||||
Next
|
||||
$ConsoleReadLine = ReadConsole($hConsoleInPut, $ConsoleReadLine)
|
||||
$ZeroPos = StringInStr($ConsoleReadLine, Chr(0))
|
||||
If $ZeroPos > 0 Then $ConsoleReadLine = StringLeft($ConsoleReadLine, $ZeroPos - 3)
|
||||
Return $ConsoleReadLine
|
||||
EndFunc
|
||||
|
||||
Func SetConsoleTitle($lpConsoleTitle)
|
||||
Local $ret = DllCall("kernel32", "long", "SetConsoleTitleA", "str", $lpConsoleTitle)
|
||||
If $ret[0] = 0 Then Return SetError(1,0,0)
|
||||
Return 1
|
||||
EndFunc
|
||||
|
||||
Func SetConsoleTextAttribute($hConsoleOutPut, $wAttributes)
|
||||
Local $ret = DllCall("kernel32", "long", "SetConsoleTextAttribute", "long", $hConsoleOutPut, "long", $wAttributes)
|
||||
If $ret[0] = 0 Then Return SetError(1,0,0)
|
||||
Return 1
|
||||
EndFunc
|
||||
|
||||
#endregion - Console Funcs
|
BIN
Console.exe
Normal file
118
Test/test1.au3
Normal file
@ -0,0 +1,118 @@
|
||||
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
|
||||
#AutoIt3Wrapper_icon=..\znil.ico
|
||||
#AutoIt3Wrapper_Res_Description=Batch versteckt starten
|
||||
#AutoIt3Wrapper_Res_Fileversion=1.0.0.16
|
||||
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
|
||||
#AutoIt3Wrapper_Res_LegalCopyright=2011 von Bernhard Linz - http://znil.net
|
||||
#AutoIt3Wrapper_Res_Language=1031
|
||||
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
|
||||
;HideBatchWindow.exe
|
||||
;
|
||||
;Programm zum versteckten ausführen von Batchdateien
|
||||
;
|
||||
;Aufruf: hidebatchwindow.exe [/wait] [Laufwerk:][Pfad][Batchdatei]
|
||||
;
|
||||
;2011 Bernhard Linz
|
||||
;Email: Bernhard.Linz@datagroup.de
|
||||
;Email: Bernhard@znil.net
|
||||
;
|
||||
;beim Compilen darf "Create CUI instead of GUI" NICHT (NICHT!) gestezt werden - sonst gibt es doch ein sichtbares Fenster!
|
||||
;
|
||||
#Include <WinAPI.au3>
|
||||
; 10 20 30 40 50 60 70 80
|
||||
; 12345678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
Dim $Header = @CRLF & _
|
||||
@CRLF & _
|
||||
"HideBatchWindow.exe - 2011 von Bernhard Linz für http://znil.net" & @CRLF & _
|
||||
"Kontakt: Bernhard@znil.net" & @CRLF & _
|
||||
@CRLF
|
||||
|
||||
; 10 20 30 40 50 60 70 80
|
||||
; 12345678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
Dim $HilfeText = "Startet eine Batchdatei versteckt, also ohne ein DOS-Fenster zu zeigen." & @crlf & _
|
||||
@CRLF & _
|
||||
"Aufruf:" & @CRLF & _
|
||||
@ScriptName & " [/wait] [Laufwerk:][Pfad][Batchdatei] [Parameter]" & @CRLF & _
|
||||
@CRLF & _
|
||||
"/wait : Auf das Beenden der Batchdatei warten" & @CRLF & _
|
||||
" (sonst selbst beenden)" & @CRLF & _
|
||||
"[Laufwerk:][Pfad][Batchdatei] : Pfad zur Batchdatei" & @CRLF & _
|
||||
"[Parameter] : eventuelle Parameter für die Batchdatei" & @CRLF & _
|
||||
" (die diese Verarbeitet)" & @CRLF & _
|
||||
@CRLF & _
|
||||
"zum Beispiel: " & @ScriptName & " test.cmd" & @CRLF & _
|
||||
" " & @ScriptName & " C:\Scripte\test.cmd" & @CRLF & _
|
||||
" " & @ScriptName & " \\server\freigabe\test.cmd" & @CRLF & _
|
||||
" " & @ScriptName & " /wait \\server\freigabe\test.cmd" & @CRLF & _
|
||||
" " & @ScriptName & " \\server\freigabe\test.cmd par1 par2" & @CRLF & _
|
||||
@CRLF & _
|
||||
"Bei Leerzeichen im Pfad bitte in Anführungszeichen setzen!" & @CRLF & _
|
||||
@CRLF
|
||||
|
||||
Dim $Befehlzeile
|
||||
Dim $ZeigerConsole
|
||||
|
||||
Func _HilfeAusgeben()
|
||||
_WinAPI_AttachConsole()
|
||||
$ZeigerConsole = _WinAPI_GetStdHandle(1)
|
||||
_WinAPI_WriteConsole($ZeigerConsole,$Header)
|
||||
_Console_ChangeTextColor($ZeigerConsole,133)
|
||||
_WinAPI_WriteConsole($ZeigerConsole,$HilfeText)
|
||||
Send("{Enter}")
|
||||
EndFunc
|
||||
|
||||
;#################################################################################################
|
||||
Func _Console_SetTitle($sTitle)
|
||||
; ProgAndy
|
||||
Local $aRes = DllCall("kernel32.dll", "bool", "SetConsoleTitleW", "wstr", $sTitle)
|
||||
If @error Then Return SetError(1,0,0)
|
||||
Return $aRes[0]
|
||||
EndFunc
|
||||
;###################################################################################################
|
||||
|
||||
Func _Console_ChangeTextColor ($zConsole, $Color)
|
||||
; BLinz
|
||||
Local $aRes = DllCall("kernel32.dll", "bool", "SetConsoleTextAttribute","handle", $zConsole, "word", $Color)
|
||||
If @error Then Return SetError(1,0,0)
|
||||
Return $aRes[0]
|
||||
EndFunc
|
||||
|
||||
|
||||
|
||||
|
||||
;testen ob wir überhaupt mit einem parameter gestartet wurden - sonst Hilfe ausgeben
|
||||
If $CmdLine[0] = 0 Then
|
||||
_HilfeAusgeben()
|
||||
Exit
|
||||
EndIf
|
||||
|
||||
;testen ob der Parameter 1 ist auf "/?" testen und ebenfalls Hilfe ausgeben
|
||||
If $CmdLine[1] = "/?" Then
|
||||
_HilfeAusgeben()
|
||||
Exit
|
||||
EndIf
|
||||
|
||||
;testen ob nur 1 Parameter gesetzte wurde und ein Schlauberger hier nur /wait angebene hat - dann Hilfe ausgeben
|
||||
If StringCompare($CmdLine[1], "/wait", 0) = 0 And $CmdLine[0] = 1 Then
|
||||
_HilfeAusgeben()
|
||||
Exit
|
||||
EndIf
|
||||
|
||||
;testen ob der /wait Parameter gesetzt wurde oder nicht und ;testen ob es die übergebene Datei überhaupt gibt:
|
||||
If StringCompare($CmdLine[1], "/wait", 0) = 0 Then
|
||||
If FileExists($CmdLine[2]) Then
|
||||
$Befehlzeile = ""
|
||||
For $i = 2 To $CmdLine[0]
|
||||
$Befehlzeile = $Befehlzeile & $CmdLine[$i] & " "
|
||||
Next
|
||||
RunWait(@ComSpec & " /c " & $Befehlzeile, "", @SW_HIDE)
|
||||
EndIf
|
||||
Else
|
||||
If FileExists($CmdLine[1]) Then
|
||||
$Befehlzeile = ""
|
||||
For $i = 1 To $CmdLine[0]
|
||||
$Befehlzeile = $Befehlzeile & $CmdLine[$i] & " "
|
||||
Next
|
||||
Run(@ComSpec & " /c " & $Befehlzeile, "", @SW_HIDE)
|
||||
EndIf
|
||||
EndIf
|
BIN
Test/test1.exe
Normal file
111
Test/test2.au3
Normal file
@ -0,0 +1,111 @@
|
||||
#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}")
|
||||
|
||||
|
BIN
Test/test2.exe
Normal file
6
test.bat
Normal file
@ -0,0 +1,6 @@
|
||||
@echo off
|
||||
colorecho.exe /nocrlf white Erste zeile
|
||||
colorecho.exe /nocrlf grey lightgreen zweite zeile
|
||||
colorecho.exe white Dritte zeile
|
||||
colorecho.exe /reset
|
||||
|
BIN
znil.net/ColorEcho-001.gif
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
znil.net/ColorEcho-002.gif
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
znil.net/ColorEcho-003.gif
Normal file
After Width: | Height: | Size: 9.2 KiB |
BIN
znil.net/ColorEcho-004.gif
Normal file
After Width: | Height: | Size: 8.9 KiB |
BIN
znil.net/ColorEcho-005.gif
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
znil.net/ColorEcho-006.gif
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
znil.net/ColorEcho-007.gif
Normal file
After Width: | Height: | Size: 44 KiB |