Jump to content

GUICtrlCreateInput Colors


Recommended Posts

Hello i made a little simpel script to see what tools there are in a machine.

Is it possible to change the color if the tools or not Boor 14, Boor 18, Boor 22, Boor 26, Boor 29 please?

These are the standard tools...

#NoTrayIcon
#include <GUIConstants.au3>

AdlibEnable("ReduceMemory", 5000)
Func ReduceMemory($i_PID = -1)
    Local $ai_R = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
    Return $ai_R[0]
EndFunc

DirCreate(@TempDir & "\WBZ1500")
FileInstall("WBZ1500.pdf", @TempDir & "\WBZ1500\WBZ1500.pdf",1)
$topic = @TempDir & "\WBZ1500\WBZ1500.pdf"
FileInstall("Iemants.bmp", @TempDir & "\WBZ1500\Iemants.bmp",1)
$Picture = @TempDir & "\WBZ1500\Iemants.bmp"

Global $INIFile = "Boren WBZ.ini"
Global $wbzboor1 = INIRead($INIFile,"WBZ 1500","Boor T1","Boor 14")
Global $wbzboor2 = INIRead($INIFile,"WBZ 1500","Boor T2","Boor 18")
Global $wbzboor3 = INIRead($INIFile,"WBZ 1500","Boor T3","Boor 22")
Global $wbzboor4 = INIRead($INIFile,"WBZ 1500","Boor T4","Boor 26")
Global $wbzboor5 = INIRead($INIFile,"WBZ 1500","Boor T5","Boor 29")
Global $sec = @SEC, $minute, $hour, $time, $mday, $mon, $year, $clocklabel

$GUI = GUICreate("WBZ 1500", 210, 245, @DesktopWidth-220, 5)
GUISetBkColor(0x00008B)
$Boor1 = GUICtrlCreateLabel("Boor T1:",5,8,95,30)
GUICtrlSetColor($Boor1, 0xFFFFFF)
GUICtrlSetFont($Boor1, 18)
$Boor2 = GUICtrlCreateLabel("Boor T2:",5,43,95,30)
GUICtrlSetColor($Boor2, 0xFFFFFF)
GUICtrlSetFont($Boor2, 18)
$Boor3 = GUICtrlCreateLabel("Boor T3:",5,78,95,30)
GUICtrlSetColor($Boor3, 0xFFFFFF)
GUICtrlSetFont($Boor3, 18)
$Boor4 = GUICtrlCreateLabel("Boor T4:",5,113,95,30)
GUICtrlSetColor($Boor4, 0xFFFFFF)
GUICtrlSetFont($Boor4, 18)
$Boor5 = GUICtrlCreateLabel("Boor T5:",5,148,95,30)
GUICtrlSetColor($Boor5, 0xFFFFFF)
GUICtrlSetFont($Boor5, 18)

$wboor1 = GUICtrlCreateInput($wbzboor1,100,5,105,30)
GUICtrlSetColor($wboor1, 0x00008B)
GUICtrlSetFont($wboor1, 18)
$wboor2 = GUICtrlCreateInput($wbzboor2,100,40,105,30)
GUICtrlSetColor($wboor2, 0x00008B)
GUICtrlSetFont($wboor2, 18)
$wboor3 = GUICtrlCreateInput($wbzboor3,100,75,105,30)
GUICtrlSetColor($wboor3, 0x00008B)
GUICtrlSetFont($wboor3, 18)
$wboor4 = GUICtrlCreateInput($wbzboor4,100,110,105,30)
GUICtrlSetColor($wboor4, 0x00008B)
GUICtrlSetFont($wboor4, 18)
$wboor5 = GUICtrlCreateInput($wbzboor5,100,145,105,30)
GUICtrlSetColor($wboor5, 0x00008B)
GUICtrlSetFont($wboor5, 18)
$clocklabel = GUICtrlCreateLabel("", 12, 182, 123, 53, 0x1000)
GUICtrlSetBkColor($clocklabel, 0xFFFFFF)
GUICtrlSetColor($clocklabel, 0x00008B)
GUICtrlSetFont($clocklabel, 18)
$Button = GUICtrlCreateButton("", 145, 182, 53, 53, $BS_BITMAP)
GUICtrlSetImage(-1, $Picture)
GuiSetState()
GUICtrlSetData($clocklabel, TimeSet())

While 1
  $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then
        INIWrite($INIFile,"WBZ 1500","Boor T1",$wbzboor1)
        INIWrite($INIFile,"WBZ 1500","Boor T2",$wbzboor2)
        INIWrite($INIFile,"WBZ 1500","Boor T3",$wbzboor3)
        INIWrite($INIFile,"WBZ 1500","Boor T4",$wbzboor4)
        INIWrite($INIFile,"WBZ 1500","Boor T5",$wbzboor5)
        GUISetState(@SW_HIDE)
        Sleep(100)
        Set_Exit()
    EndIf
    If $msg = -3 Then
        ExitLoop
    ElseIf $sec <> @SEC Then
        GUICtrlSetData($clocklabel, TimeSet())
    EndIf
    If $msg = $Button Then
        Run(@ComSpec & " /c " & '"' &  $topic & '"',"",@SW_HIDE)
    EndIf

