Jump to content

Hex Variable


Recommended Posts

  • Moderators

Reinhardt1julian,

Firstly, if you have not already done so, go and look at your other thread where I show you a much better way of writing the basic code in that script. ;)

In this new version I see you are trying to send the $HFarbeH and $TFarbeH variables to a DOS box to set the colour - so I suggest that you replace all the values you assign to those variables by literal strings: "1", "2", "3",...."9", "A",...."F". That way you will send the correct values to the DOS box. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

$iDec = 0x00DBFF
$sString = StringFormat("%06X", $iDec)
MsgBox(0, 'Yes?', $sString)

RunWait(@ComSpec & ' /c (Title My Prog & @Echo off & Color 1e & cls & set /p Ok=^>^>)')

; color хх (The first digit refers to the background, and the second indicates the color of the text.)
; 0 = Black
; 1 = Blue
; 2 = Green
; 3 = Aqua
; 4 = Red
; 5 = Purple
; 6 = Yellow
; 7 = White
; 8 = Gray
; 9 = Light Blue
; A = Light Green
; B = Light Aqua
; C = Light Red
; D = Light Purple
; E = Light Yellow
; F = Bright White

Link to comment
Share on other sites

  • 1 year later...

It doesnt look like anyone has pointed this out, but you have 5 includes with no value.

EDIT:
This code works. ^_^

