Re: Entourage 2008 categories of each note into note's body
Re: Entourage 2008 categories of each note into note's body
- Subject: Re: Entourage 2008 categories of each note into note's body
- From: Paul Berkowitz <email@hidden>
- Date: Thu, 12 Nov 2009 09:51:42 -0800
- Thread-topic: Entourage 2008 categories of each note into note's body
Title: Re: Entourage 2008 categories of each note into note's body
On 11/12/09 9:05 AM, "Laine Lee" <email@hidden> wrote:
> I appear to have double-secret Entourage 2008 database corruption. Database
> can't be successfully rebuilt, even though the database check tells me
> there's nothing wrong with it. I think I could fix it if I could delete
> links, because it seems to be during the link fixing step that things go
> awry. I can live without links, but when I try to remove one, nothing
> happens, which would appear to point back to the database problem.
>
> I need an AppleScript that will let me get the categories of each note and
> append it to the note's body, because exporting notes will remove the
> category information. I can live without links, but losing the carefully
> assigned categories will be hard to swallow. Can anybody help me with an
> AppleScript like that? I think I can figure out how to get the text appended
> to the body of the note if I can get the category information from the
> original note. I did it with Palm notes when I exported them to import into
> Notational Velocity. I've never been very good with the Entourage
> AppleScript dictionary. Thanks.
Aside from a few quirks there's nothing particularly difficult about the Entourage dictionary: it's logical and straightforward.
The minor quirk here is that 'category' as a property of 'note' or of any other Entourage object is actually a *list* of categories, since objects can have multiple categories, not just one. The dictionary says so explicitly - nothing hidden here. It's just that the singular term 'category' can confuse. So you have to get that list, then get the *name* of each category in the list. Pretty straightforward. The script here presupposes that some notes might indeed have more than one category, and if so, lists them separated by commas (", "). If you only ever have one category per note, you could simplify the script by leaving out the text item delimiters and the internal repeat loop and just go for the name of item 1 of the category [list] of the note. It's still a list, even if there's only one item, so you still have to get 'item 1' of the category [list], which may be the bit you forget.
tell application "Microsoft Entourage"
set AppleScript's text item delimiters to {", "}
set allNotes to notes
repeat with i from 1 to (count allNotes)
set n to item i of allNotes
set cl to category of n -- list of categories
set cln to {} -- list of category names
repeat with j from 1 to (count cl)
set end of cln to name of item j of cl
end repeat
set content of n to (content of n & return & return & "Categories: " & cln)
end repeat
set AppleScript's text item delimiters to {""}
end tell
This would be the simplified form if you're sure you only ever have one category, or you only care about the primary category:
tell application "Microsoft Entourage"
set allNotes to notes
repeat with i from 1 to (count allNotes)
set n to item i of allNotes
set cln to name of item 1 of (get category of n) -- primary category
set content of n to (content of n & return & return & "Category: " & cln)
end repeat
end tell
--
Paul Berkowitz
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden