Jump to content

Recommended Posts

Posted

Hi,

I am writing a funtion for a button that emails a printscreen and have got a bit stuck. I am using both #include <INet.au3> and #include <ScreenCapture.au3> to accomplish this. So far I have this:

#include <INet.au3>
#include <ScreenCapture.au3>

Local $EmailAddress = "x@y.z"
Local $PRTSCR_image

WinActivate( "Panel")
$PRTSCR_image = _ScreenCapture_Capture ("")

$Address = $EmailAddress
$Subject = "Screenshot from (USERNAME: " & @UserName & ") working on (HOSTNAME: " & @ComputerName & ")"
$Body = $PRTSCR_image
_INetMail($address, $subject, $body)

OK, this works except for pasting the printscreen into the body of the email. The new message appears, correct 'To:' address, correct subject but the body of the email contains 0x9E050A9A - or similar hex string. I guess this is some sort of win handle??

What I ideally want is the screenshot 'pasted' into the body. That and for the email to just be sent.

Thanks for any ideas!

Posted (edited)

Cheers somdcomputerguy - quite embarrassing that I didn't check the help file though! ;)

Cracked it now though :) Dumped the _INETMAIL - didn't appear suited to what I wanted on this occasion - substituted for OutlookEX.au3

; Take screen shot & save
Local $TLSprtscr_image 
WinActivate("Panel")
Local $TLSprtscr_image = _ScreenCapture_Capture ("C:\ISSD_PRTSCR.jpg")
Local $oOutlook = _OL_Open()

_OL_Wrapper_SendMail($oOutlook, _ ; mail client
$SD_EmailAddress, _ ; TO:
"", _ ; CC:
"",  _ ; BCC:
"Screenshot from (USERNAME: " & @UserName & ") working on (HOSTNAME: " & @ComputerName & ")", _ ;Subject
"Hi.<br><br>Please find a screen shot of my error attached.<br><br>Thanks,<br><br>" & @UserName, _ ; Body
"C:\ISSD_PRTSCR.jpg", _ ; Attachment
$olFormatHTML, "") _ ; format

If @error <> 0 Then Exit MsgBox(16, "ERROR", "Error sending mail." & @CRLF & "Please try again." & @CRLF & "If problem persists, please complete task manually")
MsgBox(64, "Complete", "Screenshot succussfully sent to '" & $SD_EmailAddress & "'." & @CRLF &"NOTE: This will show in your sent items.")

FileDelete("C:\ISSD_PRTSCR.jpg")

Cheers!

Edited by 3mustgetbeers

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
×
×
  • Create New...