#include <GUIConstantsEx.au3>
$TFarbe = 0xC0C0C0
$HFarbe = 0x000000
$TFarbeH = 7
$HFarbeH = 0
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Test", 692, 211, 175, 144)
$Button1 = GUICtrlCreateButton("", 8, 32, 25, 25)
GUICtrlSetBkColor(-1, 0x000000)
$Button3 = GUICtrlCreateButton("", 40, 32, 25, 25)
GUICtrlSetBkColor(-1, 0x000080)
$Button4 = GUICtrlCreateButton("", 72, 32, 25, 25)
GUICtrlSetBkColor(-1, 0x008000)
$Button5 = GUICtrlCreateButton("", 104, 32, 25, 25)
GUICtrlSetBkColor(-1, 0x008080)
$Button6 = GUICtrlCreateButton("", 136, 32, 25, 25)
GUICtrlSetBkColor(-1, 0x800000)
$Button7 = GUICtrlCreateButton("", 168, 32, 25, 25)
GUICtrlSetBkColor(-1, 0x800080)
$Button8 = GUICtrlCreateButton("", 200, 32, 25, 25)
GUICtrlSetBkColor(-1, 0x808000)
$Button9 = GUICtrlCreateButton("", 232, 32, 25, 25)
GUICtrlSetBkColor(-1, 0xC0C0C0)
$Button10 = GUICtrlCreateButton("", 264, 32, 25, 25)
GUICtrlSetBkColor(-1, 0x808080)
$Button11 = GUICtrlCreateButton("", 296, 32, 25, 25)
GUICtrlSetBkColor(-1, 0x0000FF)
$Button12 = GUICtrlCreateButton("", 328, 32, 25, 25)
GUICtrlSetBkColor(-1, 0x00FF00)
$Button13 = GUICtrlCreateButton("", 360, 32, 25, 25)
GUICtrlSetBkColor(-1, 0x00FFFF)
$Button14 = GUICtrlCreateButton("", 392, 32, 25, 25)
GUICtrlSetBkColor(-1, 0xFF0000)
$Button15 = GUICtrlCreateButton("", 424, 32, 25, 25)
GUICtrlSetBkColor(-1, 0xFF00FF)
$Button16 = GUICtrlCreateButton("", 456, 32, 25, 25)
GUICtrlSetBkColor(-1, 0xFFFF00)
$Button17 = GUICtrlCreateButton("", 488, 32, 25, 25)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$Button2 = GUICtrlCreateButton("", 488, 100, 25, 25)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$Button18 = GUICtrlCreateButton("", 104, 100, 25, 25)
GUICtrlSetBkColor(-1, 0x008080)
$Button19 = GUICtrlCreateButton("", 168, 100, 25, 25)
GUICtrlSetBkColor(-1, 0x800080)
$Button20 = GUICtrlCreateButton("", 136, 100, 25, 25)
GUICtrlSetBkColor(-1, 0x800000)
$Button21 = GUICtrlCreateButton("", 8, 100, 25, 25)
GUICtrlSetBkColor(-1, 0x000000)
$Button22 = GUICtrlCreateButton("", 40, 100, 25, 25)
GUICtrlSetBkColor(-1, 0x000080)
$Button23 = GUICtrlCreateButton("", 72, 100, 25, 25)
GUICtrlSetBkColor(-1, 0x008000)
$Button24 = GUICtrlCreateButton("", 200, 100, 25, 25)
GUICtrlSetBkColor(-1, 0x808000)
$Button25 = GUICtrlCreateButton("", 232, 100, 25, 25)
GUICtrlSetBkColor(-1, 0xC0C0C0)
$Button26 = GUICtrlCreateButton("", 264, 100, 25, 25)
GUICtrlSetBkColor(-1, 0x808080)
$Button27 = GUICtrlCreateButton("", 296, 100, 25, 25)
GUICtrlSetBkColor(-1, 0x0000FF)
$Button28 = GUICtrlCreateButton("", 328, 100, 25, 25)
GUICtrlSetBkColor(-1, 0x00FF00)
$Button29 = GUICtrlCreateButton("", 360, 100, 25, 25)
GUICtrlSetBkColor(-1, 0x00FFFF)
$Button30 = GUICtrlCreateButton("", 392, 100, 25, 25)
GUICtrlSetBkColor(-1, 0xFF0000)
$Button31 = GUICtrlCreateButton("", 424, 100, 25, 25)
GUICtrlSetBkColor(-1, 0xFF00FF)
$Button32 = GUICtrlCreateButton("", 456, 100, 25, 25)
GUICtrlSetBkColor(-1, 0xFFFF00)
$Label1 = GUICtrlCreateLabel("Wähle die Textfarbe", 8, 8, 125, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("Wähle die Hintergrundfarbe", 9, 71, 168, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Button34 = GUICtrlCreateButton("", 536, 32, 137, 97)
GUICtrlSetBkColor(-1, $HFarbe)
GUICtrlSetState(-1, $GUI_DISABLE)
$Label3 = GUICtrlCreateLabel("AaBbCc", 544, 64, 122, 41)
GUICtrlSetFont(-1, 27, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, $TFarbe)
GUICtrlSetBkColor(-1, $HFarbe)
$OK = GUICtrlCreateButton("OK", 224, 160, 105, 33)
$Abbrechen = GUICtrlCreateButton("Abbrechen", 352, 160, 105, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Abbrechen
Exit
Case $OK
GUICtrlDelete($Form1)
Run("cmd.exe")
$cmdpromptwintitle = WinGetTitle( "cmd.exe" , "" )
Sleep(100)
WinSetState( $cmdpromptwintitle, "", @SW_ENABLE )
WinWaitActive($cmdpromptwintitle)
Sleep(100)
Send("color ")
Send($HFarbeH)
Send($TFarbeH)
Send("{ENTER}")
Exit
Case $Button1
$TFarbe = 0x000000
$TFarbeH = 0
GUICtrlSetColor($Label3, $TFarbe)
Case $Button3
$TFarbe = 0x000080
$TFarbeH = 1
GUICtrlSetColor($Label3, $TFarbe)
Case $Button4
$TFarbe = 0x008000
$TFarbeH = 2
GUICtrlSetColor($Label3, $TFarbe)
Case $Button5
$TFarbe = 0x008080
$TFarbeH = 3
GUICtrlSetColor($Label3, $TFarbe)
Case $Button6
$TFarbe = 0x800000
$TFarbeH = 4
GUICtrlSetColor($Label3, $TFarbe)
Case $Button7
$TFarbe = 0x800080
$TFarbeH = 5
GUICtrlSetColor($Label3, $TFarbe)
Case $Button8
$TFarbe = 0x808000
$TFarbeH = 6
GUICtrlSetColor($Label3, $TFarbe)
Case $Button9
$TFarbe = 0xC0C0C0
$TFarbeH = 7
GUICtrlSetColor($Label3, $TFarbe)
Case $Button10
$TFarbe = 0x808080
$TFarbeH = 8
GUICtrlSetColor($Label3, $TFarbe)
Case $Button11
$TFarbe = 0x0000FF
$TFarbeH = 9
GUICtrlSetColor($Label3, $TFarbe)
Case $Button12
$TFarbe = 0x00FF00
$TFarbeH = 0x41
GUICtrlSetColor($Label3, $TFarbe)
Case $Button13
$TFarbe = 0x00FFFF
$TFarbeH = 0x42
GUICtrlSetColor($Label3, $TFarbe)
Case $Button14
$TFarbe = 0xFF0000
$TFarbeH = 0x43
GUICtrlSetColor($Label3, $TFarbe)
Case $Button15
$TFarbe = 0xFF00FF
$TFarbeH = 0x44
GUICtrlSetColor($Label3, $TFarbe)
Case $Button16
$TFarbe = 0xFFFF00
$TFarbeH = 0x45
GUICtrlSetColor($Label3, $TFarbe)
Case $Button17
$TFarbe = 0xFFFFFF
$TFarbeH = 0x46
GUICtrlSetColor($Label3, $TFarbe)
Case $Button2
$HFarbe = 0xFFFFFF
$HFarbeH = 0x46
GUICtrlSetBkColor($Button34, $HFarbe)
GUICtrlSetBkColor($Label3, $HFarbe)
Case $Button18
$HFarbe = 0x008080
$HFarbeH = 3
GUICtrlSetBkColor($Button34, $HFarbe)
GUICtrlSetBkColor($Label3, $HFarbe)
Case $Button19
$HFarbe = 0x800080
$HFarbeH = 5
GUICtrlSetBkColor($Button34, $HFarbe)
GUICtrlSetBkColor($Label3, $HFarbe)
Case $Button20
$HFarbe = 0x800000
$HFarbeH = 4
GUICtrlSetBkColor($Button34, $HFarbe)
GUICtrlSetBkColor($Label3, $HFarbe)
Case $Button21
$HFarbe = 0x000000
$HFarbeH = 0
GUICtrlSetBkColor($Button34, $HFarbe)
GUICtrlSetBkColor($Label3, $HFarbe)
Case $Button22
$HFarbe = 0x000080
$HFarbeH = 1
GUICtrlSetBkColor($Button34, $HFarbe)
GUICtrlSetBkColor($Label3, $HFarbe)
Case $Button23
$HFarbe = 0x008000
$HFarbeH = 2
GUICtrlSetBkColor($Button34, $HFarbe)
GUICtrlSetBkColor($Label3, $HFarbe)
Case $Button24
$HFarbe = 0x808000
$HFarbeH = 6
GUICtrlSetBkColor($Button34, $HFarbe)
GUICtrlSetBkColor($Label3, $HFarbe)
Case $Button25
$HFarbe = 0xC0C0C0
$HFarbeH = 7
GUICtrlSetBkColor($Button34, $HFarbe)
GUICtrlSetBkColor($Label3, $HFarbe)
Case $Button26
$HFarbe = 0x808080
$HFarbeH = 8
GUICtrlSetBkColor($Button34, $HFarbe)
GUICtrlSetBkColor($Label3, $HFarbe)
Case $Button27
$HFarbe = 0x0000FF
$HFarbeH = 9
GUICtrlSetBkColor($Button34, $HFarbe)
GUICtrlSetBkColor($Label3, $HFarbe)
Case $Button28
$HFarbe = 0x00FF00
$HFarbeH = 0x41
GUICtrlSetBkColor($Button34, $HFarbe)
GUICtrlSetBkColor($Label3, $HFarbe)
Case $Button29
$HFarbe = 0x00FFFF
$HFarbeH = 0x42
GUICtrlSetBkColor($Button34, $HFarbe)
GUICtrlSetBkColor($Label3, $HFarbe)
Case $Button30
$HFarbe = 0xFF0000
$HFarbeH = 0x43
GUICtrlSetBkColor($Button34, $HFarbe)
GUICtrlSetBkColor($Label3, $HFarbe)
Case $Button31
$HFarbe = 0xFF00FF
$HFarbeH = 0x44
GUICtrlSetBkColor($Button34, $HFarbe)
GUICtrlSetBkColor($Label3, $HFarbe)
Case $Button32
$HFarbe = 0xFFFF00
$HFarbeH = 0x45
GUICtrlSetBkColor($Button34, $HFarbe)
GUICtrlSetBkColor($Label3, $HFarbe)
EndSwitch
WEnd

I added a Wingettitle code for you so that your program will work better as well as the include. I should let you know that not all colors are going to work as long as you are using the hex values. I do not have time to completely re-write the code for you, but I hope this at least helps and answers your question.

 

Ich hoffe, dass die oben genannte Lösung für Sie arbeitet.
Das Problem ist, dass Sie wissen, die Codes für die Eingabeaufforderung nicht. Aber das Skript funktioniert.
Ich bin mit einem Übersetzer. Ich hoffe, das bedeutet auch.

Edited by Draygoes
Spoiler

 

"If a vegetarian eats vegetables,What the heck does a humanitarian eat?"

"I hear voices in my head, but I ignore them and continue on killing."

"You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring."

An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist.

 

 
Link to comment
Share on other sites

While we're practicing necromancy, I'll alert you that sometimes when copying code to the forum it removes the includes.  It's either a text editing mode and or quotes verse <> include openers.  It may even be fixed by now, I have no idea.

Edited by Xandy
Link to comment
Share on other sites

EDIT: I just now realized that I was posting in an old thread. I got here from a users profile. Sorry everyone! Another for the necro thread I suppose right? >_<:idiot:

Edited by Draygoes
Spoiler

 

"If a vegetarian eats vegetables,What the heck does a humanitarian eat?"

"I hear voices in my head, but I ignore them and continue on killing."

"You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring."

An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist.

 

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

  • Recently Browsing   0 members

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