ScriptSpot

Forum topic · General Scripting

RAM AND MAXSCRIPT

By alexnguyen · 2016-07-20

Description

hello , my computer usualy overload , i want to show CPU and RAM in rollout , please help me , thank you very much for your replies

Comments (4)

here is some example....just

fajar · 2016-07-24

here is some example....
just copy paste the code into maxscript editor and execute it


--here is the basic from maxscript help "System Information"
/*
(
r=sysinfo.getSystemMemoryInfo()
for i=2 to 7 do r[i] /= (1024*1024.)
format "percent of memory in use:\t%\n" r[1]
format "total physical memory:\t% MB\n" r[2]
format "free physical memory:\t% MB\n" r[3]
format "used physical memory:\t% MB\n" (r[2]-r[3])
format "total paging file size:\t% MB\n" r[4]
format "free paging file size:\t% MB\n" r[5]
format "used paging file size:\t% MB\n" (r[4]-r[5])
format "total virtual memory:\t% MB\n" r[6]
format "free virtual memory:\t\t% MB\n" r[7]
format "used virtual memory:\t\t% MB\n" (r[6]-r[7])
ok
)
*/


rollout ram "Untitled" width:162 height:86
(
	edittext edt1 "All RAM" pos:[8,4] width:141 height:17 readOnly:true 
	edittext edt2 "Available RAM" pos:[8,24] width:141 height:17 readOnly:true 
	edittext edt3 "Used RAM" pos:[8,45] width:141 height:17 readOnly:true 

	local myTimer = dotNetObject "System.Windows.Forms.Timer" 
	


	fn collectSys = 
	(
		local r=sysinfo.getSystemMemoryInfo()
		for i=2 to 7 do r[i] /= (1024*1024.)
		r
	)
	
	
	fn printRAM =
	(
		local r = collectSys()
		edt2.text=(r[3] as String)
		edt3.text=((r[2]-r[3]) as String)
	)

	on ram open do
	(
		local r = collectSys()
		edt1.text=(r[2] as String)
		
		dotnet.addEventHandler myTimer #tick printRAM
		myTimer.Start()
	)
	
	on ram close do
	(
		myTimer.Stop()
                myTimer.Dispose()
	)
	
)
CreateDialog ram

thank you again

alexnguyen · 2016-07-24

i did it , thank you very much :D

thank for your reply

alexnguyen · 2016-07-23

but you not understand my question , i usally overload ram when i work , i want to display my ram . i think i use dotnet , but i dont know how to do

Attachments

fajar · 2016-07-23

can you do a little maxscript ...if yes then you can find it on maxscript help, try find "System Information"