AutoHotkey Community

It is currently May 26th, 2012, 10:04 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: October 14th, 2008, 11:52 pm 
Offline

Joined: November 6th, 2007, 7:24 pm
Posts: 24
I need my script to simply read how much physical ram is installed, this is what I've come up with so far is this

Code:
Run msinfo32.exe /categories +SWEnvStartupPrograms /report C:\test.txt
FileReadLine RAM, C:\test.txt, 25
StringTrimLeft RAM, RAM, 22
StringTrimRight RAM, RAM, 7
MsgBox %RAM%


Simple enough, but it seems as though the txt file that msinfo creates is encrypted or something, if I read the first line I just get weird characters. If I create a new txt file and paste in the same text from the original file it will read the new file just fine.

Is there any easier way to go about this?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 15th, 2008, 12:09 am 
http://www.autohotkey.com/forum/viewtopic.php?t=8042


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 15th, 2008, 12:17 am 
Offline

Joined: November 6th, 2007, 7:24 pm
Posts: 24
That doesn't seem to report the RAM correctly, says I have 4TB...I don't think so, only 12GB


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 16th, 2008, 3:56 pm 
Offline

Joined: November 6th, 2007, 7:24 pm
Posts: 24
bump


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 16th, 2008, 6:00 pm 
Offline

Joined: March 16th, 2005, 10:33 pm
Posts: 968
Location: Frisia
Function similar to AutoIt's MemGetStats

HTH

_________________
Image mirror 1mirror 2mirror 3ahk4.me • PM or Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 16th, 2008, 6:34 pm 
Offline

Joined: November 6th, 2007, 7:24 pm
Posts: 24
That has potential but it also reports the ram incorrectly, I have 12gb and it says this: Available Physical Ram: 4194304k
Possibly something to do with XP64? Or am I missing something very obvious with some sort of conversion?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 16th, 2008, 6:40 pm 
i remember when my friend bought his new sony laptop (which has 4GBram)
and its only displaying 3GB ram on system
the sales person told him to update/install something in order for the computer to recognized there are 4GB ram
so it might similar in ur case
the method u use to output will not recognized something over 4GB


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 16th, 2008, 9:03 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Code:
; http://www.autohotkey.com/forum/viewtopic.php?p=225823#225823

VarSetCapacity( MEMORYSTATUSEX,64,0 ), NumPut( 64,MEMORYSTATUSEX )
DllCall( "GlobalMemoryStatusEx", UInt,&MEMORYSTATUSEX )
TotalPhys := NumGet( MEMORYSTATUSEX,8,"Int64"),   VarSetCapacity( PhysMem,16,0 )
DllCall( "shlwapi.dll\StrFormatByteSize64A", Int64,TotalPhys, Str,PhysMem, UInt,16 )
; StrFormatByteSize64 : http://msdn.microsoft.com/en-us/library/bb759971(VS.85).aspx
MsgBox, 64, Total Physical Memory, %TotalPhys% Bytes`n= %PhysMem%

/*

GlobalMemoryStatusEx     : http://msdn.microsoft.com/en-us/library/aa366589(VS.85).aspx
Requires Windows Vista, Windows XP, or Windows 2000 Professional.

typedef struct _MEMORYSTATUSEX { 
DWORD dwLength; 
DWORD dwMemoryLoad; 
DWORDLONG ullTotalPhys; 
DWORDLONG ullAvailPhys; 
DWORDLONG ullTotalPageFile; 
DWORDLONG ullAvailPageFile; 
DWORDLONG ullTotalVirtual; 
DWORDLONG ullAvailVirtual; 
DWORDLONG ullAvailExtendedVirtual;
} MEMORYSTATUSEX,  *LPMEMORYSTATUSEX;

*/

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 17th, 2008, 4:01 pm 
Offline

Joined: November 6th, 2007, 7:24 pm
Posts: 24
That works brilliantly, thank you sir.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: [VxE], Google Feedfetcher, iBob35555VR, Tilter_of_Windmills, tomoe_uehara, Yahoo [Bot] and 76 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron
Powered by phpBB® Forum Software © phpBB Group