Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'eMail Attachments.' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
eMail Attachments.
Authored by: prk on Jan 16, '03 06:07:20PM

I've been trying to learn AppleScript. I have not been able to do this yet. I want to write a script that will run as a rule in Mail.app. What I really want is for the attachment to be loaded into preview, then exported as a jpg or gif file. I can then ssh the file to my web site. I get PDF ad files that I convert to gif files and put them on a dealer web site. I have a script for Linux to do this, but ImageMagick does not do too well with some of the PDF's I get (like I get a lot of white space around stuff). Anyone know where I can get help to build a script like this? Or maybe someone could write a simple script that does it and I can take that script and add to it and learn how it works. Thanks!



[ Reply to This | # ]
eMail Attachments.
Authored by: russh on Jan 16, '03 06:42:14PM

Unfortunately, Preview is not currently scriptable... hard to believe, but true. Send feedback to Apple and ask them to add this functionality... its seems like a natural doesn't it?

Photoshop can do what you want, combined Applescript with Photoshop's built-in scripting. (Expensive, unless you already have Photoshop.)

Graphic Converter could do it with other types of images, but doesn't do PDF.

Maybe someone else knows of an inexpensive and alternative app that can handle this.

Regarding Applescript, there is a great <GREAT> beginning Applescript article in the December 2002 issue of MacWorld magazine. (Cover: "What's .Mac Worth?") Perhaps you can dig one up in a library or from a friend. It's written by Sal Soghoian, the product manager for Applescript and terrific guru/evangelist. I took a one day class from him last year and the article is basically worth a half day of the class.

Good luck. I encourage you to explore Applescript. It sounds like it could help in a production environment like yours. Visit http://www.apple.com/applescript and check out some of the power.



[ Reply to This | # ]
eMail Attachments.
Authored by: LostOnline on Jan 21, '05 04:46:57PM

I am having a problem that I'm sure someone out there would consider common sense. Unfortunately my sense is just not that common. I am new to the applescript world so I don't know too much. I have programed in C, C+, basic, and G7, so I understand technobabble just fine.
What I'm trying to do is get Mail.app on my MAC OSX v. 10.3.7 to save the attachments automatically. We get the same 2 E-Mails every day, from the same person, with a file attachment with the same filename.
What I'm trying to do is write a script that will save the attachment (which I can't figure out) rename it (easy enough) with adding the date to the end of the file (still working on, with no success), and changing the file type (because for some reason it makes it a textedit document instead of a text document, which it was when we used AOL)

So what I need to know is what tags to use to tell it to save the attachments.

And then I need to know how to add todays date to the filename when I save it

here's what I got
[code] tell application "Mail"
activate
open selected messages
save attachment as "TEXT"
end tell
tell application "Finder"
activate
set file type of document file "3456A.csv" of folder "Desktop" of folder "me" of folder "Users" of startup disk to "TEXT"
set name of document file "3456A.csv" of folder "Desktop" of folder "me" of folder "Users" of startup disk to "3456A.csv" {HERE I NEED TO INSERT THE DATE PREFERABLE IN M/D/YY FORMAT SO THAT IT LOOKS LIKE "3456A.csv1/21/05" or "3456A.csv 1/21/05"}
end tell [/code]
[code] tell application "Finder"
activate
set file type of document file "3456A_up.csv" of folder "Desktop" of folder "me" of folder "Users" of startup disk to "TEXT"
set file type of document file "3456A.csv" of folder "Desktop" of folder "me" of folder "Users" of startup disk to "TEXT"
set name of document file "3456A_up.csv" of folder "Desktop" of folder "me" of folder "Users" of startup disk to "3456A_up.csv"
set name of document file "3456A.csv" of folder "Desktop" of folder "me" of folder "Users" of startup disk to "3456A.csv"
end tell [/code]
This second one is the one I'm currently running just to changethe file type to TEXT so that I can import it into Filemaker Pro

Any help would be appriciated

Thanks,
LostOnline



[ Reply to This | # ]