Sign in to follow this  
Followers 0
jdisme

Help me with my first GUI?

5 posts in this topic

Hey everyone, I am working on my first GUI, it is a program to find the Specs of a Computer.

;System Spec Program
;Written By: Jdisme
#include <GUIConstants.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 = 500
$GUIHeight = 500

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

GUISetState()

$RAMbtn = GUICtrlCreateButton ( "Calculate Ram", 25 , 25 , 100 , 50)
$CPUbtn = GUICtrlCreateButton ( "Calculate CPU", 25 , 100 , 100 , 50)
$HD = GUICtrlCreateButton ( "Calculate HD space", 25 , 175 , 100 , 50)
$gfxbtn = GUICtrlCreateButton ( "Video card", 25, 250, 100, 50)

Do
    
    $msg = GUIGetMsg()
    
    Select 
    Case $msg = $RAMbtn
        MsgBox(0, "Total physical RAM:", Execute("$MB[1]/1000") & " MB")
        
    Case $msg = $CPUbtn
        MsgBox(0, "Cpu speed", Execute ("$Ghz/1000") & " Ghz")
        
    Case $msg = $HD
        MsgBox (0, "HD space", Floor ($hdf) & " out of " & Floor ($hdt))
        
    Case $msg = $gfxbtn
        MsgBox (0, "Graphics card", ($gfx))
    EndSelect
Until $msg = $GUI_EVENT_CLOSE

I know its not pretty, but that comes later.

I was wondering, how would i go about making the values returned by a button press appear next to the button rather than using a message box.

Also, how would I make a button that calculates all of the specs?

Finally, Anyone know any other specs that would be good for people to know?

Thanks in advance.

Share this post


Link to post
Share on other sites



You might be interested in this.


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

Share this post


Link to post
Share on other sites

I was wondering, how would i go about making the values returned by a button press appear next to the button rather than using a message box.

Just create a Label control next to the button with GuiCtrlCreateLabel(), save the control ID in a variable, and change the text anytime with GuiCtrlSetData().

Also, how would I make a button that calculates all of the specs?

Detect the button in your GuiGetMsg() loop and then do what's required. See the example script for GuiGetMsg() in the help file.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

You might be interested in this.

It looks really helpful, however do you think you could tell me how to use those? haha.

Share this post


Link to post
Share on other sites

It looks really helpful, however do you think you could tell me how to use those? haha.

Download the CompInfo.au3 file from the post to your script directory. Then include it at the top of your script like so:

#include<CompInfo.au3>

You can then use all of the functions in the UDF (User Defined Function) library such as _ComputerGetOSs, etc. There is a CompInfoExamples.au3 file in that topic as well; it should give you a good idea of how to use the UDF library.


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

Share this post


Link to post
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
Sign in to follow this  
Followers 0