Jump to content

Mem Stats Update Constantly.


Recommended Posts

I'm trying to get the memory to update constant real time like the CPU didsplay, but I can't get it. This is what I've tried:

#include <GUIconstants.au3>
If Not ProcessExists("taskmgr.exe") Then Run("taskmgr.exe", "", @SW_HIDE)
GUICreate("Memory",500,100,0,0)

$mem = MemGetStats()

$progress = GUICtrlCreateProgress(0,0,500,20)
GUICtrlSetData($progress, $mem); I've done this back and forwards. I forget which way it suppose to be

GUISetState()
WinSetOnTop("R","",1)

While 1
    $Msg = GUIGetMsg()
    Select
        Case $Msg = $GUI_EVENT_CLOSE
            Exit 
    EndSelect
WEnd

Is this possible and I'm just doing it wrong? Or is it just not possible? Thanks.

Link to comment
Share on other sites

Try this:

While 1
    GUICtrlSetData($progress,MemGetStats())
    $Msg = GUIGetMsg()
    Select
        Case $Msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
    Sleep(10);Don't hog the CPU
Wend

Just so you know, the syntax is GUICtrlSetData($[ProgressBar/Button/Label/Etc],$NewData). You want to use this inside the loop so it will update in "Real-Time".

-CMR

Link to comment
Share on other sites

you should read the helpfile.

Opt("GUIOnEventMode", 1)

$h_gui = GUICreate("Memory",500,100,0,0)
$h_bar = GUICtrlCreateProgress(0,0,500,20)

GUISetOnEvent(-3, "Close")
WinSetOnTop($h_gui,"",1)
GUISetState()


While 1
    $ai_mem = MemGetStats()
    GUICtrlSetData($h_bar, $ai_mem[0])
    Sleep(10)
Wend

Func Close()
    Exit
EndFunc
Edited by w0uter

My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

Link to comment
Share on other sites

I've always been reading the help file, but just because I see something in the help file, doesn't mean I will necessarily know how to implement it to get what I want. Reading what I see in the help file about this, I wouldn't have figured I could use it in that way.

But a question on this though. It does update while nothing is happening, but once I activate a function, it stops monitoring until the function ends. Is that how it is suppose to be? Or can I have it monitoring while the function is in play?

Thanks.

Link to comment
Share on other sites

Is that how it is suppose to be?

Thanks.

Yes,

however depending on your scipt, you can determine how often something is checked

one way is..

AdlibEnable

--------------------------------------------------------------------------------

Enables Adlib functionality.

AdlibEnable ( "function" [, time] )

8)

NEWHeader1.png

Link to comment
Share on other sites

The adlib doesn't work for me because what I need it to work on resides in the "while" statement. Or is there something else I can do, or missing? I read the helpfile on adlib....didn't really learn anything from that besides it needs to be in a function.

Edit:

I would think it could go in a function, if I can activate it automatically when the GUI starts. Is there a way to do that? Or am I totally off?

Edited by Champak
Link to comment
Share on other sites

The adlib doesn't work for me because what I need it to work on resides in the "while" statement. Or is there something else I can do, or missing? I read the helpfile on adlib....didn't really learn anything from that besides it needs to be in a function.

cant you put waht you want to do in a function?

the adlib with be like a while loop and you decide how often it checks

AdlibEnable ( "function" [, time] )

8)

NEWHeader1.png

Link to comment
Share on other sites

I have two problems with that.

If I take it out of the while statement, it starts flickering something terrible. That I can deal with...just increase the time to 5 seconds.

However, when I take it out the "while" and put it in the "function", the progess bars show through ALL the child GUIs as well. So it looks like I have to leave it in the "while" and not the "function". Or is there something else?

Link to comment
Share on other sites

It's a little over 2000 lines so I'm just attaching it with the ini as text. This is athe fully functioning version without the adlib.

The lines of concern are 838-845 and 888-895.

As a matter of fact, while you are looking at that, there was something else you wanted to see in relation to another post:

http://www.autoitscript.com/forum/index.php?showtopic=26136

I didn't bring that back up yet because there were more important things I wanted to take care of. But the lines affecting that function are on 3-6 and 1397-1398.

Thanks.

Edited by Champak
Link to comment
Share on other sites

i think i got it

1

place this code above the

while loop

AdlibEnable("get_mem")

While 1; this is the existing while start

2

place the function just after the Wend

WEnd; existing code start

;///////////////////////////////////////////////////////////////////////////////////////
;///////////////////////////////While function ends/////////////////////////////////////
;///////////////////////////////////////////////////////////////////////////////////////
GUIDelete(); existing code end

Func get_mem()
    $ai_mem = MemGetStats()
    GUICtrlSetData($h_bar, $ai_mem[0])
EndFunc

and comment out this portion........... remove after checking that evrything is OK

;/////////////////////////////CPU and memory status begins; existing code
    
;$ai_mem = MemGetStats()
  ;GUICtrlSetData($h_bar, $ai_mem[0])

i got it to work just fine.... but i cant run your functions

8)

Edited by Valuater

NEWHeader1.png

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...