Sign in to follow this  
Followers 0
ErinC

PCInfo Utility - needs drop down menu

4 posts in this topic

Hi all,

I work in a technical support team and wrote a "PCInfo" utility that we copied to all PCs for our Helpdesk to use.

The script is attached. It basically reports Logged on user, pc name, domain name, ip address1, ipaddress2, ipaddress3, windows version, user profile in use, version of ms office installed, screen resolution, refresh rate and McAfee VirusScan DAT date.

When users call up for support, they are asked to run the utility on the PC and they have the option to email the information to the servicedesk.

It works great and I'm very happy with it. BUT, now I'd like to add the feature to have a drop down menu for the user to choose from a list of email addresses and I'm not sure how to tackle it. I've searched the forums for similar code but just get lost quickly.

I bet this is a quick one for some of the uber-coders round here ... please don't tear my code to bits, it WORKS ok ? :)

Thanks in advance,

Erin

PCInfo.au3

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

#cs ----------------------------------------------------------------------------
    
    AutoIt Version   : 3.3.0.0
    Author           : ErinC
    Date             : 01/20/2009
    Script Function  : PCInfo Utility - Version 3b
    
#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
#include <INet.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

; declaration of variables
$IP1 = @IPAddress1
$IP2 = @IPAddress2
$IP3 = @IPAddress3
$Office2000 = ""
$Office2003 = ""
$Office2007 = ""
$msg = ""
$Address = ""
$Subject = ""
$Body = ""

If @IPAddress1 = "0.0.0.0" Then
    $IP1 = "N/A"
Else
    ; no action required
EndIf

If @IPAddress2 = "0.0.0.0" Then
    $IP2 = "N/A"
Else
    ; no action required
EndIf

If @IPAddress3 = "0.0.0.0" Then
    $IP3 = "N/A"
Else
    ; no action required
EndIf

; Office 2000 Check
If (RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{00000409-78E1-11D2-B60F-006097C998E7}", "DisplayName") = ("Microsoft Office 2000 SR-1 Premium")) Or (RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{00000409-78E1-11D2-B60F-006097C998E7}", "DisplayName" = "Microsoft Office 2000 Premium")) Then
    $Office2000 = "Yes"
Else
    $Office2000 = "Unknown"
EndIf

; Office 2003 Check
If RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{90110409-6000-11D3-8CFE-0150048383C9}", "DisplayName") = "Microsoft Office Professional Edition 2003" Then
    $Office2003 = "Yes"
Else
    $Office2003 = "Unknown"
EndIf

; Office 2007 Check
If RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{90120000-0030-0000-0000-0000000FF1CE}", "DisplayName") = "Microsoft Office Enterprise 2007" Then
    $Office2007 = "Yes"
Else
    $Office2007 = "Unknown"
EndIf

; VScan DAT Checks
$VScan8 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Network Associates\TVD\VirusScan Enterprise\CurrentVersion", "szVirDefDate")
$VScan85 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\McAfee\AVEngine", "AVDatDate")

If ($VScan8 = "" And $VScan85 = "") Then
    $VScan8 = "Not Found"
    $VScan85 = "Not Found"
Else
EndIf

; PCInfo Message Box
$msg = MsgBox(4, "DGC PC-Information Utility", "Logged on as         :  " & @UserName & @CRLF & "PC Name                :  " & @ComputerName & @CRLF & "Domain                   :  " & @LogonDNSDomain & @CRLF & "1st IP Address       :  " & $IP1 & @CRLF & "2nd IP Address      :  " & $IP2 & @CRLF & "3rd IP Address       :  " & $IP3 & @CRLF & "Windows Version   :  " & @OSVersion & " " & @OSServicePack & @CRLF & "User Profile            : " & @UserProfileDir & @CRLF & "Office 2000           :  " & $Office2000 & @CRLF & "Office 2003           :  " & $Office2003 & @CRLF & "Office 2007           :  " & $Office2007 & @CRLF & "Screen Resolution : " & @DesktopWidth & "x" & @DesktopHeight & @CRLF & "Refresh Rate        : " & @DesktopRefresh & " Hz" & @CRLF & "VScan DAT            : " & $VScan8 & $VScan85 & @CRLF & @CRLF & "Information gathered at " & @HOUR & ":" & @MIN & " - " & @MDAY & "/" & @MON & "/" & @YEAR & @CRLF & @CRLF & "Would you like to email this information to the servicedesk ?")

; Email Section
If $msg = 6 Then

    $gui = GUICreate("Select Email-Adress", 220, 100) ; will create a dialog box that when displayed is centered
    GUICtrlCreateLabel("Select Address to send email to", 10, 10)
    $combo_address = GUICtrlCreateCombo("Servicedesk@company.com", 10, 30, 200)
    GUICtrlSetData(-1, "Servicedesk2@company.com", "Servicedesk@company.com")
    $button_ok = GUICtrlCreateButton("Send", 10, 60, 100)
    $button_cancel = GUICtrlCreateButton("Cancel", 110, 60, 100)
    GUISetState(@SW_SHOW) ; will display an empty dialog box

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()

        If $msg = $button_cancel Or $msg = $GUI_EVENT_CLOSE Then ExitLoop

        If $msg = $button_ok Then
            $Address = GUICtrlRead($combo_address)
            $Subject = String("PC-Info for User " & @UserName & " - PC Name : " & @ComputerName)
            $Body = String("Logged on as          :  " & @UserName & @CRLF & "PC Name                :  " & @ComputerName & @CRLF & "Domain                   :  " & @LogonDNSDomain & @CRLF & "1st IP Address         :  " & $IP1 & @CRLF & "2nd IP Address       :  " & $IP2 & @CRLF & "3rd IP Address       :  " & $IP3 & @CRLF & "Windows Version   :  " & @OSVersion & " " & @OSServicePack & @CRLF & "User Profile            : " & @UserProfileDir & @CRLF & "Office 2000           :  " & $Office2000 & @CRLF & "Office 2003           :  " & $Office2003 & @CRLF & "Office 2007           :  " & $Office2007 & @CRLF & "Screen Resolution : " & @DesktopWidth & "x" & @DesktopHeight & @CRLF & "Refresh Rate         : " & @DesktopRefresh & " Hz" & @CRLF & "VScan DAT            : " & $VScan8 & $VScan85 & @CRLF & @CRLF & "Information gathered at " & @HOUR & ":" & @MIN & " - " & @MDAY & "/" & @MON & "/" & @YEAR & @CRLF & @CRLF & "Please enter any additional information under the line below, or simply click Send" & @LF & "--------------------------------------------------------------------------------" & @LF & @LF)
            MsgBox(0, "", $Address & @CRLF & @CRLF & $Subject & @CRLF & @CRLF & $Body)
            _INetMail($Address, $Subject, $Body)
            ExitLoop
        EndIf

    WEnd

    GUIDelete($gui)

    WinActivate("PC-Info")

EndIf

Edited by KaFu

Share this post


Link to post
Share on other sites

Wow, that was quick KaFu ... thanks a lot, it looks like you've nearly changed it to be exactly what I was thinking of.

I should be able to modify it to be precisely what I want. Thanks again, I knew there would be an uber-coder lurking about here that was just itching to help newbcoders like me! :)

Share this post


Link to post
Share on other sites

I should be able to modify it to be precisely what I want.

You're welcome, nice and clean formulated request's lead to fast solutions :)...

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