Memory meter (vertical level)

Awhile back rabidrobot sent me a memory meter which displays the level horizontally. I want it to display vertical, does anyone know how to change script so it displays vertical instead horizontally? I like it because if you have more than 2 or 3 gb's of memory it works, the stardock plugin one only works with up to 2 gb's. Well here's the script. Maybe someone can help..

'// Multi-Gig Memory Meter
'// Xander 'rabidrobot' Lih Jan 2007
'// http://feebdack.com
'// Please feel free to reuse in any form.


' Set Up Meter Refresher Object
Dim objWMIService, objRefresher, objRefreshItem
Set objWMIService = GetObject("winmgmts:root\cimv2")
Set objRefresher = CreateObject("WbemScripting.SWbemRefresher")
Set objRefreshItem = objRefresher.AddEnum(objWMIService, "Win32_PerfRawData_PerfOS_Memory").ObjectSet
objRefresher.Refresh

' Important DX-Objects
Dim dxViewbox, dxPercentText

' How often to update the meter in milliseconds.
Const REFRESH_RATE = 1000

' This is good to know - total PC RAM
Dim totalMemory

' Adjust these to fit custom graphics
Const MARG_LEFT = 4 ' Margin to left of zero on meter
Const MAX_WIDTH = 124 ' Total width of bar 100% used


'Called when the script is executed
Sub Object_OnScriptEnter
 ' I find it handy to nickname some objects - you can easily change these here.
 Set dxViewbox = DesktopX.Object("rr_RAM_Viewbox")
 Set dxPercentText = DesktopX.Object("rr_RAM_Percent_Text")
 
 ' Gather total memory available information
 Dim colItems, objItem
 Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48)
 totalMemory = 0
 For Each objItem In colItems
  totalMemory = totalMemory + objItem.TotalPhysicalMemory
 Next
 Set colItems = Nothing


 ' Start Monitor
 Object.SetTimer 111, REFRESH_RATE

End Sub

Sub Object_OnTimer111
 ' Update information in the refresher object
 objRefresher.Refresh
 ' The refresher is an enumeration, or list
 ' So we loop through it, even if it might have only one member
 Dim availableMemory, objItem, percentUsed
 availableMemory = 0
 For Each objItem In objRefreshItem
  ' Gather info - I only get AvailableBytes, but you could
  ' get any of the info listed in the OnLButtonUp sub too.
  availableMemory = availableMemory + objItem.AvailableBytes
 Next
 percentUsed = (totalMemory - availableMemory) / totalMemory
 ' Use handy nicknames
 dxViewbox.Width = CInt(percentUsed * MAX_WIDTH + MARG_LEFT)
 dxPercentText.Text = FormatNumber(percentUsed * 100, 0) & "%"
 ' Update other text objects you may have, e.g.
 ' DeaktopX.Object("FreeMemoryText").Text = FormatNumber(availableMemory / 1024^2, 1) & "MB Free"
 
End Sub

 

'Called when the script is terminated
Sub Object_OnScriptExit
 Set objWMIService = Nothing
 Set objRefresher = Nothing
 Set dxViewbox = Nothing
 Set dxPercentText = Nothing
End Sub

7,648 views 6 replies
Reply #1 Top
Here's a couple hints:
- Where you see the word "width" change to Height. (Including variables)
- Where you see the word "left" change to Bottom (If zero is at the bottom)
Reply #2 Top
yeah work fine for me.. :HOT:
Reply #3 Top
Thank I'll try it... :)It displays vertical now but instead of going upwards it displays downwards..
Reply #4 Top
Won't work going down vertical, any suggestions anyone?
Reply #5 Top
Most likely you need to adjust the math formulas.