criticalmass Posted June 24, 2011 Share Posted June 24, 2011 Hey guys I wrote this script up but I am needing the RAM and Hard Drive fields to turn red if they do not meet the requirements. RAM 2 Gig Requirement and Hard Drive must have 10 gigs free so if the they do not meet the 2 gig or the 10 gig of free space i need that box to change red. expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include<CompInfo.au3> Opt('MustDeclareVars', 1) Dim $aMemoryInfo Dim $aProcessorInfo _ComputerGetMemory($aMemoryInfo) _ComputerGetProcessors($aProcessorInfo) Dim $objWMIService = objget("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") Dim $colMemory = $objWMIService.ExecQuery("Select * from Win32_ComputerSystem") _Main() Func _Main() Local $VOL, $SERIAL, $TOTAL, $FREE Local $Input_CurrentUserName, $Input_OperatingSystem Local $Input_ServicePack Local $Input_TotalSpace, $Input_FreeSpace, $Input_IpAddress Local $Input_DesktopDirectory Local $Input_MyDocumentsDirectory, $Input_ProgramFilesDirectory Local $Input_DesktopWidth, $Input_DesktopHeight Local $Input_Date, $Input_Time, $msg Local $Input_RAM Local $Input_Proc_Name Local $Input_Proc_Speed #forceref $Input_CurrentUserName, $Input_OperatingSystem #forceref $Input_ServicePack #forceref $Input_TotalSpace, $Input_FreeSpace, $Input_IpAddress #forceref $Input_DesktopDirectory #forceref $Input_MyDocumentsDirectory, $Input_ProgramFilesDirectory #forceref $Input_DesktopWidth, $Input_DesktopHeight #forceref $Input_Date, $Input_Time GUICreate("Can You Run Passport? - AGLA", 400, 400, (@DesktopWidth - 400) / 2, (@DesktopHeight - 400) / 2, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) Dim $pixelLeft = 10, $pixelTop = 40, $pixelWidth = 150, $pixelHeight = 20, $jump = 26 $VOL = DriveGetLabel("C:\") $SERIAL = DriveGetSerial("C:\") $TOTAL = DriveSpaceTotal("C:\") $FREE = DriveSpaceFree("C:\") GUICtrlCreateLabel("Current User Name", $pixelLeft, $pixelTop, $pixelWidth, $pixelHeight) $pixelTop = $pixelTop + $jump GUICtrlCreateLabel("Operating System", $pixelLeft, $pixelTop, $pixelWidth, $pixelHeight) $pixelTop = $pixelTop + $jump GUICtrlCreateLabel("32 = x86 or 64 = x64 Bit ", $pixelLeft, $pixelTop, $pixelWidth, $pixelHeight) $pixelTop = $pixelTop + $jump GUICtrlCreateLabel("Service Pack", $pixelLeft, $pixelTop, $pixelWidth, $pixelHeight) $pixelTop = $pixelTop + $jump GUICtrlCreateLabel("Proc Info", $pixelLeft, $pixelTop, $pixelWidth, $pixelHeight) $pixelTop = $pixelTop + $jump GUICtrlCreateLabel("CPU Speed", $pixelLeft, $pixelTop, $pixelWidth, $pixelHeight) $pixelTop = $pixelTop + $jump GUICtrlCreateLabel("RAM", $pixelLeft, $pixelTop, $pixelWidth, $pixelHeight) $pixelTop = $pixelTop + $jump GUICtrlCreateLabel("C: Total Space", $pixelLeft, $pixelTop, $pixelWidth, $pixelHeight) $pixelTop = $pixelTop + $jump GUICtrlCreateLabel("C: Free Space", $pixelLeft, $pixelTop, $pixelWidth, $pixelHeight) $pixelTop = $pixelTop + $jump GUICtrlCreateLabel("Ip Address", $pixelLeft, $pixelTop, $pixelWidth, $pixelHeight) $pixelTop = $pixelTop + $jump GUICtrlCreateLabel("Program File Directory", $pixelLeft, $pixelTop, $pixelWidth, $pixelHeight) $pixelTop = $pixelTop + $jump GUICtrlCreateLabel("Desktop Size (Pixels)", $pixelLeft, $pixelTop, $pixelWidth, $pixelHeight) $pixelTop = $pixelTop + $jump GUICtrlCreateLabel("Date and Time", $pixelLeft, $pixelTop, $pixelWidth, $pixelHeight) ; Input Fields $pixelTop = 40 $pixelLeft = 170 $pixelWidth = 200 $Input_CurrentUserName = GUICtrlCreateInput("" & @UserName, $pixelLeft, $pixelTop, $pixelWidth, $pixelHeight) $pixelTop = $pixelTop + $jump $Input_OperatingSystem = GUICtrlCreateInput("" & @OSVersion, $pixelLeft, $pixelTop, $pixelWidth, $pixelHeight) $pixelTop = $pixelTop + $jump $Input_ServicePack = GUICtrlCreateInput("" & @OSArch, $pixelLeft, $pixelTop, $pixelWidth, $pixelHeight) $pixelTop = $pixelTop + $jump $Input_ServicePack = GUICtrlCreateInput("" & @OSServicePack, $pixelLeft, $pixelTop, $pixelWidth, $pixelHeight) $pixelTop = $pixelTop + $jump $Input_ServicePack = GUICtrlCreateInput("" & $aProcessorInfo[1][0], $pixelLeft, $pixelTop, $pixelWidth, $pixelHeight) $pixelTop = $pixelTop + $jump $Input_ServicePack = GUICtrlCreateInput("" & $aProcessorInfo[1][23], $pixelLeft, $pixelTop, $pixelWidth, $pixelHeight) $pixelTop = $pixelTop + $jump For $object in $colMemory $Input_RAM = GUICtrlCreateInput("" & String(Int(Number($object.TotalPhysicalMemory) / (1024 * 1024))) & " Mb", $pixelLeft, $pixelTop, $pixelWidth, $pixelHeight) Next $pixelTop = $pixelTop + $jump $Input_TotalSpace = GUICtrlCreateInput("" & $TOTAL / 1024, $pixelLeft, $pixelTop, $pixelWidth, $pixelHeight) $pixelTop = $pixelTop + $jump $Input_FreeSpace = GUICtrlCreateInput("" & $FREE / 1024, $pixelLeft, $pixelTop, $pixelWidth, $pixelHeight) $pixelTop = $pixelTop + $jump $Input_IpAddress = GUICtrlCreateInput("" & @IPAddress1, $pixelLeft, $pixelTop, $pixelWidth, $pixelHeight) $pixelTop = $pixelTop + $jump $Input_ProgramFilesDirectory = GUICtrlCreateInput("" & @ProgramFilesDir, $pixelLeft, $pixelTop, $pixelWidth, $pixelHeight) $pixelTop = $pixelTop + $jump $Input_DesktopWidth = GUICtrlCreateInput("" & @DesktopWidth & " x " & @DesktopHeight, $pixelLeft, $pixelTop, $pixelWidth, $pixelHeight) $pixelTop = $pixelTop + $jump $Input_Date = GUICtrlCreateInput("" & @MON & "-" & @MDAY & "-" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC, $pixelLeft, $pixelTop, $pixelWidth, $pixelHeight) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;; EndSelect WEnd Exit EndFunc ;==>_Main Link to comment Share on other sites More sharing options...
iamtheky Posted June 24, 2011 Share Posted June 24, 2011 (edited) For $object in $colMemory $Input_RAM = GUICtrlCreateInput("" & String(Int(Number($object.TotalPhysicalMemory) / (1024 * 1024))) & " Mb", $pixelLeft, $pixelTop, $pixelWidth, $pixelHeight) Next If GuiCtrlRead ($Input_RAM) < 2000 Then GUICtrlSetColor (-1 , 0xFF0000) and $Input_FreeSpace = GUICtrlCreateInput("" & $FREE / 1024, $pixelLeft, $pixelTop, $pixelWidth, $pixelHeight) $pixelTop = $pixelTop + $jump If GuiCtrlRead ($Input_FreeSpace) < 10 Then GUICtrlSetColor (-1 , 0xFF0000) those were font, if you want the block to change to red, just change those GUICtrlSetColor to GuiCtrlSetBkColor Edited June 24, 2011 by iamtheky ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
criticalmass Posted June 24, 2011 Author Share Posted June 24, 2011 Thank you so much we got it going now 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