ioliver Posted September 24, 2004 Posted September 24, 2004 expandcollapse popup; System Information.AU3 ; Ian Oliver ; September 23, 2004 $host = InputBox("System Information (AU3)", "Host Name?") Call("PSInfo") Call("MakeModel") $txt_Report = FileOpen("c:\SIR.txt", 2) FileWriteLine($txt_Report, "Host Name: " & $host & "") FileWriteLine($txt_Report, "") FileWriteLine($txt_Report, "Make: " & $make & "") FileWriteLine($txt_Report, "Model: " & $model & "") FileWriteLine($txt_Report, "Processor: " & $processortype & "") FileWriteLine($txt_Report, "Speed: " & $processorspeed & "") FileWriteLine($txt_Report, "Memory: " & $memory & "") FileClose($txt_Report) Call("Cleanup") MsgBox(0, "System Information (AU3 + a little VBS)", "Complete!") Func PSInfo() FileInstall("c:\psinfo\psinfo.exe", "c:\psinfo.exe") FileInstall("c:\psinfo\pdh.dll", "c:\pdh.dll") RunWait(@ComSpec & ' /c c:\psinfo.exe -c "\\' & $host & '" > c:\psinfo.txt', 'c:\', @SW_HIDE) $txt_psinfo = FileReadLine("c:\psinfo.txt") $array_psinfo = StringSplit($txt_psinfo, ",") ; PSInfo Variables $processorspeed = $array_psinfo[17] $processortype = $array_psinfo[18] $memory = $array_psinfo[19] EndFunc Func MakeModel() $vbs = FileOpen("c:\MakeModel.vbs", 2) FileWriteLine($vbs, "") FileWriteLine($vbs, "On Error Resume Next") FileWriteLine($vbs, 'Set FSO = CreateObject("Scripting.FileSystemObject")') FileWriteLine($vbs, 'Set MakeModel = FSO.CreateTextFile("c:\MakeModel.txt", True)') FileWriteLine($vbs, 'strComputer = "' & $host & '"') FileWriteLine($vbs, 'Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")') FileWriteLine($vbs, 'Set colItems2 = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48)') FileWriteLine($vbs, "") FileWriteLine($vbs, "For Each objItem in colItems2") FileWriteLine($vbs, "") FileWriteLine($vbs, "Make = objItem.Manufacturer") FileWriteLine($vbs, "Model = objItem.Model") FileWriteLine($vbs, "MakeModel.WriteLine Make") FileWriteLine($vbs, "MakeModel.WriteLine Model") FileWriteLine($vbs, "") FileWriteLine($vbs, "Next") FileClose($vbs) Run("wscript.exe c:\MakeModel.vbs") $txt_MakeModel = FileOpen("c:\MakeModel.txt", 0) ; MakeModel Variables $make = FileReadLine($txt_MakeModel, 1) $model = FileReadLine($txt_MakeModel, 2) FileClose($txt_MakeModel) EndFunc Func Cleanup() FileDelete("c:\psinfo.exe") FileDelete("c:\pdh.dll") FileDelete("c:\psinfo.txt") FileDelete("c:\MakeModel.vbs") FileDelete("c:\MakeModel.txt") EndFunc I did check the help like on this... But I don't understand how to use Return() After I run the Functions, I need to use the Variables that they generate to create a report. But, I don't think the Variables cary over from the Functions? I'm sorry if that's not very clear. Please let me know if you need more information. -> Ohh, check the $make Variable, it's the first example of the problem. Thanks, Ian "Blessed be the name of the Lord" - Job 1:21Check out Search IMF
ioliver Posted September 24, 2004 Author Posted September 24, 2004 I didn't mean to post twice, I got some kind of "Error with the Database" screen so I resubmitted. Ian "Blessed be the name of the Lord" - Job 1:21Check out Search IMF
Developers Jos Posted September 24, 2004 Developers Posted September 24, 2004 (edited) ioliver said: I did check the help like on this... But I don't understand how to use Return() After I run the Functions, I need to use the Variables that they generate to create a report. But, I don't think the Variables cary over from the Functions? I'm sorry if that's not very clear. Please let me know if you need more information. -> Ohh, check the $make Variable, it's the first example of the problem. Thanks, Ian <{POST_SNAPBACK}>Just do a Global Statement for all the Variables you want to use between the main code and the functions at the start of your script. eg Global $host Global $Model Edited September 24, 2004 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now