The basic task I want to accomplish is to;
1) email my iMac at home an .nzb file as an attachment in an email.
2) The attachment will get automatically saved into a specific folder, and
3) My nzb downloading program which is constantly scanning this folder picks up and imports the nzb file and starts downloading from Usenet, par'ing, rar'ing and joioning the file as appropriate.
I've created a rule in Mail which triggers an applescript file listed below. Basically, this applescript file will detach any attachment and save it to a folder on the dekstop called Mail Attachments.
-----------------applescipt file--------------
property destinationFolder : (path to desktop as Unicode text) & "Mail Attachments:"
using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule
tell application "Mail"
repeat with eachMessage in theMessages
repeat with thisAttachment in eachMessage's mail attachments
if (MIME type of thisAttachment) is equal to "application/octet-stream" then
set thisFile to destinationFolder & name of thisAttachment
save thisAttachment in thisFile
end if
end repeat
end repeat
end tell
end perform mail action with messages
end using terms from
------------------end applescript file-------------------
I've tested this out using Mail as the sending client, and it works. But if I use web based mail, which I am forced to at work, then no go, the nzb file is *not* detached and saved. I know that they key is somewhere in this segment of code "application/octet-stream", but I do not know what to set the type (mime?) to be. Any ideas?
For that matter, would it just be easier to use automator to accomplish what I want?
thanks for any advice.
Tom
1) email my iMac at home an .nzb file as an attachment in an email.
2) The attachment will get automatically saved into a specific folder, and
3) My nzb downloading program which is constantly scanning this folder picks up and imports the nzb file and starts downloading from Usenet, par'ing, rar'ing and joioning the file as appropriate.
I've created a rule in Mail which triggers an applescript file listed below. Basically, this applescript file will detach any attachment and save it to a folder on the dekstop called Mail Attachments.
-----------------applescipt file--------------
property destinationFolder : (path to desktop as Unicode text) & "Mail Attachments:"
using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule
tell application "Mail"
repeat with eachMessage in theMessages
repeat with thisAttachment in eachMessage's mail attachments
if (MIME type of thisAttachment) is equal to "application/octet-stream" then
set thisFile to destinationFolder & name of thisAttachment
save thisAttachment in thisFile
end if
end repeat
end repeat
end tell
end perform mail action with messages
end using terms from
------------------end applescript file-------------------
I've tested this out using Mail as the sending client, and it works. But if I use web based mail, which I am forced to at work, then no go, the nzb file is *not* detached and saved. I know that they key is somewhere in this segment of code "application/octet-stream", but I do not know what to set the type (mime?) to be. Any ideas?
For that matter, would it just be easier to use automator to accomplish what I want?
thanks for any advice.
Tom