#35083 - 2003-01-09 10:53 PM
Readline
|
colmain
Lurker
Registered: 2003-01-09
Posts: 2
Loc: Canada
|
Hi guys, I'm trying to gather some hardware information. I can get Kix to get everything other than system memory. I saw that there is another script that contains a memory.exe for this but would prefer to use tools installed by default on 2k/xp systems. I thought that maybe I could run the msinfo32 and print it into a file but am having some problems getting the information out of the file. I'm not a programmer by any means and am relativley new to kix. Here is the code I have so far...
,-------start break on
;-------Operating System
? @producttype
;-------CPU Speed and type
$cpu = readvalue ("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0","processornamestring")
? $cpu
;-------Report the free Disk space if the drive exists
$drivec = getdiskspace( "c:\") $drived = getdiskspace( "d:\") $drivee = getdiskspace( "e:\") $drivef = getdiskspace( "f:\")
If $drivec>0 ? $drivec endif If $drived>0 ? $drived endif If $drivee>0 ? $drivee endif If $drivef>0 ? $drivef endif
;-------IP Address
? @IPADDRESS0
;-------System Memory
shell "C:\Program Files\Common Files\Microsoft shared\MSInfo\msinfo32.exe /report c:\test\msinfo.txt /categories applications"
If Open(1,"c:\test\msinfo.txt") = 0 WHILE @ERROR = 0 $x = ReadLine(1) IF LEFT($x,21)= "Total physical memory" left($mem,10) ? $mem
close (1) ENDIF
If you guys could help I would appreciate it.
Tnx
|
|
Top
|
|
|
|
#35084 - 2003-01-09 10:58 PM
Re: Readline
|
colmain
Lurker
Registered: 2003-01-09
Posts: 2
Loc: Canada
|
If it helps here is the msinfo file.
System Information report written at: 01/09/03 14:49:56 System Name: xxxxxx [System Summary]
Item Value OS Name Microsoft Windows XP Professional Version 5.1.2600 Service Pack 1 Build 2600 OS Manufacturer Microsoft Corporation System Name xxxxxx System Manufacturer Dell Computer Corporation System Model OptiPlex GX260 System Type X86-based PC Processor x86 Family 15 Model 1 Stepping 2 GenuineIntel ~1800 Mhz BIOS Version/Date Dell Computer Corporation A00, 5/10/2002 SMBIOS Version 2.3 Windows Directory C:\WINDOWS System Directory C:\WINDOWS\System32 Boot Device \Device\HarddiskVolume1 Locale United States Hardware Abstraction Layer Version = "5.1.2600.1106 (xpsp1.020828-1920)" User Name xxxxxxxxxxxxxxxxxxxx Time Zone Mountain Standard Time Total Physical Memory 512.00 MB Available Physical Memory 220.95 MB Total Virtual Memory 1.16 GB Available Virtual Memory 655.88 MB Page File Space 673.08 MB Page File C:\pagefile.sys
|
|
Top
|
|
|
|
#35093 - 2003-01-10 04:34 PM
Re: Readline
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Waltz is not (con)catenating string fragments - he is sending them to the console and the way he is doing it is perfectly correct.
Waltz's code outputs each string fragment to the console. Using '+' between the fragments will pop and push the fragments onto the stack as it constructs a temporary string to output, which is redundant and a waste of memory/CPU cycles.
Where you require a catenated string as in your assignment example the "+" signs are mandatory, not optional.
Don't forget that this is a free format language, so
code:
? "Display" " a " "string"
is the same as
code:
? "Display" " a " "string"
Sometimes it is easy to forget this and look at a script as containing "lines" of code.
|
|
Top
|
|
|
|
#35095 - 2003-01-10 05:05 PM
Re: Readline
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Jens, I agree absolutely. If it was a KiX golf script however...
I wanted to correct the implication that there was some sort of catenating going on. For instance
code:
$sVar="some variable" $=MessageBox("sVar=" $sVar, "Debug")
Will not work.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1782 anonymous users online.
|
|
|