HCM311A
- Code: Select all
set {tUrl, dFolder} to {"http://10.0.6.253/SnapshotJPEG?Resolution=640x480/1.jpg ", "~/Desktop/IPCam/"}
set {oAStid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, "/"}
set fName to (last text item of tUrl) as string
set AppleScript's text item delimiters to oAStid
do shell script ("mkdir -p " & dFolder & "; curl -A/--user-agent " & tUrl & " >> " & (dFolder & fName))
set theAttachment1 to POSIX file "/Users/service/Desktop/IPCam/1.jpg"
tell application "Mail"
set newMessage to make new outgoing message with properties {subject:"Motion Received", content:"Attached Image" & return & return}
tell newMessage
set visible to false
set sender to "email_a@gmx.com"
make new to recipient at end of to recipients with properties {address:"email_b@gmail.com, email_c@gmail.com"}
make new attachment with properties {file name:theAttachment1} at after the last paragraph
(* change save to send to send*)
send --<<<<---------------- change save to send to send
(* change save to send to send*)
end tell
end tell
delay 2
tell application "Finder"
delete folder "IPCam"
end tell
it creates a temporary folder on the desktop and saves the current net cam image. At the end of the script it deletes the folder.