I need some help with an Apple Script. I want to automatically create a
task whenever a message is received from a specific account. I also
want to assign a specific category to the task. I want this to be
invisible to the user. However, when the user checks his task list, I
want him to see the task with the original message linked to it.

Is this possible? Could someone provide the code? Thanks.

Re: New Script Help: Attach "Create Task from Message" Script to by Paul

Paul
Sun May 07 18:10:02 CDT 2006

> This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

--B_3229863003_23009026
Content-type: text/plain;
charset="US-ASCII"
Content-transfer-encoding: 7bit

On 5/6/06 9:29 AM, in article
1146932955.743130.25340@i39g2000cwa.googlegroups.com,
"michael.hyatt@nospam.gmail.com" <michael.hyatt@gmail.com> wrote:

> I need some help with an Apple Script. I want to automatically create a
> task whenever a message is received from a specific account. I also
> want to assign a specific category to the task. I want this to be
> invisible to the user. However, when the user checks his task list, I
> want him to see the task with the original message linked to it.
>
> Is this possible? Could someone provide the code? Thanks.

There's already a script that comes with Entourage that does this, called
exactly how you name it so you must know it already: "Create Task from
Message".

There are just two (or three) things you have to do.

1.) That script is designed to open the new task if there's only one
selected, and running a script from a Mail Rule means only one is selected.
So open the script in Script Editor (in /Applications/AppleScript/ folder)
and "comment out" the penultimate line before the 'end tell'. This one:

if (count of selectedMessages) = 1 then open newTask

Type a double-hyphen "--" in front of it:

-- if (count of selectedMessages) = 1 then open newTask

and then click, Compile, then Save. You'll see the style of the line change
to light italics

--if (count of selectedMessages) = 1 then open newTask

(If you have any problem, just remove the line.)


2) Make a new rule - POP or IMAP (or both if you have both) or Exchange -
using the criteria you want (<From> contains <eaddress@domain.com> , for
example) and set the rule to Run AppleScript <Create Task from Message> .

3) Make sure that every correspondent that fits the criteria is a contact,
and assign the category you want to each such contact. In
Preferences/Address Book, make sure that the last option "Automatically
match message categories to sender categories" is checked.


Now every matching message is acted on by the script, which makes the task,
and assigns it the same category as the contact who sent it.

If you expect messages from lots of non-contacts a couple of lines could be
added to set the category if the sender is not a contact or does not have
the category. You'd have to tell us the name of the category.




--
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.


--B_3229863003_23009026
Content-type: text/html;
charset="US-ASCII"
Content-transfer-encoding: quoted-printable

