Applescript working with tasks

F

Frederick_N

Version: 2008
Operating System: Mac OS X 10.5 (Leopard)
Processor: Intel
Email Client: Exchange

How can I refer to the currently selected task item in Applescript. I'm trying to write a script to create a new task which inherits the body, category, and project of the current task.

There doesn't seem to be a currenttasks object and getselection doesn't seem to work.
 
A

Allen A Watson

Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor:
Intel Email Client: Exchange

How can I refer to the currently selected task item in Applescript.
I'm trying to write a script to create a new task which inherits the
body, category, and project of the current task.

There doesn't seem to be a currenttasks object and getselection
doesn't seem to work.

You're right; there seems to be no direct way to get the task, but you
can do it indirectly. If you have the task open in its own window, you
can get the title of the task by asking for the name of the window
(the_name); then you can set a variable to "task the_name" and end up
with a reference to the task by ID.

tell application "Microsoft Entourage"
set w to front window
set n to name of w
set t to task n
end tell

Alternatively, if you select the task in a list, rather than opening it,
you can do this:

tell application "Microsoft Entourage"
set the_task to selection
set the_task to item 1 of the_task
set n to name of the_task
end tell

Since "selection" might be more than one item, AppleScript returns it as
a list. So you have to get item 1 of the list to isolate the task you
want to reference.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top