Changing the time of an event using CalendarLib
Changing the time of an event using CalendarLib
- Subject: Changing the time of an event using CalendarLib
- From: Christian Boyce <email@hidden>
- Date: Mon, 06 May 2019 20:28:48 -0700
Anyone modifying calendar events with AppleScript?
I'm using CalendarLib EC to create events from a tab-delimited set of data.
Some of the events are created as all-day events because the times for those
events have not been set. When I eventually get the times for those all-day
events I want to update them, changing them from all-day events to regular
events with start times and end times.
I would think I could do something like this:
set theResult to modify event event anEvent event description eventDescription
starting date theStartDateTime ending date theEndDateTime destination calendar
existingCal without runs all day
store event event anEvent event store existingStore -- save the event
If theStartDateTime is a date like this:
date "Monday, May 6, 2019 at 10:00:00 PM" and theEndDateTime is something like
date "Monday, May 6, 2019 at 11:30:00 PM"
I would expect my event to go from an all-day event to an event starting at 10
pm and ending on 11:30 pm. But what I get is different. The event loses its
all-day status but it lands at 12 noon, not at the specified time.
I experimented and eventually got what I wanted if I did this:
set theResult to modify event event anEvent event description eventDescription
starting date theStartDateTime ending date theEndDateTime destination calendar
existingCal without runs all day
store event event anEvent event store existingStore -- save the event
-- do it again
set theResult to modify event event anEvent event description eventDescription
starting date theStartDateTime ending date theEndDateTime destination calendar
existingCal without runs all day
delay 5 -- the modified event does not save quickly enough-- we need to stall
store event event anEvent event store existingStore -- save the event
—
It works but I would rather not put in the delay. Is there another way?
C
Christian Boyce
Christian Boyce and Associates
Mac, iPhone, and iPad Consultants
For appointments, please call the office: 424-354-3548.
We do not make appointments by email or text. We're old-fashioned that way.
Read our latest blog post: NBA Playoffs Calendar for iPhone and Mac
<https://christianboyce.com/nba-playoffs-calendar-for-iphone-and-mac/>
Follow us on Twitter! http://twitter.com/christianboyce
<http://twitter.com/christianboyce>
Be a fan on Facebook! https://www.facebook.com/christianboyce.and.associates
<https://www.facebook.com/christianboyce.and.associates>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden