PDA

View Full Version : System Information Gathering Page


MDucoff123
01-09-2007, 07:57 PM
Im trying to put together a page that will giove as much information about the current computer as possible

All of the memory information available

All HD and drives (capacity, available)

LAN info, user info. Everything !

Im looking for all the info to be displayed in seperate boxes next to labels that explain what they are and for them to be populated automatically when the page open.

Are there any examples or cheat sheets that I can use. Im moving from AMS 4 and it seemed fairly easy in that program, btu I can't figure it out for AMS 6.

Thanks in advance,
Mark

RizlaUK
01-09-2007, 08:22 PM
yeah, i made an app like that a while ago but i cant seem to find the apz for it,

its easy enough to do stright from the manual (thats how i did it) but i knock you up a "cheat sheet" lol, tomoz as its late here and im knackerd

fyi, its just a case of getting the info and putting it in to a read only input object
eg:

-- this would get the total ammount of system ram
gRam = System.GetMemoryInfo();
Input.SetText("Input1", gRam.TotalRAM);

MDucoff123
01-09-2007, 09:34 PM
I would appreciate it very much.

I was able to get the memory information completed, im working on the LAN info (although I wish it was more thorough - gateway IP,DNS info, connection type and name...) but what can you do.
Also, In version 4, the GetDrive information was super handy for getting hard drive capacities.

Any help would again be very appreciated.

Mark

MDucoff123
01-10-2007, 01:02 AM
ONe last question for the night.
I'm working on outputting the Processor information to a Dialog box, but I'm getting an error when I go to run it

here is what I have:

result = Registry.GetValue(HKEY_LOCAL_MACHINE, "HARDWARE\\DESCRIPTION\System\CentralProcessor\0", "ProcessNameString", true);
Dialog.Message("Registry Data", "The value read from the Registry is "..result..".");

I get nothing. I did the error code troubleshoot and I get a 1605. 1605 is "Could not get the specified value's data." Could it be because the reg entry begins with a few black spaces ?

thank you and good night.

Mark

RizlaUK
01-10-2007, 03:36 AM
when useing backslashes in ams you always need to use 2 "\\"

iv attached a example on how to get the CPU id, if you need any more help feel free to ask, i'll work on a lan info example for you a bit later on,

Tek
01-10-2007, 11:16 AM
Here is a bunch of code from an application that I wrote in AMS that gets a lot of information from the computer. See the attached screenshot for a preview of what information this code gathers.


