Jump to content

Reading and reporting RAM [SOLVED - bad variable assignment]


Recommended Posts

I am creating a little script that displays the current RAM in "#### MB" format but am having issues.

The function for which I set the $RAM variable is this.

$RAM = GetRAM()

Func GetRAM()
$Ramvar = MemGetStats()
$Ram1 = $Ramvar[1] / 1024
$Ram2 = StringSplit($Ram1, ".")
$Ram3 = $Ram2[1] & " MB"
ConsoleWrite($Ram3)
Return $Ram3
EndFunc

While it ConsoleWrites the correct value, when I call it with GUICtrlCreateLabel, all I get is the number 9(Not even one of the numbers in the console.)

Also I was trying to make it shorter with something like this but it doesn't even write a value to the console, and I still get a 9.

$Ramvar = MemGetStats()
$Ram1 = StringSplit(($Ramvar[1] / 1024), ".") & " MB"
ConsoleWrite($Ram1)

So does anyone know the cause of the 9 or why it stops writing to the console?

Edited by blckpythn
Link to comment
Share on other sites

Post the code where you set the label and we might see what's wrong.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Link to comment
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
 Share

×
×
  • Create New...