<HTML>
<HEAD>
<TITLE>Re: New Script Help: Attach &quot;Create Task from Message&quot; Scr=
ipt to Rule</TITLE>
</HEAD>
<BODY>
<FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'font-size:12.0px'>On 5/=
6/06 9:29 AM, in article 1146932955.743130.25340@i39g2000cwa.googlegroups.co=
m, &quot;michael.hyatt@nospam.gmail.com&quot; &lt;michael.hyatt@gmail.com&gt=
; wrote:<BR>
<BR>
<FONT COLOR=3D"#0000FF">&gt; I need some help with an Apple Script. I want to=
automatically create a<BR>
&gt; task whenever a message is received from a specific account. I also<BR=
>
&gt; want to assign a specific category to the task. I want this to be<BR>
&gt; invisible to the user. However, when the user checks his task list, I<=
BR>
&gt; want him to see the task with the original message linked to it.<BR>
&gt; <BR>
&gt; Is this possible? Could someone provide the code? Thanks.<BR>
</FONT><BR>
There's already a script that comes with Entourage that does this, called e=
xactly how you name it so you must know it already: &quot;Create Task from M=
essage&quot;.<BR>
<BR>
There are just two (or three) things you have to do. <BR>
<BR>
1.) That script is designed to open the new task if there's only one select=
ed, and running a script from a Mail Rule means only one is selected. So ope=
n the script in Script Editor (in /Applications/AppleScript/ folder) and &qu=
ot;comment out&quot; the penultimate line before the 'end tell'. This one:<B=
R>
<BR>
&nbsp;&nbsp;&nbsp;<FONT COLOR=3D"#2300FF"><B>if</B></FONT> (<FONT COLOR=3D"#230=
0FF">count</FONT> <FONT COLOR=3D"#2300FF"><B>of</B></FONT> <FONT COLOR=3D"#26830=
0">selectedMessages</FONT>) =3D 1 <FONT COLOR=3D"#2300FF"><B>then</B></FONT> <FO=
NT COLOR=3D"#2300FF">open</FONT> <FONT COLOR=3D"#268300">newTask<BR>
</FONT><BR>
Type a double-hyphen &quot;--&quot; in front of it:<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;-- <FONT COLOR=3D"#2300FF"><B>if</B></FONT> (<FONT CO=
LOR=3D"#2300FF">count</FONT> <FONT COLOR=3D"#2300FF"><B>of</B></FONT> <FONT COLO=
R=3D"#268300">selectedMessages</FONT>) =3D 1 <FONT COLOR=3D"#2300FF"><B>then</B></=
FONT> <FONT COLOR=3D"#2300FF">open</FONT> <FONT COLOR=3D"#268300">newTask<BR>
</FONT><BR>
and then click, Compile, then Save. You'll see the style of the line change=
to &nbsp;light italics<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;--<FONT COLOR=3D"#4B4E4E"><I>if (count of selectedMes=
sages) =3D 1 then open newTask<BR>
</I></FONT><BR>
(If you have any problem, just remove the line.)<BR>
<BR>
<BR>
2) Make a new rule - POP or IMAP (or both if you have both) or Exchange - u=
sing the criteria you want (&lt;From&gt; contains &lt;eaddress@domain.com&gt=
; , for example) and set the rule to Run AppleScript &lt;Create Task from Me=
ssage&gt; .<BR>
<BR>
3) Make sure that every correspondent that fits the criteria is a contact, =
and assign the category you want to each such contact. In Preferences/Addres=
s Book, make sure that the last option &quot;Automatically match message cat=
egories to sender categories&quot; is checked. <BR>
<BR>
<BR>
Now every matching message is acted on by the script, which makes the task,=
and assigns it the same category as the contact who sent it.<BR>
<BR>
If you expect messages from lots of non-contacts a couple of lines could be=
added to set the category if the sender is not a contact or does not have t=
he category. You'd have to tell us the name of the category.<BR>
<BR>
<BR>
<BR>
<BR>
-- <BR>
Paul Berkowitz<BR>
MVP MacOffice<BR>
Entourage FAQ Page: <a href=3D"http://www.entourage.mvps.org/faq/index.html">=
&lt;http://www.entourage.mvps.org/faq/index.html&gt;</a><BR>
AppleScripts for Entourage: <a href=3D"http://macscripter.net/scriptbuilders/=
">&lt;http://macscripter.net/scriptbuilders/&gt;</a> <BR>
<BR>
Please &quot;Reply To Newsgroup&quot; to reply to this message. Emails will=
be ignored.<BR>
<BR>
PLEASE always state which version of Microsoft Office you are using - **200=
4**, X &nbsp;or 2001. It's often impossible to answer your questions otherwi=
se.<BR>
</SPAN></FONT>
</BODY>
</HTML>


--B_3229863003_23009026--


Re: New Script Help: Attach "Create Task from Message" Script to Rule by michael

michael
Sun May 07 19:33:36 CDT 2006

Thanks, Paul. I pretty much came to this conclusion. However, I am
programatically assigning the category, since it is the same one in
each case.

Thanks for your help!


Re: New Script Help: Attach "Create Task from Message" Script to Rule by michael

michael
Sun May 07 19:33:40 CDT 2006

Thanks, Paul. I pretty much came to this conclusion. However, I am
programatically assigning the category, since it is the same one in
each case.

Thanks for your help!