-----------------------------------------------------------------------------------------------------------------------
-- Function to get the workstation system information
function fGetComputerInfo()
-- Get the processor name and speed
sProcessorName = Registry.GetValue(HKEY_LOCAL_MACHINE, "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", "ProcessorNameString", false);
if sProcessorName == "" then
sProcessorName = Registry.GetValue(HKEY_LOCAL_MACHINE, "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", "VendorIdentifier", false);
if sProcessorName == "" then
sProcessorName = Registry.GetValue(HKEY_LOCAL_MACHINE, "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", "Identifier", false);
end
end
sProcessorSpeed = Registry.GetValue(HKEY_LOCAL_MACHINE, "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", "~MHz", false);
nProcessorSpeed = String.ToNumber(sProcessorSpeed);
if nProcessorSpeed >= 1000 then
nProcessorSpeedGHz3 = nProcessorSpeed / 1000;
nProcessorSpeedGHz = Math.Round(nProcessorSpeedGHz3, 2);
sProcessorSpeedPretty = nProcessorSpeedGHz.. "GHz";
elseif nProcessorSpeed < 1000 then
sProcessorSpeedPretty = nProcessorSpeed.. "MHz";
end
sProcessorNameTrimmed = String.TrimLeft(sProcessorName, " ");
Label.SetText("N_LabelCPUText", sProcessorNameTrimmed.." @ ~"..sProcessorSpeedPretty);
-- Get the amount of available memory to Windows
tSystemRAMFake = System.GetMemoryInfo();
nSystemRAM = Math.Floor((tSystemRAMFake.TotalRAM + 3) / 4) * 4;
if nSystemRAM >= 1024 then
nSystemRAMGB3 = nSystemRAM / 1024;
nSystemRAMGB = Math.Round(nSystemRAMGB3, 1);
sSystemRAM = nSystemRAMGB.." GB";
elseif nSystemRAM < 1024 then
sSystemRAM = nSystemRAM.." MB";
end
Label.SetText("N_LabelMemoryText", sSystemRAM.." (~"..tSystemRAMFake.MemoryLoad.."% used)");
-- Get a list of all detected drives
ListBox.DeleteItem("N_ListBoxDrives", LB_ALLITEMS);
tDrives = Drive.Enumerate();
nDriveCount = Table.Count(tDrives);
nDriveCountStart = 1;
for index in tDrives do
nDriveType = Drive.GetType(tDrives[index]);
if nDriveType == 2 then
sDriveType = "Removable Disk";
ListBox.AddItem("N_ListBoxDrives", tDrives[index].." ("..sDriveType..")", "");
elseif nDriveType == 3 then
sDriveType = "Fixed Disk";
tDriveInformation = Drive.GetInformation(tDrives[index]);
if tDriveInformation ~= nil then
sDriveFileSystem = tDriveInformation.FileSystem;
sDriveDisplayName = tDriveInformation.DisplayName;
nDriveUsedSpaceMB = Drive.GetUsedSpace(tDrives[index]);
nDriveUsedSpaceB = (nDriveUsedSpaceMB * 1024) * 1024;
nDriveTotalSpaceMB = Drive.GetSize(tDrives[index]);
nDriveTotalSpaceB = (nDriveTotalSpaceMB * 1024) * 1024;
sDriveTotalSpace = String.GetFormattedSize(nDriveTotalSpaceB, FMTSIZE_AUTOMATIC, true);
nDriveFreePercent = (nDriveUsedSpaceB / nDriveTotalSpaceB) * 100;
ListBox.AddItem("N_ListBoxDrives", tDrives[index].." ("..sDriveDisplayName..", "..sDriveType..", "..sDriveFileSystem..", "..sDriveTotalSpace..", "..Math.Round(nDriveFreePercent, 0).."% used)", "");
end
elseif nDriveType == 4 then
sDriveType = "Network Drive";
tDriveInformation = Drive.GetInformation(tDrives[index]);
if tDriveInformation ~= nil then
sDriveFileSystem = tDriveInformation.FileSystem;
sDriveDisplayName = tDriveInformation.DisplayName;
nDriveUsedSpaceMB = Drive.GetUsedSpace(tDrives[index]);
nDriveUsedSpaceB = (nDriveUsedSpaceMB * 1024) * 1024;
nDriveTotalSpaceMB = Drive.GetSize(tDrives[index]);
nDriveTotalSpaceB = (nDriveTotalSpaceMB * 1024) * 1024;
sDriveTotalSpace = String.GetFormattedSize(nDriveTotalSpaceB, FMTSIZE_AUTOMATIC, true);
nDriveFreePercent = (nDriveUsedSpaceB / nDriveTotalSpaceB) * 100;
ListBox.AddItem("N_ListBoxDrives", tDrives[index].." ("..sDriveDisplayName..", "..sDriveType..", "..sDriveFileSystem..", "..sDriveTotalSpace..", "..Math.Round(nDriveFreePercent, 0).."% used)", "");
else
ListBox.AddItem("N_ListBoxDrives", tDrives[index].." (Unknown or disconnected)", "");
end
elseif nDriveType == 5 then
sDriveType = "CD/DVD Drive";
ListBox.AddItem("N_ListBoxDrives", tDrives[index].." ("..sDriveType..")", "");
else
sDriveType = "Unknown"
ListBox.AddItem("N_ListBoxDrives", tDrives[index].." ("..sDriveType..")", "");
end
end
-- Get a list of all installed playback WDM audio devices
ListBox.DeleteItem("N_ListBoxAudioDevices", LB_ALLITEMS);
sAudioOutDevices = DLL.CallFunction("AutoPlay\\Docs\\WaveInOutDev.dll", "GetWaveOutDevs", "", DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL)
nCountOut = 1;
if sAudioOutDevices ~= "" then
nSemiColons = String.Find(sAudioOutDevices, ";;", 1, false);
if nSemiColons == -1 then
ListBox.AddItem("N_ListBoxAudioDevices", "Playback "..nCountOut..": "..sAudioOutDevices.." (Default Device)", "");
else
nDefaultOut = 1;
nStop = 0;
while nStop ~= 1 do
if nDefaultOut == 1 then
ListBox.AddItem("N_ListBoxAudioDevices", "Playback "..nCountOut..": "..String.Left(sAudioOutDevices, nSemiColons-1).." (Default Device)", "");
nDefaultOut = 0;
nCountOut = nCountOut + 1;
else
ListBox.AddItem("N_ListBoxAudioDevices", "Playback "..nCountOut..": "..String.Left(sAudioOutDevices, nSemiColons-1), "");
nCountOut = nCountOut + 1;
end
sAudioOutDevicesTrimmed1 = String.TrimLeft(sAudioOutDevices, String.Left(sAudioOutDevices, nSemiColons-1));
sAudioOutDevicesTrimmed2 = String.TrimLeft(sAudioOutDevicesTrimmed1, ";");
sAudioOutDevices = sAudioOutDevicesTrimmed2;
nSemiColons = String.Find(sAudioOutDevices, ";;", 1, false);
if nSemiColons == -1 then
ListBox.AddItem("N_ListBoxAudioDevices", "Playback "..nCountOut..": "..sAudioOutDevices, "");
nStop = 1;
nCountOut = nCountOut + 1;
end
end
end
else
ListBox.AddItem("N_ListBoxAudioDevices", "No playback devices detected", "");
end
-- Get a list of all installed recording WDM audio devices
sAudioInDevices = DLL.CallFunction("AutoPlay\\Docs\\WaveInOutDev.dll", "GetWaveInDevs", "", DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL)
nCountIn = 1;
if sAudioInDevices ~= "" then
nSemiColons = String.Find(sAudioInDevices, ";;", 1, false);
if nSemiColons == -1 then
ListBox.AddItem("N_ListBoxAudioDevices", "Record "..nCountIn..": "..sAudioInDevices.." (Default Device)", "");
else
nDefaultIn = 1;
nStop = 0;
while nStop ~= 1 do
if nDefaultIn == 1 then
ListBox.AddItem("N_ListBoxAudioDevices", "Record "..nCountIn..": "..String.Left(sAudioInDevices, nSemiColons-1).." (Default Device)", "");
nDefaultIn = 0;
nCountIn = nCountIn + 1;
else
ListBox.AddItem("N_ListBoxAudioDevices", "Record "..nCountIn..": "..String.Left(sAudioInDevices, nSemiColons-1), "");
nCountIn = nCountIn + 1;
end
sAudioInDevicesTrimmed1 = String.TrimLeft(sAudioInDevices, String.Left(sAudioInDevices, nSemiColons-1));
sAudioInDevicesTrimmed2 = String.TrimLeft(sAudioInDevicesTrimmed1, ";");
sAudioInDevices = sAudioInDevicesTrimmed2;
nSemiColons = String.Find(sAudioInDevices, ";;", 1, false);
if nSemiColons == -1 then
ListBox.AddItem("N_ListBoxAudioDevices", "Record "..nCountIn..": "..sAudioInDevices, "");
nStop = 1;
nCountIn = nCountIn + 1;
end
end
end
else
ListBox.AddItem("N_ListBoxAudioDevices", "No record devices detected", "");
end
-- Get the operating system information
sOSName = System.GetOSName();
tOSVersionInfo = System.GetOSVersionInfo();
sOSServicePack = tOSVersionInfo.CSDVersion;
if (sOSName == "Windows 95") then
Label.SetText("N_LabelOSText", "Microsoft "..sOSName);
elseif (sOSName == "Windows 98") then
Label.SetText("N_LabelOSText", "Microsoft "..sOSName);
elseif (sOSName == "Windows NT 3") then
Label.SetText("N_LabelOSText", "Microsoft "..sOSName);
elseif (sOSName == "Windows NT 4") then
Label.SetText("N_LabelOSText", "Microsoft "..sOSName);
elseif (sOSName == "Windows ME") then
Label.SetText("N_LabelOSText", "Microsoft "..sOSName);
elseif (sOSName == "Windows Server 2003") then
if tOSVersionInfo.Enterprise then
Label.SetText("N_LabelOSText", "Microsoft "..sOSName.." Enterprise ("..sOSServicePack..")");
elseif tOSVersionInfo.SmallBusiness then
Label.SetText("N_LabelOSText", "Microsoft "..sOSName.." Small Business ("..sOSServicePack..")");
else
Label.SetText("N_LabelOSText", "Microsoft "..sOSName.." Standard ("..sOSServicePack..")");
end
elseif (sOSName == "Windows XP") then
Label.SetText("N_LabelOSText", "Microsoft "..sOSName.." Professional ("..sOSServicePack..")");
elseif (sOSName == "Windows XP" and tOSVersionInfo.Personal) then
Label.SetText("N_LabelOSText", "Microsoft "..sOSName.." Home ("..sOSServicePack..")");
elseif (sOSName == "Windows 2000" and tOSVersionInfo.ProductType == 3) then
Label.SetText("N_LabelOSText", "Microsoft "..sOSName.." Server ("..sOSServicePack..")");
else
Label.SetText("N_LabelOSText", "Microsoft "..sOSName.." ("..sOSServicePack..")");
end
-- Get the network information
tLANInfo = System.GetLANInfo();
sLANInfoHost = tLANInfo.Host;
sLANInfoDomain = tLANInfo.Domain;
sLANInfoUser = tLANInfo.User;
sLANInfoIP = tLANInfo.IP;
tUserInfo = System.GetUserInfo();
Label.SetText("N_LabelComputerNameText", tLANInfo.Host);
if tUserInfo.IsAdmin then
Label.SetText("N_LabelCurrentUserText", tLANInfo.User.." (Local Administrator)");
else
Label.SetText("N_LabelCurrentUserText", tLANInfo.User);
end
Label.SetText("N_LabelIPAddressText", tLANInfo.IP);
sWorkgroupName = DLL.CallFunction("AutoPlay\\Docs\\WGDomain.dll", "GetWGDomain", "", DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL)
Label.SetText("N_LabelWorkgroupText", sWorkgroupName);
-- Get the display information
tDisplayInfo = System.GetDisplayInfo();
sDisplayWidth = tDisplayInfo.Width
sDisplayHeight = tDisplayInfo.Height
sDisplayColorDepth = tDisplayInfo.ColorDepth
Label.SetText("N_LabelDisplayInfoText", sDisplayWidth.." x "..sDisplayHeight.." @ "..sDisplayColorDepth.."bit");
end

RizlaUK
01-10-2007, 06:04 PM
Hey Tek, thats a nice chunk of code, i'll have a syphen through it as im sure theres loads in there i could use

Thanks :yes

tripc
01-10-2007, 06:37 PM
Hey Tek, can you post your code in *.apz file?

RizlaUK
01-10-2007, 06:58 PM
Hey tek, theres a dll mentioned in there "WaveInOutDev.dll", any chance you could upload that for me, (thats if you are ok with that)

it sure looks like something i could use ;)

Thanks, even if you dont want to :yes


Here tripc, i added all the lables n stuff and added worms "WGDomain.dll" coz it is mentioned in there to and i had it on hdd

hope you dont mind tek, tought it would save you the trouble

Tek
01-11-2007, 11:55 AM
You can get the WaveInOut DLL here:

http://www.indigorose.com/forums/showthread.php?p=77494#post77494

Credit goes to Worm for creating it. :yes

RizlaUK
01-11-2007, 12:03 PM
ah-ha, another of worms offerings, thanks for pointion me in the right direction tek, although i did search the forum and googled it and found notheing


thanks :yes