Sign in to follow this  
Followers 0
Altecice

Really simple confirmation question

7 posts in this topic

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:

$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 :oops:.

Thanks in advance,

Altie

Share this post


Link to post
Share on other sites



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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I have got this far but i am unsure of how to check what was pressed :oops: (returnvalue)

MsgBox ( 4, "Report?", "would you like a Report made?" [, timeout [, hwnd]] )

Thanks for the help.

Share this post


Link to post
Share on other sites

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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Ohh i see... thank you very much! :oops:

Share this post


Link to post
Share on other sites
:oops:

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#7 ·  Posted (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 by ileandros

I feel nothing.It feels great.

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