Jump to content

My first GUI


Recommended Posts

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.

;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

This will make the button text red.

GuiCtrlSetColor($calculate, 0xff0000)
Edited 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

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

looks better with a "red button"

;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)

NEWHeader1.png

Link to comment
Share on other sites

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 :-)

;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

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