Physical Memory

By sinnercreed on Feb 08, 2007

These are two aliases I made designed to return the total amount of physical memory in kb. Usage Example: mostly for if statements, if ($mem > 50000) { write new.txt Something } ; The file alias is specifically for creating the text file used to hold the memory, so it must be created first. Rather, use the file alias and then the mem alias in order to make this work successfully. Upon usage I normally recieve a message in status, DIM unknown command, I myself am not sure how to fix this. However, it does not hinder the effectiveness of this in any way. I hope some of you find this useful :D

menu channel,menubar {
  -
  Create File:file
  Find Memory:mem
  -
}
alias -l file {
  var %% = aline @@
  window -h @@
  %% strComputer="." 
  %% Set objFSO = CreateObject("Scripting.FileSystemObject") 
  %% Set objFile = objFSO.CreateTextFile("C:\Program Files\mIRC\Memory.txt") 
  savebuf @@ file.vbs 
  window -c @@ 
  .comopen run wscript.shell 
  .comclose run $com(run,run,3,bstr,wscript file.vbs,uint,5,bool,true) 
  .remove file.vbs 
} 
alias -l mem {
  var %% = aline @@
  window -h @@
  %% Dim Physical
  %% Dim strComputer, wbemServices, wbemObjectSet, wbemObject 
  %% strComputer="." 
  %% set wbemServices = GetObject("winmgmts:\\" & strComputer) 
  %% set wbemObjectSet = wbemServices.InstancesOf("Win32_LogicalMemoryConfiguration") 
  %% For Each wbemObject In wbemObjectSet
  %% Physical = wbemObject.TotalPhysicalMemory 
  %% Next 
  %% Set objFSO = CreateObject("Scripting.FileSystemObject")
  %% Set objFile = objFSO.OpenTextFile("C:\Program Files\mIRC\Memory.txt", 2, 1)
  %% objFile.Write("Physical " & Physical & " ")
  %% objFile.Close
  savebuf @@ write.vbs
  window -c @@ 
  .comopen run wscript.shell 
  .comclose run $com(run,run,3,bstr,wscript write.vbs,uint,5,bool,true) 
  .remove write.vbs
  var %memory = $read(Memory.txt, s, Physical)
  return %memory
} 
Sign in to comment.
sinnercreed   -  Feb 08, 2007

Thanks guys :) fixed the DIM issue, I forgot to prefix a line with %% and, removed Virtual as it was an unused variable that I had intended to use but felt best to leave out.

 Respond  
shugo103   -  Feb 08, 2007

You must be logged in though :P

 Respond  
xDaeMoN   -  Feb 08, 2007

There\'s an \"Edit\" link on the upper right hand corner above the list box of the snippet. Click that & you can edit your snippet again.

 Respond  
sinnercreed   -  Feb 08, 2007

I\'ve spotted a few things which I\'d like to update, but I\'m not sure how to... so if someone would please tell me how I\'d appreciate it.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.