iCal has a useful feature that allows me to drag a task into the
calendar where it creates an event called "Work on <task>". Is there an
apple script for this in Entourage?
This script will do it. It makes an event 1 hour (60 * minutes) long -
change that if you want it shorter - from tasks that have due dates, and
skips no-due-date-tasks - that you have selected in the Tasks List or a
custom view. This version keeps the tasks (and links them to the event). If
you want to remove the original tasks, remove or comment out (precede with
--) the line
link newEvent to theTask -- if you want to keep it
near the bottom, and uncomment (remove the --) the preceding line
--delete theTask -- if you really want to replace it, or else :
and Compile.
tell application "Microsoft Entourage"
try
set theTasks to selection
if theTasks = {} then error number -128
on error
beep
display dialog "First select some tasks in the Tasks List or a
custom view." buttons {"Cancel"} default button 1 with icon 2
end try
set noDueDateTasks to {}
repeat with theTask in my theTasks
repeat 1 times
if class of theTask is task then
set {theTitle, theDueDate, hasReminder, remindTime,
isRecurring, theNotes, theCategories, theProjects, theLinks} to theTask's
{name, due date, has reminder, remind date and time, recurring, content,
category, project list, links}
if theDueDate is date "Friday, January 1, 1904 12:00:00 AM"
then
set end of noDueDateTasks to theTask
exit repeat -- skip to next task
end if
if isRecurring then set theRecurrence to recurrence
if hasReminder then
set theReminder to ((theDueDate - remindTime) div 60)
--in minutes
if theReminder < 0 then set theReminder to 0 -- no
"future" reminders for events
end if
set theEndTime to theDueDate + (60 * minutes) -- or adjust
for standard length of converted event
if isRecurring then
set newEvent to make new event with properties
{subject:theTitle, start time:theDueDate, end time:theEndTime, has
reminder:hasReminder, recurring:true, recurrence:theRecurrence,
content:theNotes, category:theCategories, project list:theProjects}
else
set newEvent to make new event with properties
{subject:theTitle, start time:theDueDate, end time:theEndTime, has
reminder:hasReminder, recurring:false, content:theNotes,
category:theCategories, project list:theProjects}
end if
if hasReminder then set remind time of newEvent to
theReminder
repeat with theLink in theLinks
link newEvent to theLink
end repeat
--delete theTask -- if you really want to replace it, or else
:
link newEvent to theTask -- if you want to keep it
end if
end repeat -- 1 times
end repeat
if noDueDateTasks ‚ {} then
beep
display dialog "You included task(s) that have no due date, which
cannot be converted to events." & return & return & "They will open now so
you can add a due date which will become the start time of an event if you
then close them, select them, and run the script again." buttons {"OK"}
default button 1 with icon 2
open noDueDateTasks
else
beep
display dialog "Done!" & return & return & "Your selected tasks have
been converted to events starting at the tasks' due dates." buttons {"OK"}
default button 1 with icon 1
end if
end tell
--
Paul Berkowitz
MVP MacOffice
Entourage FAQ Page: <
http://www.entourage.mvps.org/faq/index.html>
AppleScripts for Entourage: <
http://macscripter.net/scriptbuilders/>
Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.
PLEASE always state which version of Microsoft Office you are using -
**2004**, X or 2001. It's often impossible to answer your questions
otherwise.