Well, first you have to get the names of the categories from that list, then coerce them to text (I use a comma-and-space to separate them if more than one:
Thanks.
This works very well. I made a few formatting changes to eliminate blank lines, but the addition of categories to the note works very nicely. I had no idea how to do that.
As an occasional scripter (very occasional), the problem I face is that each new effort usually presents a very steep learning curve. For example, I’ve been playing around with trying to get the note to format the name of each task to bold, but I can’t seem to format the note at all. The Entourage X dictionary doesn’t list formatting commands and the references I’ve found in the AppleScript Language Guide PDF don’t seem to apply here. Is there an easy way to bold just the name of each task in the note, or would that make this simple little script too bloated?
This is the script in its current iteration:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-- script by Paul Berkowitz to create a note from selected tasks
-- modified 4/18/04 to include priorities, tasks, and categories
property separator : "-------------------------------------------------------------------------------------------"
set today to short date string of (current date)
tell application "Microsoft Entourage"
activate
select main window -- brings it to front
try
set dispArea to displayed area of main window
if dispArea is not tasks area then error number -128
on error
beep 2
display dialog "You must first select some tasks in the Tasks List." buttons {"OK"} default button 1 with icon 0
return
end try
try
set selectedTasks to the selection
on error
beep 2
display dialog "You must first select some tasks in the Tasks List." buttons {"OK"} default button 1 with icon 0
return
end try
set notesText to "" as Unicode text
repeat with theTask in selectedTasks
set {theName, theDueDate, theNote, thePriority, theCategories} to theTask's {name, due date, content, priority, category}
set categoryNames to {}
repeat with i from 1 to (count theCategories)
set aCategory to item i of theCategories
set end of categoryNames to (name of aCategory)
end repeat
set AppleScript's text item delimiters to {", "}
set categoryNames to categoryNames as Unicode text
set AppleScript's text item delimiters to {""}
if categoryNames = "" then set categoryNames to "None" -- optional
try -- works in Panther
set theDueDate to short date string of theDueDate
on error
set theDueDate to date string of theDueDate
end try
set notesText to notesText & separator & return & "� " & theName & " - " & theDueDate & return & "Priority: " & thePriority & " - " & "Categories: " & categoryNames & return
if theNote is not equal to "" then set notesText to notesText & theNote & return -- prints line only if note is not empty
end repeat
set notesText to notesText & separator
set tasksNote to make new note with properties {name:"Tasks Note - " & today, text:styled text, content:notesText}
open tasksNote -- tasksNote
try
print tasksNote
end try
end tell
-----------------------------------------------------------
--
Bruce
____________________________________________________
B R U C E K. klutch-at-erols.com
