AutoIt Forums: RAMPro - AutoIt Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

RAMPro AutoIt V3.3.2.0 specific Rate Topic: ***** 1 Votes

#1 User is offline   JamesBrooks 

  • Do You Wanna Be A Human Controlling An Avatar?
  • Icon
  • Group: AutoIt MVPs(MVP)
  • Posts: 8,076
  • Joined: 24-November 06
  • Gender:Male
  • Location:Null

Posted 27 December 2009 - 05:14 PM

Hey all,

So over the past months, I've been working on and off on a script; RAMPro. You can read about RAMPro on my blog, updates to the previously closed source can all be found here. RAMPro is used at my college, by the technicians themselves, and also deployed to every machine, as they are only supplied with 1GB of RAM. Running RAMPro has been efficient to the computers and especially to the poor users who have to use the college machines. Thankfully I have been granted permission to use my laptop and thus no more college machines for me!

Anyway, I thought it could be a good idea to release the code to the AutoIt community. It shows how the "EmptyWorkingSet" function can be used (thank you to whoever wrote the ReduceMemory function), using list views with icons, rasims CPUMon code, running code at startup (probably the worst method ever), minimizing to the tray, $CMDLine, AdlibRegister (only converted to 3.3.2.0 today) and overall, how bad of a coder I am http://www.autoitscript.com/forum/public/style_emoticons/autoit/unsure.gif
http://james-brooks.net/images/RAMPro.png

The startup code (there are plenty of better ways I'm sure) works like it does, to cope with the tedious server issues they have at college. The most efficient way there is to create a shortcut to the actual location in the users profile area.

I've also added a window which allows you to select a single process and then either; Close or Free the process.

Anyway, I've only just added rasims CPUMon code today, so there might be a couple of hiccups, who knows...

To the code!
OK the script file is available for download as an attached file, so go ahead and get it! Also attached is the icon used by RAMPro.

Thanks,
James http://www.autoitscript.com/forum/public/style_emoticons/autoit/idiot.gif

Edit: First hiccup - Forgot to update a variable, so that the image for the CPU item is updated... Fixed!
Edit two: Second hiccup - I left an _ArrayDisplay line in the code... Fixed!

Attached File(s)


This post has been edited by JamesBrooks: 27 December 2009 - 07:08 PM


#2 User is offline   nobbe 

  • Mass Spammer!
  • PipPipPipPip
  • Group: Full Members
  • Posts: 433
  • Joined: 08-January 07
  • Location:Germany

Posted 28 December 2009 - 11:33 AM

very nice program

#3 User is offline   JamesBrooks 

  • Do You Wanna Be A Human Controlling An Avatar?
  • Icon
  • Group: AutoIt MVPs(MVP)
  • Posts: 8,076
  • Joined: 24-November 06
  • Gender:Male
  • Location:Null

Posted 28 December 2009 - 01:20 PM

View Postnobbe, on 28 December 2009 - 10:33 AM, said:

very nice program

Thanks, any suggestions, disapprovals or anything?

#4 User is offline   ghetek 

  • Advanced Member
  • PipPip
  • Group: Full Members
  • Posts: 104
  • Joined: 09-October 04

Posted 29 December 2009 - 04:10 AM

Very nice utility. I am struggling to add in _GUICtrlListView_SortItems to the Select Process GUI. It would be nice to be able to sort those items.

#5 User is offline   JamesBrooks 

  • Do You Wanna Be A Human Controlling An Avatar?
  • Icon
  • Group: AutoIt MVPs(MVP)
  • Posts: 8,076
  • Joined: 24-November 06
  • Gender:Male
  • Location:Null

Posted 29 December 2009 - 07:49 PM

View Postghetek, on 29 December 2009 - 03:10 AM, said:

Very nice utility. I am struggling to add in _GUICtrlListView_SortItems to the Select Process GUI. It would be nice to be able to sort those items.

I too seem to be having a problem implementing the code for this, however once I have figured it out, I shall release the update. You're very right, it would be nice to sort the items. Perhaps removing services too, since they are generally vital for Windows to run.

So after some testing, I seem to be able to use a WM_NOTIFY message to tell the list view it needs to sort, however, upon clicking it orders the items, but then promptly reverses the order. And upon further testing, it seemed to completely ignore callbacks afterwards.
[ autoIt ]    ( ExpandCollapse - Popup )
Global $hProcesses ; Place this at the top of the script Func _FreeSelected()     $hMyProcess = GUICreate("Free RAM from selected process", 354, 262, -1, -1)     $hProcesses = GUICtrlCreateListView("Processes|Type|Memory", 8, 8, 337, 214, BitOR($LVS_EDITLABELS, $LVS_REPORT))     ;$hProcesses = _GUICtrlListView_Create($hMyProcess, "Processes|Type|Memory", 8, 8, 337, 214, BitOR($WS_EX_DLGMODALFRAME, $WS_EX_CLIENTEDGE, $LVS_REPORT))     _GUICtrlListView_SetExtendedListViewStyle($hProcesses, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_DOUBLEBUFFER ))     $hList = ProcessList()     For $iList = 1 To $hList[0][0] ; Populate list with processes         $iStats = ProcessGetStats($hList[$iList][1], 0)         If IsArray($iStats) Then             _GUICtrlListView_AddItem($hProcesses, $hList[$iList][0], -1, 1)             _GUICtrlListView_AddSubItem($hProcesses, $iList - 1, $iStats[0] / 1024, 2) ; WorkingSetSize         Else             _GUICtrlListView_AddItem($hProcesses, $hList[$iList][0], -1, 2)             _GUICtrlListView_AddSubItem($hProcesses, $iList - 1, "<SYSTEM>", 1)         EndIf     Next     _GUICtrlListView_SetColumnWidth($hProcesses, 0, $LVSCW_AUTOSIZE_USEHEADER) ; Re-size the process list for "Processes"     _GUICtrlListView_SetColumnWidth($hProcesses, 1, $LVSCW_AUTOSIZE_USEHEADER) ; Re-size the process list for "Type"     _GUICtrlListView_SetColumnWidth($hProcesses, 2, $LVSCW_AUTOSIZE_USEHEADER) ; Re-size the process list for "Memory"     $hKill = GUICtrlCreateButton("&Kill Process", 128, 224, 105, 33)     $hFreeSelected = GUICtrlCreateButton("Free &Selected", 240, 224, 105, 33, 0)     GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")     GUISetState(@SW_SHOW)     _GUICtrlListView_RegisterSortCallBack($hProcesses)     While WinExists($hMyProcess)         $iMsg = GUIGetMsg()         Switch $iMsg             Case -3                 GUIDelete($hMyProcess)             Case $hFreeSelected                 $hIndic = _GUICtrlListView_GetSelectedIndices($hProcesses, True) ; Get the selected item                 For $f = 1 To $hIndic[0]                     $hRet = _ReduceMemory($hList[$hIndic[$f]][1]) ; Reduce the process memory                 Next             Case $hKill                 $hIndic = _GUICtrlListView_GetSelectedIndices($hProcesses, True) ; Get the selected item                 For $k = 1 To $hIndic[0]                     ProcessClose($hList[$hIndic[$k]][1]) ; Close the process                 Next             Case $hProcesses                 ; Kick off the sort callback                 _GUICtrlListView_SortItems($hProcesses, GUICtrlGetState($hProcesses))         EndSwitch     WEnd     _GUICtrlListView_UnRegisterSortCallBack($hProcesses) EndFunc   ;==>_FreeSelected Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)     #forceref $hWnd, $iMsg, $iwParam     Local $hWndFrom, $iCode, $tNMHDR, $hWndListView, $tInfo     $hWndListView = $hProcesses     If Not IsHWnd($hProcesses) Then $hWndListView = GUICtrlGetHandle($hProcesses)     $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)     $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))     $iCode = DllStructGetData($tNMHDR, "Code")     Switch $hWndFrom         Case $hWndListView             Switch $iCode                 Case $LVN_COLUMNCLICK ; A column was clicked                     $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)                     _GUICtrlListView_SortItems($hProcesses, DllStructGetData($tInfo, "SubItem"))             EndSwitch     EndSwitch     Return $__LISTVIEWCONSTANT_GUI_RUNDEFMSG EndFunc   ;==>WM_NOTIFY  

Try it, it confuses me http://www.autoitscript.com/forum/public/style_emoticons/autoit/unsure.gif

This post has been edited by JamesBrooks: 30 December 2009 - 12:42 AM


#6 User is offline   JamesBrooks 

  • Do You Wanna Be A Human Controlling An Avatar?
  • Icon
  • Group: AutoIt MVPs(MVP)
  • Posts: 8,076
  • Joined: 24-November 06
  • Gender:Male
  • Location:Null

Posted 30 December 2009 - 12:54 PM

All that I can think of, as to why the _GUICtrlListView_SortItems() isn't working, is that another function must be messing up the functionality somewhere http://www.autoitscript.com/forum/public/style_emoticons/autoit/wacko.gif

As to which function, where and how, I have no idea. Perhaps someone smarter than I can take a quick look? http://www.autoitscript.com/forum/public/style_emoticons/autoit/idiot.gif

#7 User is offline   monoceres 

  • Blue dream
  • Icon
  • Group: AutoIt MVPs(MVP)
  • Posts: 3,491
  • Joined: 04-June 07
  • Gender:Male
  • Location:Linköping, Sweden

Posted 31 December 2009 - 02:53 AM

Everytime someone missuses the EmptyWorkingSet function an angels gets raped. http://www.autoitscript.com/forum/public/style_emoticons/autoit/crying.gif

#8 User is offline   AdmiralAlkex 

  • The summer-heat is melting me brains.
  • PipPipPipPipPipPipPip
  • Group: Full Members
  • Posts: 2,805
  • Joined: 09-April 07
  • Gender:Male
  • Location:Sweden

Posted 31 December 2009 - 04:03 AM

http://www.autoitscript.com/forum/public/style_images/autoit/snapback.png' alt='View Post' />monoceres, on 31 December 2009 - 02:53 AM, said:

Everytime someone missuses the EmptyWorkingSet function an angels gets raped.

You should have seen this script before he edited it, he had EmptyWorkingSet in the mainloop so it ran ALL THE TIME! :wacko:

#9 User is offline   JamesBrooks 

  • Do You Wanna Be A Human Controlling An Avatar?
  • Icon
  • Group: AutoIt MVPs(MVP)
  • Posts: 8,076
  • Joined: 24-November 06
  • Gender:Male
  • Location:Null

Posted 31 December 2009 - 10:51 AM

http://www.autoitscript.com/forum/public/style_images/autoit/snapback.png' alt='View Post' />monoceres, on 31 December 2009 - 01:53 AM, said:

Everytime someone missuses the EmptyWorkingSet function an angels gets raped.

It's not that bad http://www.autoitscript.com/forum/public/style_emoticons/autoit/pinch.gif

View PostAdmiralAlkex, on 31 December 2009 - 03:03 AM, said:

You should have seen this script before he edited it, he had EmptyWorkingSet in the mainloop so it ran ALL THE TIME! :wacko:

And it's definitely not that bad http://www.autoitscript.com/forum/public/style_emoticons/autoit/mellow.gif

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users