Lets all help me make some Dxmetres!

Friday, August 4, 2006 by Jaramia | Discussion: DesktopX

Well i would like to make some simple Dxmetres (Memory, C drive and RAM) I know how to make the basic Performance metres but i dont know how to make the Percentage on the side...and does anyone have anyother additional features i could add to this? (i am using this for my personal use)
thomassen
Reply #1 Friday, August 4, 2006 12:14 PM
You want some text to go along side the meter to display the percentage value? I'm pretty sure there's examples of that in the gallery. Have a look at them and see how they are made.
Jaramia
Reply #2 Friday, August 4, 2006 11:19 PM
k thanks!
Cyberium
Reply #3 Sunday, August 6, 2006 2:47 PM
I actually made a little object displaying the amount of Free RAM and a percentage next to it using WMI - drawback is currently you have to manually code the amout of RAM there is for it to work out the percentage... I will post the code for it when I get home from work for ya
Cyberium
Reply #4 Sunday, August 6, 2006 7:24 PM
Okidokes! Ready for the Code?!

Dim WMI, CI, x2

Sub Object_OnScriptEnter
Set WMI = GetObject("winmgmts:\\.\root\cimv2")
x2 = DesktopX.Object("TotalRAM").Text 'This is a seperate object using DesktopX System Information plugin to get the amount of System Memory, you can replace x2 with the actual amount of RAM (i.e. 512, 256, etc etc)
Object.SetTimer 1, 1000
Object_OnTimer1
End Sub

Sub Object_OnTimer1
Set CI = WMI.ExecQuery("Select * From Win32_PerfFormattedData_PerfOS_Memory",,48)
For Each OI In CI
x = OI.AvailableMBytes/x2 * 100 ' This sorts the percentage bit out
Object.Text = "Free RAM: " & OI.AvailableMBytes & "MB" & " (" & Round(x,0) & "%)" 'The Round function just rounds the percentage to 0 Decimal places, to give a whole percentage
Next
End Sub

Sub Object_OnScriptExit
Set WMI = Nothing
Object.KillTimer 1
End Sub

And there we have it a Free RAM display with Percentage

Please login to comment and/or vote for this skin.

Welcome Guest! Please take the time to register with us.
There are many great features available to you once you register, including:

  • Richer content, access to many features that are disabled for guests like commenting on the forums and downloading skins.
  • Access to a great community, with a massive database of many, many areas of interest.
  • Access to contests & subscription offers like exclusive emails.
  • It's simple, and FREE!



web-wc01