AppleScript "Create Note from Event(s)" ??

R

Rick.Cogley

Hello -

I am on Entourage 11.2.3, Office 2004, OS/X. I've been struggling to
learn a little AppleScript, and noticed the scripts Entourage comes
with, which are to create from messages, either of events, tasks, or
notes. These are the scripts in the default scripts menu.

I'm looking for something that would create a note from a selected
event or events. I noticed you unfortunately cannot drag and drop
things around in Entourage, which is something sorely missing in my
opinion compared to Outlook. I'm used to that.

I thought I would be able to use the "create note from message" script
as a base, and convert it to instead create notes from selected events.
However, it seems that the AppleScript dictionary does not support what
I am trying to do.

The original MS script is below, and I started with:

-- get the currently selected message or messages
set selectedMessages to current messages

I tried converting this to:

set selectedEvents to current events

.... but this just gives a compile error: Expected end of line but
instead found plural class name.

Could any of the members be so kind as to comment on the above? Is this
even possible, given how the Entourage dictionary is set up? Any advice
much appreciated...

Kind regards,
Rick Cogley

== original microsoft script ==
(*
Create Note from Message

Copyright (c) Microsoft Corporation. All rights reserved.
*)

tell application "Microsoft Entourage"

-- get the currently selected message or messages
set selectedMessages to current messages

-- if there are no messages selected, warn the user and then quit
if selectedMessages is {} then
display dialog "Please select a message first and then run this
script." with icon 1
return
end if

repeat with theMessage in selectedMessages

-- get the information from the message, and store it in variables
set theName to subject of theMessage
set theCategory to category of theMessage
set theContent to content of theMessage

-- create a new note with the information from the message
set newNote to make new note with properties {name:theName,
category:theCategory, content:theContent}

-- create a link between the message and the new note
link theMessage to newNote

-- if there was only one message selected, then open that new note
if (count of selectedMessages) = 1 then open newNote
end repeat
end tell
 
B

Barry Wainwright [MVP]

Hello -

I am on Entourage 11.2.3, Office 2004, OS/X. I've been struggling to
learn a little AppleScript, and noticed the scripts Entourage comes
with, which are to create from messages, either of events, tasks, or
notes. These are the scripts in the default scripts menu.

I'm looking for something that would create a note from a selected
event or events. I noticed you unfortunately cannot drag and drop
things around in Entourage, which is something sorely missing in my
opinion compared to Outlook. I'm used to that.

I thought I would be able to use the "create note from message" script
as a base, and convert it to instead create notes from selected events.
However, it seems that the AppleScript dictionary does not support what
I am trying to do.

The original MS script is below, and I started with:

-- get the currently selected message or messages
set selectedMessages to current messages

I tried converting this to:

set selectedEvents to current events

... but this just gives a compile error: Expected end of line but

instead found plural class name.

Could any of the members be so kind as to comment on the above? Is this
even possible, given how the Entourage dictionary is set up? Any advice
much appreciated...

Kind regards,
Rick Cogley

There is no 'current events' function in the dictionary. You would have to
us 'selection' to return a list of selected events, but carry out a check to
see that the command has returned events (selection could return anything,
depending on what is active and selected in the GUI)

E.g.:

set theEvents to selection
if class of (first item of theEvents) is not event then return
 
P

Paul Berkowitz

There is no 'current events' function in the dictionary. You would have to
us 'selection' to return a list of selected events, but carry out a check to
see that the command has returned events (selection could return anything,
depending on what is active and selected in the GUI)

E.g.:

set theEvents to selection
if class of (first item of theEvents) is not event then return

It's not a bad idea to expand that also for the situation that you haven't
selected anything:

set theEvents to selection
try
if class of (first item of theEvents) is not event then return
on error
return
end try

Better yet is to include an error message. See my script I just sent to
this newsgroup for "Creating Events from Tasks" thread.

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

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