Applescript entourage events

P

peterthebag

HI,
I posted a coule of weeks ago, but that was during the developer
conference, and I only got one reply, hence the repost.

What I am wanting to do is to use a script to "automate" creation of
entourage events. It should display dialogue boxes which I input
data 
into, which it then uses to create the events. I am trying to
get it 
to set all the major properties: name, start and end date and
time, 
category, and repetition.

I have tried several ways of doing this, but all I can do is get it
to 
create an event with the name and category I give it. Everything
else 
is ignored

the code I am currently using is:

tell application "Microsoft Entourage"

-- get the information from the user, and store it in variables

display dialog "Subject: " default answer ""
set theName to the text returned of the result

display dialog "Enter Event Category: " default answer ""
set theCategory to the text returned of the result

display dialog "Enter Start of the event: " default answer ""
set myStart to the text returned of the result

display dialog "duration of event in minutes" default answer ""
set mytime to the text returned of the result

-- create a new event with the information from the usre input

set newEvent to make new event with properties ¬
{subject:theName, category:{category theCategory}}

set theStart to date myStart
set theend to date ((myStart) + 1 * hours)

-- set times of event
set start time of newEvent to theStart
set end time of newEvent to theend

end tell


Entourage simply won't takes the dates. It says: Can't get date
"29/06/2007, 13:00"

I've tried some of this in the script editor and it seems that the
dates are in the right date class format, so I just dont understand
where i'm going wrong. Does anyone know how I can make this work?
Also, can anyone advise as to how i can do recurrance?

Thanks, Peter
 
J

Jolly Roger

Entourage simply won't takes the dates. It says: Can't get date
"29/06/2007, 13:00"

That's because that's not a properly-formatted date.

Try it with a date of "06/29/2007 1:00 PM" instead. ; )
 
J

Jolly Roger

I'm in europe so it would normaly be day/month/year.

I did try doing it as : 06/29/2007 1:00 PM but it stil does not like
that either.

Run this command in Script Editor and tell me the result:

set d to the current date
return d's short date string & " " & d's time string

Whatever format it returns is the format you need to use.
 
P

peterthebag

Run this command in Script Editor and tell me the result:

set d to the current date
return d's short date string & " " & d's time string

Whatever format it returns is the format you need to use.

This returns:

"25/6/07 8:17:30"

Peter
 
J

Jolly Roger

What I am wanting to do is to use a script to "automate" creation of
entourage events. It should display dialogue boxes which I input
data 
into, which it then uses to create the events.

To tell you the truth, I'm not sure I see how is this going to be any
faster than simply editing the fields in the standard Entourage new
event window.Either way you're going to have to type in certain
information, and with AppleScript, the way you obtain the information
is limited to a text box, whereas in the Entourage new event window,
there are plenty of alternative ways to specify things like dates and
the like.
 
J

Jolly Roger

Okay you can't tell Entourage to do the date calculation or you'll get
an error about the date. Do that outside of the Entourage tell block.

Also, you need to set a variable to the category before using it in the
"make new event" command.

Try this:

-- begin script
set eSubject to "test"
set eCat to "Business"
set eStart to "6/25/2007 1:00 PM" -- use format appropriate for your system
set eDuration to "25"

set startTime to date eStart
set endTime to startTime + (eDuration * minutes)

tell application "Microsoft Entourage"
set cat to category eCat
set newEvent to make new event with properties ¬
{subject:eSubject, category:{cat}, start time:startTime, end time:endTime}
end tell
-- end script
 
P

peterthebag

Okay you can't tell Entourage to do the date calculation or you'll get
an error about the date. Do that outside of the Entourage tell block.

Also, you need to set a variable to the category before using it in the
"make new event" command.

Try this:

-- begin script
set eSubject to "test"
set eCat to "Business"
set eStart to "6/25/2007 1:00 PM" -- use format appropriate for your system
set eDuration to "25"

set startTime to date eStart
set endTime to startTime + (eDuration * minutes)

tell application "Microsoft Entourage"
set cat to category eCat
set newEvent to make new event with properties ¬
{subject:eSubject, category:{cat}, start time:startTime, end time:endTime}
end tell
-- end script

Thankyou so much. That works. I've merged it with the code for dialog
boxes for input and that seems to work now. Do you know how I might
implement repetition, as many of my calendar events repeat.

Many thanks,

Peter
 
J

Jolly Roger

Do you know how I might
implement repetition, as many of my calendar events repeat.

According to the Entourage AppleScript dictionary, the "recurring"
property of an event is read-only.

Have you looked at the Entourage dictionary with Script Editor? To
view it, from the Script Editor menu bar, select File > Open
Dictionary, then select Microsoft Entourage from the list of
applications. Then search for "event" and select the one with a C
(class) next to it to examine all the properties of the "event" class.
 
P

peterthebag

According to the Entourage AppleScript dictionary, the "recurring"
property of an event is read-only.

Have you looked at the Entourage dictionary with Script Editor? To
view it, from the Script Editor menu bar, select File > Open
Dictionary, then select Microsoft Entourage from the list of
applications. Then search for "event" and select the one with a C
(class) next to it to examine all the properties of the "event" class.

Many thanks, I'll do that.

Peter
 

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