Altecice Posted March 30, 2012 Share Posted March 30, 2012 Hey guys/girls I have spent some time to write my first scrpit and now i am editing it to add new functions as a see fit, Anyway i have to my script to check for programs and install if missing and write a basic hardware report. But i have come across a little problem. Not every computer i build needs a "spec report" so is there someway i can get a message box to appear asking if you would like a report with a simple yes/no? My code so far for the report is: expandcollapse popup$a=RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "DigitalProductId") If $a<>"" Then $xpkey=MSDecode($a, "-") ClipPut($xpkey) Else MsgBox(0,"ERROR","No Product Key Found") EndIf Func MSDecode($msd_prodid, $msd_sep="") $msd_decoded ="" $msd_code="BCDFGHJKMPQRTVWXY2346789" Dim $msd_encoded[16] $msd_cnt=0 For $msd_t = 105 To 135 Step + 2 $msd_encoded[$msd_cnt]=Dec(StringMid($msd_prodid, $msd_t, 2)) $msd_cnt += 1 Next $msd_cnt=1 For $msd_t = 29 To 1 Step - 1 If $msd_cnt <> 6 Then $msd_mod = 0 For $msd_r = 14 To 0 Step -1 $msd_bit = BitOR(BitShift($msd_mod, -8), $msd_encoded[$msd_r]) $msd_encoded[$msd_r] = Int($msd_bit / 24) $msd_mod = Mod($msd_bit, 24) Next $msd_decoded = StringMid($msd_code, $msd_mod + 1, 1) & $msd_decoded $msd_cnt += 1 Else $msd_cnt=1 If $msd_sep<>"" Then $msd_decoded = $msd_sep & $msd_decoded EndIf Next Return $msd_decoded EndFunc Send("#r") WinWaitActive("Run") Send("dxdiag{Enter}") WinWaitActive("DirectX Diagnostic Tool") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{Enter}") WinWaitActive("Save As") Send("{Enter}") Sleep(1500) ;======================Part two end========================== ;======================Part three parses data of DxDiag.txt and $xpkey saves parsed data to NewFile System Info.txt same directory (Finished)========================== $Text = FileRead("C:\Documents and Settings\user\Desktop\DxDiag.txt") $ReportArrayDATA = StringRegExp($Text,"(?i)(?s)Time of this report: (.*?)"&@CRLF&".*?Operating System: (.*?)"&@CRLF&".*?System Manufacturer: (.*?)"&@CRLF&".*?System Model: (.*?)"&@CRLF&".*?Processor: (.*?)"&@CRLF&".*?Memory: (.*?)"&@CRLF,1) $NewFileHen = FileOpen("C:\Documents and Settings\user\Desktop\SpecReport.txt", 1) FileWrite($NewFileHen," ##### ##### ###### # # # # # ####### ######"&@CRLF) FileWrite($NewFileHen,"# # # # # # # # # # # # # #"&@CRLF) FileWrite($NewFileHen,"# # # # # # # # # # # #"&@CRLF) FileWrite($NewFileHen,"# # ###### # # ### # # # #"&@CRLF) FileWrite($NewFileHen,"# # # # # # # # # # #"&@CRLF) FileWrite($NewFileHen,"# # # # # # # # # # # # #"&@CRLF) FileWrite($NewFileHen," ##### ##### # ##### # # ####### # ######"&@CRLF) FileWrite($NewFileHen," "&@CRLF) FileWrite($NewFileHen," "&@CRLF) FileWrite($NewFileHen,"========================"&@CRLF&"Spec Report"&@CRLF&"========================"&@CRLF) $Input = InputBox("What is the part number?", "Please Enter the Part Number of the laptop you are working on.", "(Part Number here!)") FileWrite($NewFileHen," "&@CRLF) FileWrite($NewFileHen,"Part Number: ") FileWrite($NewFileHen,$Input) FileWrite($NewFileHen," "&@CRLF) FileWrite($NewFileHen,"Windows COA: ") FileWrite($NewFileHen,$xpkey) FileWrite($NewFileHen," "&@CRLF) FileWrite($NewFileHen," "&@CRLF) FileWrite($NewFileHen,"------------------"&@CRLF&"Basic System Info"&@CRLF&"------------------"&@CRLF) FileWrite($NewFileHen," "&@CRLF) FileWrite($NewFileHen,"Time of this report: "&$ReportArrayDATA[0]&@CRLF) FileWrite($NewFileHen,"Operating System: "&$ReportArrayDATA[1]&@CRLF) FileWrite($NewFileHen,"System Manufacturer: "&$ReportArrayDATA[2]&@CRLF) FileWrite($NewFileHen,"System Model: "&$ReportArrayDATA[3]&@CRLF) FileWrite($NewFileHen,"Processor: "&$ReportArrayDATA[4]&@CRLF) FileWrite($NewFileHen,"Memory: "&$ReportArrayDATA[5]&@CRLF) FileClose($NewFileHen) $Text = FileRead("C:\Documents and Settings\user\Desktop\DxDiag.txt") $ReportArrayDATA = StringRegExp($Text,"(?i)(?s)Card name: (.*?)"&@CRLF&".*?Display Memory: (.*?)"&@CRLF&".*?Current Mode: (.*?)"&@CRLF&".*?Monitor: (.*?)"&@CRLF,1) $NewFileHen = FileOpen("C:\Documents and Settings\user\Desktop\SpecReport.txt", 1) FileWrite($NewFileHen," "&@CRLF) FileWrite($NewFileHen," "&@CRLF) FileWrite($NewFileHen,"------------------"&@CRLF&"Display Devices"&@CRLF&"------------------"&@CRLF) FileWrite($NewFileHen," "&@CRLF) FileWrite($NewFileHen,"Card name: "&$ReportArrayDATA[0]&@CRLF) FileWrite($NewFileHen,"Display Memory: "&$ReportArrayDATA[1]&@CRLF) FileWrite($NewFileHen,"Current Mode: "&$ReportArrayDATA[2]&@CRLF) FileWrite($NewFileHen,"Monitor: "&$ReportArrayDATA[3]&@CRLF) FileClose($NewFileHen) $Text = FileRead("C:\Documents and Settings\user\Desktop\DxDiag.txt") $ReportArrayDATA = StringRegExp($Text,"(?i)(?s)Drive: C(.*?)"&@CRLF&".*?Free Space: (.*?)"&@CRLF&".*?Total Space: (.*?)"&@CRLF&".*?Model: (.*?)"&@CRLF&".*?Drive: D(.*?)"&@CRLF&".*?Model: (.*?)"&@CRLF,1) $NewFileHen = FileOpen("C:\Documents and Settings\user\Desktop\SpecReport.txt", 1) FileWrite($NewFileHen," "&@CRLF) FileWrite($NewFileHen," "&@CRLF) FileWrite($NewFileHen,"------------------"&@CRLF&"HardDisk & DVD/CD-ROM Drives"&@CRLF&"------------------"&@CRLF) FileWrite($NewFileHen," "&@CRLF) FileWrite($NewFileHen,"Drive: C"&$ReportArrayDATA[0]&@CRLF) FileWrite($NewFileHen,"Free Space: "&$ReportArrayDATA[1]&@CRLF) FileWrite($NewFileHen,"Total Space: "&$ReportArrayDATA[2]&@CRLF) FileWrite($NewFileHen,"Model: "&$ReportArrayDATA[3]&@CRLF) FileWrite($NewFileHen," "&@CRLF) FileWrite($NewFileHen,"Drive: D"&$ReportArrayDATA[4]&@CRLF) FileWrite($NewFileHen,"Model: "&$ReportArrayDATA[5]&@CRLF) FileClose($NewFileHen) FileDelete("C:\Documents and Settings\user\Desktop\DxDiag.txt") WinClose("[CLASS:#32770]", "") ;======================Part three end========================== Bit confusing but it works!. Just need help with the confirmation, i have looked around at at the messagebox tutorial but i cant seem to get it to work . Thanks in advance, Altie Link to comment Share on other sites More sharing options...
water Posted March 30, 2012 Share Posted March 30, 2012 Function "MsgBox" will do what you need. You can sepcify the buttons to appear on the MsgBox. Then you check the returnvalue for which button has beend pressed by the user. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Altecice Posted March 30, 2012 Author Share Posted March 30, 2012 I have got this far but i am unsure of how to check what was pressed (returnvalue)MsgBox ( 4, "Report?", "would you like a Report made?" [, timeout [, hwnd]] )Thanks for the help. Link to comment Share on other sites More sharing options...
water Posted March 30, 2012 Share Posted March 30, 2012 Something like this: $iResult = MsgBox(4, "Report?", "Would you like a Report made?") If $iResult = 6 Then MsgBox(64, "Report?", "Yes has been pressed!") Else MsgBox(64, "Report?", "No has been pressed!") EndIf My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Altecice Posted March 30, 2012 Author Share Posted March 30, 2012 Ohh i see... thank you very much! Link to comment Share on other sites More sharing options...
water Posted March 30, 2012 Share Posted March 30, 2012 My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
ileandros Posted March 30, 2012 Share Posted March 30, 2012 (edited) Maybe this?? $message = MsgBox(4, "Test", "test") if $message = 6 Then MsgBox(0,"test", "You pressed yes") ElseIf $message = 7 Then MsgBox(0,"test", "You pressed no") EndIf Edit: Oups a little bit late:D Edited March 30, 2012 by ileandros I feel nothing.It feels great. Link to comment Share on other sites More sharing options...
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