Sign in to follow this  
Followers 0
Wus

Basic computer info script

30 posts in this topic

#1 ·  Posted (edited)

I just recently (3 days ago) got autoIT at the reccomendation of a friend. I was trying to come up with a useful script when a friend asked me to write a program that will ist all the basic hardware of a computer system. After alot of bumbling around I put together this script. It retrieves some values from the registry and outputs them in a msgbox. Tehn it allows you to copy these results to a clipboard. (This copy feature was important because this was designed to make people post their specs on a forum.) I have revised this program a few times and it is still a work in progress.

I'd like some feedback on it... and yes I realize its probably very sloppy. I have done a good bit of programming on the TI-83 calculators but that was it until now.

I'd also like it if someone could tell me why for some people when they try to run the compiled exe they get a "script paused" message in their system tray. They cant seem to uncheck the pause box. I searched it on the support forum but I didnt see anything so I figured I would include my question ere instead of making a separate post.

I was also wondering if there was a way to make it figure out what drives exist on your computer. Because id like to have it display not just c:\ but all of the hardrives. Id also like it to display optical drives too but I couldnt figure out how.

I would be very appreciateive if people could post the output so I could figure out if its all fixed or not.

The .au3 file is attached

Example output is this:

Intel® Pentium® 4 CPU 2.40GHz @ 2400MHz

OS Version WIN_XP  build 2600         

Drive space free c:/  4.55 GB

Total Drive space c:/   15 GB

Free physical memory   426 MB

Total physical memory   1047 MB

Video card= NVIDIA GeForce FX 5600 (Microsoft Corporation)

Sound device= Creative SB Live! Series (WDM)

Mouse= HID-compliant MX510 Optical Mouse

Monitor= Korea Data Systems Avitron AV-195TF

I'd like feedback... not insults

Also I think that this post belongs here but if it belongs more in the support section because of my questions then ill repost.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

UT2004 = [bGE]WUS

CS: Source = {DK}WUS

Posted Image

comp_stats.au3

Edited by Wus

Share this post


Link to post
Share on other sites



Your script does what it says. When run in the SciTe editor a warning pops up but it is not fatal.

I tend to like minimal interaction with utilities. So, for the reporting I would either write to a file and show it in Notepad or use a GUI control that can be copied. This is because I work in a corporate environment where I might want to have a user send me the output. In fact I have such a utility that validates the installation of specialized software. I send them a link to the file, they run it and send the resulting output back.

Anyway, good job and welcome to the world of Au3. Cool tool huh? :)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

When run in the SciTe editor a warning pops up but it is not fatal

errr... what is this sciTe editor... seems like one of those things that ill regret not having

BTW... if you run the program you will see that after it runs it will ask you if you want to copy the data to clipboard with a yes/no msgbox

maybe you meant somthing else though...

good job and welcome to the world of Au3

Thx I try :)

and yeah autoIT looks like a very easy to learn and very useful little scripting language I wish I had know about it years ago

This script works great for fresh installs where only 1 driver has ever been installed

where components have been changed and such without a recent reformat it loses its charm because it uses the "driverdesc" value not the actual hardware info

I made it for this use here

Computer stats thread

hope ppl can make use of it

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

UT2004 = [bGE]WUS

CS: Source = {DK}WUS

Posted Image

Edited by Wus

Share this post


Link to post
Share on other sites

errr... what is this sciTe editor... seems like one of those things that ill regret not having

<{POST_SNAPBACK}>

All SciTE info available here : http://www.autoitscript.com/autoit3/scite

:)


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

love that sciTe editor fantastic program

updated the script ... took out a few bugs and some errors where it would display things twice

and COMON 11 dloads and only a few posts....

at least post up the data so i can see if all the values were outputed correctly

compstats10.au3

Edited by Wus

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

My output was alittle off, the space before Intel:

Intel(R) Pentium(R) 4 CPU 1.60GHz @ 1764MHz
OS Version WIN_XP  build 2600         
Drive space free c:/  12.02 GB
Total Drive space c:/   19.46 GB
Free physical memory   828 MB
Total physical memory   1048 MB
Video card= NVIDIA GeForce4 MX 440 with AGP8X
Sound device= Intel(r) 82801BA/BAM AC'97 Audio Controller
Sound device= Creative SB Live! Series (WDM)
Mouse= Logitech-compatible Mouse PS/2
Monitor= Dell D1626HT

It would be nice to list all hard drives :)

Nice

Also There are a couple of registry entries that might be nice to add:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\BuildLab = 2600.xpsp_sp2_rtm.040803-2158

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CSDVersion = Service Pack 2

