I have also attached the file which includes screenshot.dll (which I found on the forum) and blat.exe (used for sending the email).
-John
; ; ReportComputerProblem.au3 ; -John Taylor ; Sep-27-2006 ; ; This script will email your 'help desk' a short description of a computer ; problem and a screen shot. It uses two external files, screenshot.dll ; and blat.exe. ; In the SendEmail() function, change the following variables: ; $addr ; $smtp_server ; $smtp_FromAddress ; $auth_user ; $auth_pw ; ; The icon that I use when I compile to .exe for this program is: ; <a href='http://www.iconarchive.com/icon/system/alive-system-by-topicons/AngryMonitor.ico' class='bbc_url' title='External link' rel='nofollow external'>http://www.iconarchive.com/icon/system/alive-system-by-topicons/AngryMonitor.ico</a> ; #noicontray #include <GUIConstants.au3> #include <File.au3> Opt("MustDeclareVars",1) Opt("TrayIconHide", 1) Dim $ProgName = "Report Computer Problem" Dim $win = 0 Dim $w = 490 Dim $h = 300 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; func create_gui() Global $ProgName, $win, $w, $h Global $win = GUICreate($ProgName, $w, $h) GUISetState() GUICtrlCreateLabel("This program allows you to send a screenshot of your computer display to the helpdesk.", 15, 30) GUICtrlCreateLabel("When you press SUBMIT this window will close and then the screenshot will be taken.", 15, 45 ) GUICtrlCreateLabel("Enter your Logon ID ( Example: jpentz )", 15,70) Global $LogonID = GUICtrlCreateInput("", 15,85) GUICtrlCreateLabel("What is your location ( Example: ACC, Exam J9 )", 15, 120) Global $Location = GUICtrlCreateInput("", 15,135) ;GUICtrlCreateLabel("Extremely urgent?", 280, 120 ) Global $Urgent = GUICtrlCreateCheckbox("Extremely urgent?", 280, 120 ) GUICtrlCreateLabel("Enter a short description of the problem", 15, 170) Global $Problem = GUICtrlCreateInput("", 15,185,460) Global $Submit = GUICtrlCreateButton("SUBMIT", 200, 220, 80) Global $Cancel = GUICtrlCreateButton("CANCEL", 200, 260, 80) endfunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; validate user's input func Validate() Global $LogonID, $Location, $Problem if StringLen( GUICtrlRead($LogonID) ) < 2 then MsgBox(48, "Warning", "Invalid Logon ID, please try again.") return 0 endif if StringLen( GUICtrlRead($Location) ) < 2 then MsgBox(48, "Warning", "Invalid Location, please try again.") return 0 endif if StringLen( GUICtrlRead($Problem) ) < 2 then MsgBox(48, "Warning", "Invalid Problem Description, please try again.") return 0 endif return 1 endfunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; create an email message and write it to a temporary file func CreateEmailMessage() Global $EmailFile Global $LogonID, $Location, $Problem local $rv = 0 local $msg[8] local $now = @MON & "/" & @MDAY & "/" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC $msg[0] = @CRLF $msg[1] = "Date: " & $now $msg[2] = "Host: " & @ComputerName $msg[3] = @CRLF $msg[4] = "From: " & GUICtrlRead($LogonID) $msg[5] = "Location: " & GUICtrlRead($Location) $msg[6] = "Problem: " & GUICtrlRead($Problem) $msg[7] = @CRLF $EmailFile = _TempFile() return _FileWriteFromArray($EmailFile, $msg) endfunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; func ScreenShot() Global $ScreenShotFile = _TempFile("","~",".jpg") DllCall("screenshot.dll", "int", "CaptureRegion", "str", $ScreenShotFile, "int", 0, "int", 0, "int", @DesktopWidth, "int", @DesktopHeight, "int", 85) sleep(333) if 0 == @error then return 1 else return 0 endif endfunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; func SendEmail() Global $EmailFile, $ScreenShotFile, $LogonID_data, $Urgent_data Const $addr = "helpdesk@example..com" Const $smtp_server = "smtp..example..com" Const $smtp_FromAddress = $LogonID_data & "@example..com" local $smtp_subject = "Computer problem, see screenshot" Const $auth_user = "noreply" ; for your smtp server Const $auth_pw = "AbC..123" Dim $cmd, $priority, $tmp $priority = 0 if $GUI_CHECKED == $Urgent_data then $tmp = "[URGENT] " & $smtp_subject $smtp_subject = $tmp $priority = 1 endif $cmd = 'blat.exe ' & $EmailFile & ' -to ' & $addr & ' -server ' & $smtp_server & ' -f "' & _ $smtp_FromAddress & '" -subject "' & $smtp_subject & '" -attach ' & $ScreenShotFile & ' -priority ' & $priority & ' -u ' & $auth_user & ' -pw ' & $auth_pw & _ " -noh2" local $status = 0 $status = RunWait($cmd,"",@SW_HIDE) return $status endfunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; func CleanUp() Global $EmailFile, $ScreenShotFile sleep(250) FileDelete($EmailFile) FileDelete($ScreenShotFile) endfunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; func main() Global $Submit, $Cancel, $win Global $LogonID, $LogonID_data, $Urgent, $Urgent_data local $msg, $rv create_gui() while 1 $msg = GUIGetMsg() if $GUI_EVENT_CLOSE == $msg then ExitLoop if $Cancel == $msg then ExitLoop if $msg == $Submit then $rv = Validate() if 0 == $rv then ContinueLoop endif $rv = CreateEmailMessage() if 0 == $rv then MsgBox(0x10, "Internal Error", "Unable to create email message, the helpdesk will NOT be notified of this problem.") ExitLoop endif $LogonID_data = GUICtrlRead($LogonID) $Urgent_data = GUICtrlRead($Urgent) GUIDelete( $win ) $rv = ScreenShot() if 0 == $rv then MsgBox(0x10, "Internal Error", "Unable to create screen shot, the helpdesk will NOT be notified of this problem.") ExitLoop endif $rv = SendEmail() if 0 <> $rv then MsgBox(0x10, "Internal Error", "Unable to send email, the helpdesk will NOT be notified of this problem.") ExitLoop endif CleanUp() ExitLoop endif ; $msg == $Submit wend endfunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; main() ; end of script






