Re: Saving an attachment in Outlook Express
Re: Saving an attachment in Outlook Express
- Subject: Re: Saving an attachment in Outlook Express
- From: Ken Grimm <email@hidden>
- Date: Tue, 17 Jul 2001 19:38:49 -0500
On 7/17/01 12:51 PM, Ken Grimm at email@hidden didst inscribe
upon an electronic papyrus:
>
I can't figure out the correct syntax to save an attachment (an encoded
>
jpeg) from a message to a folder on a disk.
>
>
Can someone give me a simple example?
This is what finally worked, thanks to those who replied --
tell application "Outlook Express"
set MyMessages to every message of folder "MessagesWAttachments"
repeat with MyMessage in MyMessages
set MyAttachments to every attachment of MyMessage
if MyAttachments is not {} then
repeat with MyAttachment in MyAttachments
save MyAttachment in "Macintosh HD:My Picts:" -- THIS FINALLY WORKED!
--broke save MyAttachment in folder "My Picts" of startup disk
--broke save MyAttachment in folder "My Picts" of disk "Macintosh HD"
--and a hundred other variations that broke for various reasons
end repeat
end if
end repeat
display dialog "Finished Exporting Attachments"
end tell
OE's dict says this about the SAVE command:
save : Save an object
save reference -- the object to save
[in alias] -- the file in which to save the object
[as type class] -- the file type of the document in which to save
the data
The line that worked does not use an alias, as seemed to be required in the
dictionary. Because of the "hint" given, I tried many variations of an
"alias" syntax, but none worked.
This example underscores a recurring frustration with me and scripting --
the quality of the dictionary. From the "save" verbiage from the OE
dictionary above, I have a hard time believing I'm the only one that would
have a problem with coming up with code that works. The working code does
not specify a file, but a folder -- again, seeming to contradict the
explanation of "[in alias]".
What the heck am I missing, or is this just common experience and I just
have to get used to dictionary frustration as a part of scripting?
Gurus and others, if you can give me some insight on how to interpret a
dictionary better to make me a more efficient scripter, I am listening.
Ken