Can some please help me with my code.
It works perfectly for sending to one address. But when I tried adding another address it causes the beach ball to appear on the Finder and nearly freezes the computer.
- Code: Select all
tell application "SecuritySpy"
capture image camera number 4 as "/Users/macmini/Desktop/Mailbox/Mailbox.jpg"
end tell
set theSubject to "Mailbox Sensor Detection"
set theSender to "billybob@aol.com"
set theAddress to "jimbob@aol.com"
set theAddress to "littlebob@aol.com"
set theAttachment to "/Users/macmini/Desktop/Mailbox/Mailbox.jpg"
tell application "Mail"
set theMessage to make new outgoing message with properties {subject:theSubject, sender:theSender}
tell theMessage
set visible to false
make new to recipient at end of to recipients with properties {address:theAddress}
make new attachment with properties {file name:theAttachment} at after the last paragraph
end tell
send theMessage
delay 10
end tell
tell application "System Events"
set visible of process "Mail" to false
end tell
The code below works but was wondering how I could streamline it for adding multiple addresses?
- Code: Select all
tell application "SecuritySpy"
capture image camera number 4 as "/Users/macmini/Desktop/Mailbox/Mailbox.jpg"
end tell
set theSubject to "Mailbox Sensor Detection"
set theSender to "billybob@aol.com"
set theAddress to "jimbob@aol.com"
set theAttachment to "/Users/macmini/Desktop/Mailbox/Mailbox.jpg"
set theSubject to "Mailbox Sensor Detection"
set theSender to "billybob@aol.com"
set theAddress to "littlebob@aol.com"
set theAttachment to "/Users/macmini/Desktop/Mailbox/Mailbox.jpg"
tell application "Mail"
set theMessage to make new outgoing message with properties {subject:theSubject, sender:theSender}
tell theMessage
set visible to false
make new to recipient at end of to recipients with properties {address:theAddress}
make new attachment with properties {file name:theAttachment} at after the last paragraph
end tell
send theMessage
delay 10
end tell
tell application "System Events"
set visible of process "Mail" to false
end tell
T.I.A.