From scripting
Jump to: navigation, search
global proc float GetMayaRAMUsageXPHome() {
//Author Nick Pisca 0001d 2010, float $Ram1 = GetMayaRAMUsageXPHome();
string $TLbuffer[];
string $TL = `system ("c:\\pslist.exe maya /accepteula")`;
$TLToks = `tokenize $TL " " $TLbuffer`;
int $TLCount = 0;
string $TLMayaUsage = 0;
do {
	string $TLX = `match "maya" $TLbuffer[$TLCount]`;
	if ($TLX != "") {
		$TLMayaUsage = $TLbuffer[($TLCount+5)];
} while ($TLCount<size($TLbuffer));
string $s2 = `substitute "," $TLMayaUsage ""`;
float $TLMayaDbl = float($s2);
return $TLMayaDbl;

NOTE: This function was developed because Windows XP Home does not have the Tasklist function for the cmd prompt. If you are using a newer release of Windows, skip GetMayaRAMUsageXPHome and use the cleaner function: GetMayaRAMUsage. Also, in order to run this program, you need the tool pslist.exe. Save this on your C: Drive root directory.

Related Functions: GetMayaRAMUsage

More information on MEL scripting, read YSYT.