Re: Help with Entourage/Outlook
Re: Help with Entourage/Outlook
- Subject: Re: Help with Entourage/Outlook
- From: Paul Berkowitz <email@hidden>
- Date: Sun, 17 Dec 2000 19:49:10 -0800
On 12/17/00 7:09 PM, "Doug" <email@hidden> wrote:
>
I'm writing an AppleScript for archiving files in Entourage. If you've never
>
worked with it then don't worry, the dictionary is the same as it is in
>
Outlook Express. I've run into two problems.
>
>
I want to be able to have it save all messages, that are in a particular
>
folder, to the desktop (or a selected folder). I am setting it to save as
>
either Word, Applescript, Bbedit or Simpletext. But I can't seem to get it
>
to list or automatically select all messages in that particular folder.
Hi, Doug,
Welcome to the list.
First, how do you want to identify the folder? If it's a subfolder, you
always have to through the whole hierarchy of folders, just like the Finder
does:
set theFolder to folder "Subsubfolder C" of folder "Subfolder B" of
folder "TopFolder A"
(If it happens to be an IMAP folder, you need to add:
set theFolder to folder "Subsubfolder C" of folder "Subfolder B" of
folder "TopFolder A" of IMAP account "MyAccountName"
)
It's easier if you just select the folder in the Folder pane:
set theFolder to the selection
-- folder id 104 -- for example
or, alternatively with the main window set to 3-pane view, so its contents
are displayed in the message pane, or in its own window:
set theFolder to the displayed feature of window 1
--folder id 104
Once you know the folder by id number or set as a variable, you don't have
to go through the whole hierarchy as you do by name.
Now it's pretty easy. To get all the messages as a list:
set theMsgs to every message of theFolder
To select them all (you _can't_ do this in Outlook Express, only in
Entourage - there's no way to do this in OE):
--open theFolder --or
select the main window -- to bring it to the front
set displayed feature of main window to theFolder
set selection to (every message of theFolder)
To save them all, you need a repeat loop. And remember that "file" is an
Entourage keyword so you can't use it as you would normally:
set theName to subject of theMsg
save theMsg in file ((path to desktop) as string) & theName --ERROR!
If you have Jon's Commands or Akua Sweets installed, their silent
string-to-file coercions allow you to do:
save theMsg in ((path to desktop) as string) & theName
If you're doing it for other users who may not have either osax, I can't
remember if that still works; otherwise this should work:
save theMsg in (((path to desktop) as string) & theName) as file
specification
You can use any other path name, of course. And see below for names.
>
>
Also, I can't seem to save attachments separately. Is there a way to do
>
this?
Yes:
set theAttachements to (every attachment of theMsg)
repeat with i from 1 to (count theAttachements )
set theAttachment to item i of theAttachments
set attachName to name of theAttachment
save theAttachement in ((path to desktop) as string) & attachName)
--etc.
end repeat
But you have to check that:
1) the name is less than 32 characters long, or shorten it
2) the name doesn't contain any colons (:) - change them to dashes
2) there's no file of the same name already in that location
If you go to
AppleScripts for Entourage & Outlook Express
<
http://homepage.mac.com/berkowit28/>
or AppleScript Central
<
http://www.applescriptcentral.com/>
and look for my script 'Save/Expand Attachments E', you'll see my routine
for checking all those things. I use a different method than the Finder for
step 3, because the Finder often messes this up.
Good luck. If you're going to be doing a lot of Entourage scripting you
might also want to join the Entourage list at:
<
mailto:email@hidden>
(But, more likely than not, I'll be the one replying there too.)
--
Paul Berkowitz