i’ve been trying to make a script that checks a folder and if there is a new file the script should send a mail to a variable person with the filename in the subject? The person should be determined on a part of the filename which corresponds to a certain e-mail address.
example:
incoming file has file name 12345test.pdf So the subject of the mail should be “File 12345test.pdf is ready”
The body of the e-mail should be a fixed text. So not that important. The email adres should be looked by the script in a list. so 12345 is in the list email adress test@test.be.
the next file 02034 then should give a different email adress… and so on.
If anyone has any suggestions??? they would be very helpfull, i’am not sure if the way i think it should work is good so let me kow if there is an easier way to do this
I included what i got so far…
on adding folder items to this_folder after receiving added_items
try
tell application “Finder”
set the subject to the name of thisfile
end tell
set the item_count to the number of items in the added_items
end try
end adding folder items to
tell application “Mail”
set newMessage to make new outgoing message with properties {subject:thisfile as text, content:“Applescript says there is a file ready”}
tell newMessage
set visible to false
make new to recipient at end of to recipients with properties {name:“koen”, address:"koenlesage@hotmail.com"}
send
end tell
end tell
Model: ibook G4
AppleScript: 1.10.6
Browser: Safari 417.9.2
Operating System: Mac OS X (10.4)