Edited by Ejoc

Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs

Share this post


Link to post
Share on other sites

Ill add in the service pack part because that is always good to know but why would anyone ever need the rtm.040803-2158 (release to manufacturer) part?

Ill see what i can do about erasing the blank spaces at the begining of the cpu part... proly have to make a UDF for that.


Share this post


Link to post
Share on other sites

StringStripWS($string,1)


Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

thx for that function name... i was just about to start coding my own... and i wasnt looking forward to it

thatll make it much simpler thx

EDIT

put in the service pack and erased the spaces from in fron tof $cpu

next ill try to figure out how to add all the hard drives and maybe optical drives.... im not really sure how i can do that... unless perhaps i can query a letter drive and figure out if it exists via an error flag.... hmmm... but then how could i tell if it was optical or not.... hmmmm.... i shall try to puzzle this out

compstats11.au3

Edited by Wus

Share this post


Link to post
Share on other sites

I had just try your script. Nice is the word.

I notice that it does not show all the device in the system.(@least my LAN card is not shown)

Is it meant to be like this or futher improvement on this will be in your next release. :D

Another thing is that I also prefer the output to be in a file format as what condoman had mention.

Finally, Good job! :)


[font="Arial"]Thanks[/font]
If @error = me Then $sorry
Else
   Do
      $clarifyMe
   Until $meClear
EndIF
MsgBox(0,"Special Message!","Special Thanks to " & $allHadReplied,$Forever)

Share this post


Link to post
Share on other sites

ill do my best to add lan capability in soon.. i think i figured out a roundabout way how to

I am currently trying to make it find all you hard drives based on the @error when I use the Dirgetsize() function for the ?:/system volume information/ folder

I wana add in optical drives but so far even my theoretical ponderances have been thwarted

hopefully tonight i wil have at least the hd part done and maybe even the network part as well


Share this post


Link to post
Share on other sites

$szHardDrives       = ""
$szOpticalDrives    = ""
For $i = Asc("A") To Asc("Z")
    Local $Drive    = Chr($i) & ":"
    if DriveGetType($Drive) = "CDROM" Then
        $szOpticalDrives    = $szOpticalDrives & $Drive
    Elseif DriveGetType($Drive) = "Fixed" Then
        $szHardDrives   = $szHardDrives & $Drive
    Endif
Next
MsgBox(0,"Hard Drives",$szHardDrives)
MsgBox(0,"Optical Drives",$szOpticalDrives)


Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

your just taking all the fun outta this... j/k

thank you... i was about halfway done writing a large piece of script that would only work for harddrives

I really gotta spend more time searching the help file i suppose... i use the index feature alot but I guess the search feature is more powerful

------------------------------------

EDIT:

Alright I got the drive portion to list all the physical drives and it picks up on virtual drives to although i calssifies them as optical drives

I will give a go at trying to get this script to list the network card too... but that may prove as tedious as making it list the sound card was unless i can find a comletely different way that doesnt involve the registry.

And BTW ... this script should not be relied on too heavily for the video/sound/mouse/monitor info because I merely found the driver description that is in the place where the default setup usually resides in the registry.

After i finish playing around with this script I will go try to write it using Kix script and wmi's as suggested by a friend. The wmi's give true infor where the infor obtained by this script is psuedo true.

All the same... this script is fun because Im doing it more as a learning tool than an actual useful program (although it does have its uses)

example output

Intel(R) Pentium(R) 4 CPU 2.40GHz @ 2400MHz
WIN_XP Build 2600 Service Pack 2
Total space on   C:\ (system) = 15 Gb
Free space on   C:\ (system) = 4.5 Gb
Total space on   D:\ (PAGE FILE) = 3.15 Gb
Free space on   D:\ (PAGE FILE) = 3.15 Gb
Total space on   E:\ (media) = 20 Gb
Free space on   E:\ (media) = 6.9 Gb
Total space on   F:\ (games) = 40 Gb
Free space on   F:\ (games) = 21.5 Gb
Total space on   G:\ (downloads) = 36.31 Gb
Free space on   G:\ (downloads) = 5.5 Gb
Opticaldrives = H:\ I:\ J:\ K:\ L:\ M:\ 
Free physical memory = 349 MB
Total physical memory = 1047 MB
Video card= NVIDIA GeForce FX 5600 (Microsoft Corporation)
Sound device= Creative SB Live! Series (WDM)
Mouse= HID-compliant MX510 Optical Mouse
Monitor= Korea Data Systems Avitron AV-195TF

