I need some help to start off a script and there is no better forum than this to find it!
The workflow is that my web server will send me a xxxx.csv file as an attachment in a email.
I read the attachment and use the info to create iCal events.
The problem is I don’t know how to read the attachment.
I presume I create a Mail rule and then get it to perform an applescript, but thats the bit I am stuck on.
Any help is always appreciated
Model: Lots of them
Browser: Safari 523.15
Operating System: Mac OS X (10.5)
You’d start with a mail rule that included “Any Attachment” contains/ends with/etc. to identify the attachments you want to deal with, and then write a brief AppleScript to open the attachment. I don’t know anything about CSV, so don’t know anything about its documents to identify or open them.
you have to save the attachment somewhere and read it form there
a rule script could look like
property destinationFolder : "path:to:Folder:" -- the colon at the end is necessary
using terms from application "Mail"
on perform mail action with messages theMessages
tell application "Mail"
repeat with oneMessage in theMessages
try
repeat with oneAttachment in mail attachments of oneMessage
save oneAttachment in destinationFolder & name of oneAttachment
end repeat
end try
end repeat
end tell
end perform mail action with messages
end using terms from
there is almost no error handling, if a file exists at destination path, the attachment won’t be saved
To parse the .csc file use AppleScript’s read command and text item delimiters
Just found out you are musician Stefan. Should have guessed from your most lyrical scripts. With enough maths perhaps you could use an applescript that could create music that would ape Xenakis score. :lol: