Champak Posted May 17, 2006 Share Posted May 17, 2006 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 More sharing options...
CodeMaster Rapture Posted May 17, 2006 Share Posted May 17, 2006 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 More sharing options...
Champak Posted May 17, 2006 Author Share Posted May 17, 2006 That doesn't work.....it doesn't have to be a prgress bar if that is possible, it can just be numerical indicator if that makes this easier. Link to comment Share on other sites More sharing options...
Champak Posted May 18, 2006 Author Share Posted May 18, 2006 Should I take it that this is not possible? Link to comment Share on other sites More sharing options...
w0uter Posted May 18, 2006 Share Posted May 18, 2006 (edited) 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 May 18, 2006 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 More sharing options...
Champak Posted May 19, 2006 Author Share Posted May 19, 2006 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 More sharing options...
Valuater Posted May 19, 2006 Share Posted May 19, 2006 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) Link to comment Share on other sites More sharing options...
Champak Posted May 19, 2006 Author Share Posted May 19, 2006 (edited) 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 May 19, 2006 by Champak Link to comment Share on other sites More sharing options...
Valuater Posted May 19, 2006 Share Posted May 19, 2006 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) Link to comment Share on other sites More sharing options...
Champak Posted May 19, 2006 Author Share Posted May 19, 2006 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 More sharing options...
Valuater Posted May 19, 2006 Share Posted May 19, 2006 ok... show me the script that worked so far 8) Link to comment Share on other sites More sharing options...
Champak Posted May 19, 2006 Author Share Posted May 19, 2006 (edited) 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=26136I 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 May 19, 2006 by Champak Link to comment Share on other sites More sharing options...
Valuater Posted May 19, 2006 Share Posted May 19, 2006 (edited) 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 May 19, 2006 by Valuater Link to comment Share on other sites More sharing options...
Champak Posted May 19, 2006 Author Share Posted May 19, 2006 Thanks, works great. I went ahead and put the cpu monitor in the function as well. I don't know if that's bad or not...but it works. If I shouldn't do that for whatever reason, let me know. Link to comment Share on other sites More sharing options...
Valuater Posted May 19, 2006 Share Posted May 19, 2006 (edited) Welcome ... it should be fine 8) Edited May 19, 2006 by Valuater Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now