The reason for deleting the folder first is because I want to send the latest 4 images in the folder. Would it be possible to do this in another way? Overwrite?
- Code: Select all
tell application "Finder"
delete every item of entire contents of folder "Macintosh HD:Users:Server:Documents:Securityspy:Doorbell"
end tell
set theFile to "/Users/Server/Documents/SecuritySpy/Doorbell/picture1.jpg"
tell application "SecuritySpy" to capture image as theFile camera number 0
delay 1
set theFile to "/Users/Server/Documents/SecuritySpy/Doorbell/picture2.jpg"
tell application "SecuritySpy" to capture image as theFile camera number 0
delay 2
set theFile to "/Users/Server/Documents/SecuritySpy/Doorbell/picture3.jpg"
tell application "SecuritySpy" to capture image as theFile camera number 0
delay 2
set theFile to "/Users/Server/Documents/SecuritySpy/Doorbell/picture4.jpg"
tell application "SecuritySpy" to capture image as theFile camera number 0
delay 2
tell application "Mail"
set theSubject to "Ringeklokke aktivert" -- the subject
set theContent to "Noen er ved døra" -- the content
set theAddress to "mymailadress@email.com" -- the receiver
set theAttachmentFile to "Macintosh HD:Users:Server:Documents:Securityspy:Doorbell:picture1.jpg"
set theAttachmentFile to "Macintosh HD:Users:Server:Documents:Securityspy:Doorbell:picture2.jpg"
set theAttachmentFile to "Macintosh HD:Users:Server:Documents:Securityspy:Doorbell:picture3.jpg"
set theAttachmentFile to "Macintosh HD:Users:Server:Documents:Securityspy:Doorbell:picture4.jpg"
set msg to make new outgoing message with properties {subject:theSubject, content:theContent, visible:true}
tell msg to make new to recipient at end of every to recipient with properties {address:theAddress}
tell msg to make new attachment with properties {file name:theAttachmentFile as alias}
send msg
end tell
Håvard