Skip to content

Instantly share code, notes, and snippets.

@dnlcrl
Last active January 3, 2016 12:42
Show Gist options
  • Save dnlcrl/c11887a8ebcb6390c3cc to your computer and use it in GitHub Desktop.
Save dnlcrl/c11887a8ebcb6390c3cc to your computer and use it in GitHub Desktop.
Capture an image and send it with iMessage
#!/usr/bin/osascript
set rec to "1234567890"
set appleid to "E:XXXXXX@gmail.com"
set today to current date
set currentDayNumber to day of today as string
set currentMonthName to month of today as string
set currentYear to year of today as string
set theDate to (currentMonthName & " " & currentDayNumber & ", " & currentYear & ".")
set theTime to time string of (current date)
set mssg to "Script Started at " & theTime & ", " & theDate
do shell script "/usr/local/bin/imagesnap ~/snapshot.jpg"
set theAttachment to POSIX file ((system attribute "HOME") & "/snapshot.jpg" as text)
tell application "Messages"
activate
send mssg to buddy rec of service appleid
send theAttachment to buddy rec of service appleid
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment