jdisme Posted June 9, 2008 Share Posted June 9, 2008 I was just wondering how I would go about giving the button a different text color? i tried "GUICtrlColor" but I'm too stupid to get it to work I think. expandcollapse popup;System Spec Program ;Written By: Jdisme #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> Global $GUIWidth Global $GUIHeight TrayTip ("Jdisme's System Specs", "This is a program I wrote in AutoIt for finding the specs of computers", 20) $GUIWidth = 425 $GUIHeight = 500 $font = "Comic Sans MS" $gfx = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E968-E325-11CE-BFC1-08002BE10318}\0000", "DriverDesc") $hdt = DriveSpaceTotal( "c:\" ) $hdf = DriveSpaceFree( "c:\" ) $MB = MemGetStats() $Ghz = RegRead("HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor\0", "~MHz") $MYGUI = GUICreate ("System Specs", $GUIWidth, $GUIHeight) GUISetBkColor(000000) GUICtrlSetdefColor(0xFFFFFF) GUISetState() GUISetFont(12, 400, 4, $font) GUICtrlCreateLabel ("Total physical RAM:", 140, 20, 400, 50) GUICtrlCreateLabel ("Cpu speed:", 175, 95, 400, 50) GUICtrlCreateLabel ("HD space (MB):", 160, 170, 400, 50) GUICtrlCreateLabel ("Graphics card:", 165, 245, 400, 50) GUISetFont(9, 400, 2, $font) $calculate = GUICtrlCreateButton("Calculate specs", 165, 400, 100, 50) GUISetFont(8, 400, "", $font) Do $msg = GUIGetMsg() Select Case $msg = $calculate GUICtrlCreateLabel (Execute("$MB[1]/1000") & "MB", 185, 45, 400, 50) GUICtrlCreateLabel (Execute ("$Ghz/1000") & " Ghz", 190, 125, 400, 50) GUICtrlCreateLabel (Floor ($hdf) & " free" & " out of " & Floor ($hdt) & " total", 150, 200, 400, 50) GUICtrlCreateLabel (($gfx), 120, 275, 400, 50) EndSelect Until $msg = $GUI_EVENT_CLOSE Link to comment Share on other sites More sharing options...
Airwolf Posted June 9, 2008 Share Posted June 9, 2008 (edited) This will make the button text red. GuiCtrlSetColor($calculate, 0xff0000) Edited June 9, 2008 by Airwolf123 Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt Link to comment Share on other sites More sharing options...
k3v Posted June 9, 2008 Share Posted June 9, 2008 look at GUICtrlSetColor() in the help file.You can find hex values for colors on the web... (eg: http://www.w3schools.com/Html/html_colors.asp(hex values should be notated with 0x(etc.) eg: 0xFF0000 = red Link to comment Share on other sites More sharing options...
jdisme Posted June 9, 2008 Author Share Posted June 9, 2008 I tried that but cant get it to work Link to comment Share on other sites More sharing options...
Airwolf Posted June 9, 2008 Share Posted June 9, 2008 I tried that but cant get it to work I modified my previous post to show you an example. It should work. Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt Link to comment Share on other sites More sharing options...
k3v Posted June 9, 2008 Share Posted June 9, 2008 can you post an example of your attempt? Link to comment Share on other sites More sharing options...
Valuater Posted June 9, 2008 Share Posted June 9, 2008 looks better with a "red button" expandcollapse popup;System Spec Program ;Written By: Jdisme #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> Global $GUIWidth Global $GUIHeight TrayTip("Jdisme's System Specs", "This is a program I wrote in AutoIt for finding the specs of computers", 20) $GUIWidth = 425 $GUIHeight = 500 $font = "Comic Sans MS" $gfx = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E968-E325-11CE-BFC1-08002BE10318}\0000", "DriverDesc") $hdt = DriveSpaceTotal("c:\") $hdf = DriveSpaceFree("c:\") $MB = MemGetStats() $Ghz = RegRead("HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor\0", "~MHz") $MYGUI = GUICreate("System Specs", $GUIWidth, $GUIHeight) GUISetBkColor(000000) GUICtrlSetDefColor(0xFFFFFF) GUISetState() GUISetFont(12, 400, 4, $font) GUICtrlCreateLabel("Total physical RAM:", 140, 20, 400, 50) GUICtrlCreateLabel("Cpu speed:", 175, 95, 400, 50) GUICtrlCreateLabel("HD space (MB):", 160, 170, 400, 50) GUICtrlCreateLabel("Graphics card:", 165, 245, 400, 50) GUISetFont(9, 400, 2, $font) $calculate = GUICtrlCreateButton("Calculate specs", 165, 400, 100, 50) GUICtrlSetBkColor($calculate, 0xff0000) GUISetFont(8, 400, "", $font) Do $msg = GUIGetMsg() Select Case $msg = $calculate GUICtrlCreateLabel(Execute("$MB[1]/1000") & "MB", 185, 45, 400, 50) GUICtrlCreateLabel(Execute("$Ghz/1000") & " Ghz", 190, 125, 400, 50) GUICtrlCreateLabel(Floor($hdf) & " free" & " out of " & Floor($hdt) & " total", 150, 200, 400, 50) GUICtrlCreateLabel(($gfx), 120, 275, 400, 50) EndSelect Until $msg = $GUI_EVENT_CLOSE 8) Link to comment Share on other sites More sharing options...
jdisme Posted June 9, 2008 Author Share Posted June 9, 2008 Thanks for the help guys, so what do you think about the program? Link to comment Share on other sites More sharing options...
nobbe Posted June 10, 2008 Share Posted June 10, 2008 for your first gui its fine i changed some things to run with autoit 3.2.10 version ( i couldnt see anything on the labels :-) expandcollapse popup;System Spec Program ;Written By: Jdisme #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> Global $GUIWidth Global $GUIHeight TrayTip("Jdisme's System Specs", "This is a program I wrote in AutoIt for finding the specs of computers", 20) $GUIWidth = 425 $GUIHeight = 500 $font = "Comic Sans MS" $gfx = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E968-E325-11CE-BFC1-08002BE10318}\0000", "DriverDesc") $hdt = DriveSpaceTotal("c:\") $hdf = DriveSpaceFree("c:\") $MB = MemGetStats() $Ghz = RegRead("HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor\0", "~MHz") $MYGUI = GUICreate("System Specs", $GUIWidth, $GUIHeight) GUISetFont(12, 400, 4, $font) GUICtrlCreateLabel("Total physical RAM:", 140, 20, 400, 50) GUICtrlCreateLabel("Cpu speed:", 175, 95, 400, 50) GUICtrlCreateLabel("HD space (MB):", 160, 170, 400, 50) GUICtrlCreateLabel("Graphics card:", 165, 245, 400, 50) GUISetFont(9, 400, 2, $font) $calculate = GUICtrlCreateButton("Calculate specs", 165, 400, 100, 50) GUICtrlSetBkColor($calculate, 0xff0000) GUISetFont(8, 400, "", $font) GUISetState() Do $msg = GUIGetMsg() Select Case $msg = $calculate GUICtrlCreateLabel(Execute("$MB[1]/1000") & "MB", 185, 45, 400, 50) GUICtrlCreateLabel(Execute("$Ghz/1000") & " Ghz", 190, 125, 400, 50) GUICtrlCreateLabel(Floor($hdf) & " free" & " out of " & Floor($hdt) & " total", 150, 200, 400, 50) GUICtrlCreateLabel(($gfx), 120, 275, 400, 50) EndSelect Until $msg = $GUI_EVENT_CLOSE Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now