Jump to content



Photo

Report Computer Problem


  • Please log in to reply
7 replies to this topic

#1 jftuga

jftuga

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 315 posts

Posted 27 September 2006 - 09:09 PM

Here is a script that we will be using in our exam rooms and be placed on the Start menu. It asks for your Logon ID, location, and description of problem. It then takes a screen shot and emails this. We have it set up to be mailed to our help desk distribution list. Where it asks for Logon ID, this is really the first part of the user's email address.

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

AutoIt         
; ; 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

Attached Files









#2 cdm_Death

cdm_Death

    Seeker

  • Active Members
  • 32 posts

Posted 28 September 2006 - 01:35 AM

Here is a script that we will be using in our exam rooms and be placed on the Start menu. It asks for your Logon ID, location, and description of problem. It then takes a screen shot and emails this. We have it set up to be mailed to our help desk distribution list. Where it asks for Logon ID, this is really the first part of the user's email address.

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

AutoIt         
; ; 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




You have no idea how helpfull this is... I was writing a script to send an attachment via e-mail...

#3 Pakku

Pakku

    Prodigy

  • Active Members
  • PipPipPip
  • 183 posts

Posted 28 September 2006 - 07:51 AM

i was just looking for something what can send file with e-mails

thanks

Arjan

p.s. great script though
How can someone use Windows without using AutoIt?That one would properly don't know how to handle a computer!My scripts:Send files over internetKind of RSS reader3Draw ProUDF: convert a character string to a binary one and backCalculate PiCommand line downloader (Youtube/Google video)Set the transparency of a window just by hitting a key!Secure your pcOther things:http://www.autoitscript.com/fileman/users/arjan%20staring/My profilePM me

#4 blademonkey

blademonkey

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 432 posts

Posted 28 September 2006 - 08:05 AM

i was just looking for something what can send file with e-mails

thanks

Arjan

p.s. great script though

perhaps you mean emails with files???

Look at blat.exe it's free, and it's at the core of this email function.

google it.

Edited by blademonkey, 28 September 2006 - 08:05 AM.

---"Educate the Mind, Make Savage the Body" -Mao Tse Tung

#5 speedy6

speedy6

    Wayfarer

  • Active Members
  • Pip
  • 90 posts

Posted 16 October 2006 - 04:46 PM

I always get the message:
"unabel to send email..."
what did i do wrong?
The exe is compiled, nothing has changed blat.exe is whithin the same dir...so???

Please help me..

#6 Doppio

Doppio

    Adventurer

  • Active Members
  • PipPip
  • 126 posts

Posted 19 October 2006 - 01:44 AM

I also get the same eror.

Unable to create email message, the helpdesk will NOT be notified of this problem.

these are my settings.

Const $addr = "guayo@hotmail..com"
Const $smtp_server = "smtp..hotmail.com"
Const $smtp_FromAddress = $LogonID_data & "@hotmail..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


What am I doing wrong!

#7 RagnaroktA

RagnaroktA

    Prodigy

  • Active Members
  • PipPipPip
  • 198 posts

Posted 19 October 2006 - 12:48 PM

I also get the same eror.

Unable to create email message, the helpdesk will NOT be notified of this problem.

these are my settings.

Const $addr = "guayo@hotmail..com"
Const $smtp_server = "smtp..hotmail.com"
Const $smtp_FromAddress = $LogonID_data & "@hotmail..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
What am I doing wrong!


Looks to me like you've got one extra dot in the smtp address.

Edited by RagnaroktA, 19 October 2006 - 08:49 PM.

Current Projects:Remote Administration Suite Updated! 12-20-07Remote User State Migration Tool (Plugin) Updated! 12-20-07Batch Print Wizard Updated! 12-20-07Links:AutoIt Beta | AutoIt WikiPosted Image

#8 jftuga

jftuga

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 315 posts

Posted 19 October 2006 - 07:06 PM

Other than fixing the double dot problem, change:
Const $smtp_FromAddress = $LogonID_data & "@hotmail..com"
to just:
Const $smtp_FromAddress = "guayo@hotmail..com"
(but you won't be able to reply to them, you would have to Forward the message back to the user instead of Replying)

Also, run blat.exe from the command line with a test message until you get it working. Then, in the SendEmail() function, add a MsgBox(0, "Cmd", $cmd) to make sure that blat is doing what you *think* it should be doing.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users