Particle Posted May 31, 2008 Share Posted May 31, 2008 Alright well i've been working on a little cpu information program and i've been trying to get the adlibenable to work correctly so that it is in constant update at all times. I got the original idea from Memory Fusion(search forums if needed.) I can't really understand if a syntax is incorrect or what, but my adlib isn't working how I want it to be... Help? expandcollapse popup#include <GuiConstants.au3> #Include <Constants.au3> ;Variables Global $fUpdateMeminfo = True Global $memstats = MemGetStats() Global $fixed Global $fixedtotalspace Global $fixedfreespace Global $fixedfiletype Global $disc Global $disctotalspace Global $discfreespace Global $discfiletype Global $removable Global $removabletotalspace Global $removablefreespace Global $removablefiletype Global $network Global $networktotalspace Global $networkfreespace Global $networkfiletype Global $Percent = "0" Global $Array[1][11] #Region ### START Koda GUI section ### Form= $SKAgent = GUICreate("System Kore Agent", 675, 215, 348, 500) ;MainMenus $MenuItem1 = GUICtrlCreateMenu("File") $MenuItem4 = GUICtrlCreateMenuItem("Save .txt", $MenuItem1) $MenuItem5 = GUICtrlCreateMenuItem("Exit", $MenuItem1) $MenuItem2 = GUICtrlCreateMenu("Options") $MenuItem6 = GUICtrlCreateMenuItem("Basic Setup", $MenuItem2) $MenuItem7 = GUICtrlCreateMenuItem("Advanced Setup", $MenuItem2) $MenuItem8 = GUICtrlCreateMenu("Monitor", $MenuItem2) $MenuItem9 = GUICtrlCreateMenuItem("On", $MenuItem8) $MenuItem10 = GUICtrlCreateMenuItem("°Off", $MenuItem8) $MenuItem11 = GUICtrlCreateMenu("Refresh Rate", $MenuItem2) $MenuItem12 = GUICtrlCreateMenuItem("°Slug", $MenuItem11) $MenuItem13 = GUICtrlCreateMenuItem("Slow", $MenuItem11) $MenuItem14 = GUICtrlCreateMenuItem("Moderate", $MenuItem11) $MenuItem15 = GUICtrlCreateMenuItem("Fast", $MenuItem11) $MenuItem16 = GUICtrlCreateMenuItem("Cheetah", $MenuItem11) $MenuItem3 = GUICtrlCreateMenu("Help") $MenuItem17 = GUICtrlCreateMenuItem("About...", $MenuItem3) $MenuItem18 = GUICtrlCreateMenuItem("Readme.txt", $MenuItem3) $MenuItem19 = GUICtrlCreateMenuItem("Homepage", $MenuItem3) ;GuiControls $HDTempInput = GUICtrlCreateInput("", 128, 10, 41, 21) $HDCriticalInput = GUICtrlCreateInput("", 128, 42, 41, 21) $HDPassiveInput = GUICtrlCreateInput("", 128, 74, 41, 21) GUICtrlCreateLabel("CPU Core Temperature", 8, 10, 114, 17) GUICtrlCreateLabel("Critical Max Temperature", 4, 42, 121, 17) GUICtrlCreateLabel("Passive Min Temperature", 4, 74, 124, 17) $Progress1 = GUICtrlCreateProgress(8, 158, 345, 20) $Label7 = GUICtrlCreateLabel("Memory Load: " & $Percent & "%", 8, 134, 92, 17) GUICtrlCreateLabel("Sampling Period", 46, 104, 124, 17) $SamplingPeriod = GUICtrlCreateInput("", 128, 104, 41, 21) #EndRegion ### END Koda GUI section ### ;Disable Inputs GuiCtrlSetState($HDTempInput,$GUI_DISABLE) GuiCtrlSetState($HDCriticalInput,$GUI_DISABLE) GuiCtrlSetState($HDPassiveInput,$GUI_DISABLE) GuiCtrlSetState($SamplingPeriod,$GUI_DISABLE) ;Detect Drives by Jesse Griffin $fixedlistview = GUICtrlCreateListView("Drive|Total Space(MB)|Free Space(MB)|File Type", 362, 10, 306, 180) $fixed = DriveGetDrive("fixed") If Not @error Then For $i = 1 To $fixed[0] $fixedtotalspace = DriveSpaceTotal($fixed[$i]) $fixedfreespace = DriveSpaceFree($fixed[$i]) $fixedfiletype = DriveGetFileSystem($fixed[$i]) GUICtrlCreateListViewItem($fixed[$i] & "|" & Round($fixedtotalspace) & "|" & Round($fixedfreespace) & "|" & $fixedfiletype, $fixedlistview) Next EndIf $disc = DriveGetDrive("cdrom") If Not @error Then For $i = 1 To $disc[0] $disctotalspace = DriveSpaceTotal($disc[$i]) $discfreespace = DriveSpaceFree($disc[$i]) $discfiletype = DriveGetFileSystem($disc[$i]) GUICtrlCreateListViewItem($disc[$i] & "|" & Round($disctotalspace) & "|" & Round($discfreespace) & "|" & $discfiletype, $fixedlistview) Next EndIf $removable = DriveGetDrive("removable") If Not @error Then For $i = 1 To $removable[0] $removabletotalspace = DriveSpaceTotal($removable[$i]) $removablefreespace = DriveSpaceFree($removable[$i]) $removablefiletype = DriveGetFileSystem($removable[$i]) GUICtrlCreateListViewItem($removable[$i] & "|" & Round($removabletotalspace) & "|" & Round($removablefreespace) & "|" & $removablefiletype, $fixedlistview) Next EndIf $network = DriveGetDrive("network") If Not @error Then For $i = 1 To $network[0] $networktotalspace = DriveSpaceTotal($network[$i]) $networkfreespace = DriveSpaceFree($network[$i]) $networkfiletype = DriveGetFileSystem($network[$i]) GUICtrlCreateListViewItem($network[$i] & "|" & Round($networktotalspace) & "|" & Round($networkfreespace) & "|" & $networkfiletype, $fixedlistview) Next EndIf GUISetState(@SW_SHOW) Refresh() AdlibEnable("Refresh", 500) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit EndIf WEnd Func Refresh() $i = 100 While 1 $i = $i + 10 If $i > 100 And $fUpdateMeminfo = True Then $fs = ObjCreate("Scripting.FileSystemObject") $wbemServices = ObjGet("winmgmts:" & "\\localhost\root\wmi") $wbemObjectSet = $wbemServices.InstancesOf("MSAcpi_ThermalZoneTemperature") Dim $Array[1][11] For $Item in $wbemObjectSet $Array[0][0] = ($Item.CurrentTemperature - 2732) / 10 & "°C" $Array[0][1] = $Item.InstanceName $Array[0][2] = $Item.ActiveTripPoint $Array[0][3] = $Item.ActiveTripPointCount $Array[0][4] = $Item.Reserved $Array[0][5] = $Item.SamplingPeriod $Array[0][6] = $Item.ThermalConstant1 $Array[0][7] = $Item.ThermalConstant2 $Array[0][8] = $Item.ThermalStamp $Array[0][9] = ($Item.PassiveTripPoint - 2732) / 10 & "°C" $Array[0][10] = ($Item.CriticalTripPoint - 2732) / 10 & "°C" Next $memstats = MemGetStats() GuiCtrlSetData($HDTempInput,$Array[0][0]) GuiCtrlSetData($HDCriticalInput,$Array[0][10]) GuiCtrlSetData($HDPassiveInput,$Array[0][9]) GuiCtrlSetData($SamplingPeriod,$Array[0][5]) GuiCtrlSetData($Label7,"Memory Load: " & $memstats[0] & "%") GUICtrlSetData($Progress1,$memstats[0]) ExitLoop EndIf WEnd EndFunc Link to comment Share on other sites More sharing options...
Developers Jos Posted May 31, 2008 Developers Share Posted May 31, 2008 (edited) You forgot to tell us "want you want" only that it doesnt work as you want. What is this part supposed to do? $i = 100 While 1 $i = $i + 10 If $i > 100 And $fUpdateMeminfo = True Then Why use Dim $Array[1][11] in stead of Dim $Array[11] ? Or even why use an Array at all and use this: GuiCtrlSetData($HDTempInput,($Item.CurrentTemperature - 2732) / 10 & "°C") ? Edited May 31, 2008 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Particle Posted May 31, 2008 Author Share Posted May 31, 2008 (edited) it's suppose to make it just go on in a forever loop, prolly not neccessary. forgive me that i kinda just threw this code together in the past 24 hours. what i want is a constant update of memory usage and core temperatures used with adlib so it's like a live feed to see whats going on at all times. like i mentioned, search for Memory Fusion if u dont understand what im asking for. Edit: The array is like that because i've been rewritting the code over and over and changing things up dramatically. so some code might not be fully corrected but still should work fine. Edited May 31, 2008 by Particle Link to comment Share on other sites More sharing options...
Developers Jos Posted May 31, 2008 Developers Share Posted May 31, 2008 it's suppose to make it just go on in a forever loop, prolly not neccessary. forgive me that i kinda just threw this code together in the past 24 hours.what i want is a constant update of memory usage and core temperatures used with adlib so it's like a live feed to see whats going on at all times. like i mentioned, search for Memory Fusion if u dont understand what im asking for.No need for me to search.The adlib function will ensure that the Refresh() udf is called every 500Ms, so you do not want a loop in this UDF.Just clean that up and tell us if that works or not.Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Particle Posted May 31, 2008 Author Share Posted May 31, 2008 well that was simple....works fine now lol, thanks 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