Sign in to follow this  
Followers 0
blckpythn

Reading and reporting RAM [SOLVED - bad variable assignment]

4 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Try this

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

Share this post


Link to post
Share on other sites

Sorry guys figured it out. I had used the $RAM variable to create a different GUI Label...I feel stupid. Thanks for your help though.

Danyfirex, for the record all that did was remove the " MB" portion for some reason.

Share this post


Link to post
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
Sign in to follow this  
Followers 0

  • Similar Content

    • VIP
      By VIP
      The simple widget shows the percentage of cpu, ram used and the CPU temperature.
      - Sleep Time: 2s for apdate GUI info.
      - Every 30s check, sync and update time for computer.
      - Every 60s auto Reduce Memory.
      - If you want it to run at startup, copy or create shortcut at: "%ProgramData%\Data\Microsoft\Windows\Start Menu\Programs\Startup"
      ;# CPU_Widget_TimeSync.exe ;CRC32: F6640DFA ;MD5: 3283875BA29E7143F1A9AB9018374E08 ;SHA-1: AD85B38BAE15A6962D8E6C1A89B164BE6840C877
      Function code from:
      CPU: 
      RAM:  MemGetStats ( )
      Memory:   _WinAPI_EmptyWorkingSet ()
       
    • Wicked_Caty
      By Wicked_Caty
      I've written a small surveillance tool for one of my programs. It shows the time that has already passed, the estimated time until the end, the average time of the steps, and the progress in %.
      It works pretty well, but I want to add some stats. That'd be the usages of the CPU, RAM, network and hard-drive of all threads in %. Basically what you see in the taskmanager, but without the list of every single process.
      I'm aware that there's no in-built function for that, and that I'd need an additional library. Are there any for that? Simply functions that return the stats mentioned above. Thanks!
      Edit:   I run an ASUS R752M with an Intel BayTrail M3540 on Windows 10 64-bits.