Email Screenshot

Posted on
Sat Jun 02, 2012 7:18 pm
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Email Screenshot

This does the screen shot, saves the image to the desktop and sends an email, but doesn't attach
the screenshot.jpg to the email.

The file on the desktop just shows as "screenshot", without the .jpg extension.
Maybe that's the problem?

Any help greatly appreciated!

Code: Select all
set screenShotFile to (path to desktop as text) & "screenshot.jpg"

do shell script "screencapture -m " & quoted form of POSIX path of screenShotFile
delay 3
tell application "Mail"
   set addressList to {"xxxx@xxxxx.net"}
   set nameList to {"Carl"}
   set bodyvar to "Here is the saved webcam image."
   set subjectvar to "Webcam Image"
   set attachmentVar to screenShotFile
   set newMessage to (a reference to (make new outgoing message))
   tell newMessage
      repeat with i from 1 to count nameList
         make new to recipient at end of to recipients with properties {name:item i of nameList, address:item i of addressList}
      end repeat
      set the subject to subjectvar
      set the content to bodyvar
      tell content
         make new attachment with properties {file name:attachmentVar}
      end tell
   end tell
   send newMessage
end tell



Thanks,

Carl

Posted on
Sat Jun 02, 2012 9:28 pm
jay (support) offline
Site Admin
User avatar
Posts: 18224
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Email Screenshot

Possibly - the filename has to match exactly including the extension.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sat Jun 02, 2012 11:17 pm
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Email Screenshot

Got it, thanks. it was exactly that.

Carl

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 27 guests