$wbzboor1 = GUICtrlRead($wboor1)
$wbzboor2 = GUICtrlRead($wboor2)
$wbzboor3 = GUICtrlRead($wboor3)
$wbzboor4 = GUICtrlRead($wboor4)
$wbzboor5 = GUICTRLRead($wboor5)
WEnd

Func TimeSet()
    $hour = @HOUR
    $minute = @MIN
    $sec = @SEC
    $mday = @MDAY
    $mon = @MON
    $year = @YEAR
    $time = $hour & ":" & $minute & ":" & $sec & @CRLF & $mday & "-" & $mon & "-" & $year
    Return $time
EndFunc

Func Set_Exit()
    AdlibDisable()
    DirRemove(@TempDir & "\WBZ1500", 1)
    Sleep(100)
    Exit
EndFunc
Edited by Mosquitos

Sapiente vince, rex, noli vincere ferro!

Link to comment
Share on other sites

Is it possible to change the color if the tools or not Boor 14, Boor 18, Boor 22, Boor 26, Boor 29 please?

I don't sure if i understand... what you trying to do? where the problem? :whistle: if you want to change the color of Input... well, you did it, if you want to set color of input by condition, the just use If and Then statement :P

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

I don't sure if i understand... what you trying to do? where the problem? :whistle: if you want to change the color of Input... well, you did it, if you want to set color of input by condition, the just use If and Then statement :P

Yes but GUICtrlSetColor($Boor..., 0xFFFFFF) is the color for the standard tools.

If its not a standard tool i want a other color :D

I try it with the if and then but then the application chrash

Edited by Mosquitos

Sapiente vince, rex, noli vincere ferro!

Link to comment
Share on other sites

Nobody?

This is what i have now...

$wboor1 = GUICtrlCreateInput($wbzboor1,100,5,105,30)
GUICtrlSetFont($wboor1, 18)
If GUICtrlRead($wboor1) = "Boor 14" Then
   GUICtrlSetColor($wboor1, 0x00008B)
Else
   GUICtrlSetColor($wboor1, 0xff0000)
EndIf
$wboor2 = GUICtrlCreateInput($wbzboor2,100,40,105,30)
GUICtrlSetFont($wboor2, 18)
If GUICtrlRead($wboor2) = "Boor 18" Then
   GUICtrlSetColor($wboor2, 0x00008B)
Else
   GUICtrlSetColor($wboor2, 0xff0000)
EndIf
$wboor3 = GUICtrlCreateInput($wbzboor3,100,75,105,30)
GUICtrlSetFont($wboor3, 18)
If GUICtrlRead($wboor3) = "Boor 22" Then
   GUICtrlSetColor($wboor3, 0x00008B)
Else
   GUICtrlSetColor($wboor3, 0xff0000)
EndIf
$wboor4 = GUICtrlCreateInput($wbzboor4,100,110,105,30)
GUICtrlSetFont($wboor4, 18)
If GUICtrlRead($wboor4) = "Boor 26" Then
   GUICtrlSetColor($wboor4, 0x00008B)
Else
   GUICtrlSetColor($wboor4, 0xff0000)
EndIf
$wboor5 = GUICtrlCreateInput($wbzboor5,100,145,105,30)
GUICtrlSetFont($wboor5, 18)
If GUICtrlRead($wboor5) = "Boor 29" Then
   GUICtrlSetColor($wboor5, 0x00008B)
Else
   GUICtrlSetColor($wboor5, 0xff0000)
EndIf

But is it possible when i change a input that the color change inmiddelty when i push enter or tab please?

Edited by Mosquitos

Sapiente vince, rex, noli vincere ferro!

Link to comment
Share on other sites

But is it possible when i change a input that the color change inmiddelty when i push enter or tab please?

You will have to check user's input...

If _IsPressed("09") Or Is _IsPressed("0D") Then GUICtrlSetColor($wboor1, 0x00008B)

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

I put this in the source...

HotKeySet("{ENTER}", "Save")

Func Save()
    Local $opt = Opt("WinTitleMatchMode", 4)
    If WinGetHandle("active") = $GUI Then
      If @HotKeyPressed = "{ENTER}" Then
        INIWrite($INIFile,"WBZ 1500","Boor T1",$wbzboor1)
        INIWrite($INIFile,"WBZ 1500","Boor T2",$wbzboor2)
        INIWrite($INIFile,"WBZ 1500","Boor T3",$wbzboor3)
        INIWrite($INIFile,"WBZ 1500","Boor T4",$wbzboor4)
        INIWrite($INIFile,"WBZ 1500","Boor T5",$wbzboor5)
        Sleep(100)
        Restart()
    EndIf
    Else
        HotKeySet(@HotKeyPressed)
        Send(@HotKeyPressed)
        HotKeySet(@HotKeyPressed, "Save")
    EndIf
    Opt("WinTitleMatchMode", $opt)
EndFunc

Func Restart()
    If @Compiled = 1 Then
        Run( FileGetShortName(@ScriptFullPath))
    Else
        Run( FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath))
    EndIf
    Exit
EndFunc

If someone has a other solution be my gast :">

MsCreator thanks for the help :whistle:

Sapiente vince, rex, noli vincere ferro!

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...