compstats12.au3

Edited by Wus

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

I'm sure your tired of me updating this so this is my last update to this program.

I put in the nic card thingy via cmd.exe (netsh diag show adapter). If you see a command prompt open up dont freak out... I even took the liberty of moving your mouse away from the command prompt so you dont screw my not so expert scripting up.

I also made it write this file to a text file that is name on one of the last dialogs.

anywho.. this is my final product

now ill see if I can do this with kixscript

this is an example output

Intel(R) Pentium(R) 4 CPU 2.40GHz @ 2400MHz
WIN_XP Build 2600 Service Pack 2
Total space on   C:\ (system) = 15 Gb
Free space on    C:\ (system) = 4.53 Gb
Total space on   D:\ (PAGE FILE) = 3.15 Gb
Free space on    D:\ (PAGE FILE) = 3.15 Gb
Total space on   E:\ (media) = 20 Gb
Free space on    E:\ (media) = 6.9 Gb
Total space on   F:\ (games) = 40 Gb
Free space on    F:\ (games) = 21.48 Gb
Total space on   G:\ (downloads) = 36.31 Gb
Free space on    G:\ (downloads) = 5.5 Gb
Opticaldrives = H:\   I:\   J:\   K:\   L:\   M:\   
Free physical memory = 390 MB
Total physical memory = 1047 MB
Video card= NVIDIA GeForce FX 5600 (Microsoft Corporation)
Sound device= Creative SB Live! Series (WDM)
NIC card = Intel(R) PRO/100 VE Network Connection
Mouse= HID-compliant MX510 Optical Mouse
Monitor= Korea Data Systems Avitron AV-195TF

compstats13.au3

Edited by Wus

Share this post


Link to post
Share on other sites

You might want to try this piece of code for NICs...You're right, the Send{keys} is ugly.

; Find_NIC.au3
; Executes the MSDOS NetSh command against a targeted Internet or Networked resource
; returning all installed NICs of the target
; ----------------------------------------------------------------------------------
Local $strcomputer,$NIC
$strcomputer = @computername
$strcomputer = InputBox("Display Network Cards", "Enter the ComputerName for a remote PC, a web address, or press the {OK} button to show My_NIC.", $strComputer, "")

; Ready to run the NetSh, save the returned information to \Documents and Settings\[currentUser]\Find_NIC.txt
RunWait(@ComSpec & " /C netsh diag show adapter " & $strcomputer & "> Find_NIC.txt",@MyDocumentsDir, @SW_HIDE)
$NIC = FileRead(@MyDocumentsDir & "\Find_NIC.txt", FileGetSize(@MyDocumentsDir & "\Find_NIC.txt"))
FileDelete(@MyDocumentsDir & "\Find_NIC.txt")

; Now lets look at all of the returned data...
MsgBox(0,"Returned Ping String [data]", "" & $NIC)

Share this post


Link to post
Share on other sites

Thx a bunch tomorrow when im not sleep ill look thru that code and actually learn it... but for the moment i just fixed my script with it...

looks alot cleaner now

i guess i lied when i said the other one was my last version... :)

compstats14.au3


Share this post


Link to post
Share on other sites

Ops! It didn't detect my NIC:..

I mod your code for this part to suit my system.

RunWait(@ComSpec & " /c netsh diag show adapter > Find_NIC.txt",@MyDocumentsDir, @SW_HIDE)
$NICfull = FileRead(@MyDocumentsDir & "\Find_NIC.txt", FileGetSize(@MyDocumentsDir & "\Find_NIC.txt"))
FileDelete(@MyDocumentsDir & "\Find_NIC.txt")
$NICkey = StringMid( $NICfull, 34, 4)
$NICcard = RegRead( "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\" & $NICkey, "driverdesc")

I don't understand why there's a need to put the system name as your code does as all your code is getting the local system status.


[font="Arial"]Thanks[/font]
If @error = me Then $sorry
Else
   Do
      $clarifyMe
   Until $meClear
EndIF
MsgBox(0,"Special Message!","Special Thanks to " & $allHadReplied,$Forever)

Share this post


Link to post
Share on other sites

Ill see if theres another way to isolate the necessary numbers from the string... because it appears that its different for different people


Share this post


Link to post
Share on other sites

#20 ·  Posted (edited)

Try this:

$niccard = StringStripCR(StringStripWS(StringMid( $NICkey , StringInStr($NICkey ,"]")+1),3))

Edit: Note: doing the above then shouldn't need to access the registry.

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0