Welcome to MacForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Changing Events to different Calendar in iCal

 
   Macintosh computer (Home) -> Apple Scripts RSS
Next:  Basic docs for applescripting FileMaker Pro?  
Author Message
rev

External


Since: Jan 15, 2004
Posts: 3



(Msg. 1) Posted: Thu Jan 15, 2004 11:24 pm
Post subject: Changing Events to different Calendar in iCal
Archived from groups: alt>comp>lang>applescript (more info?)

All,

I'm brand new to AppleScript... and struggling.

Basically, in iCal, I'm trying to move events that match a certain
criteria from one Calendar to another. I've got my script cycling
through all the events that I want to move, but I've got no clue how to
move them to a different Calendar.

Can someone give me a snippet to do it? But even more importantly, can
someone tell me what documentation I would look out to figure out how to
do it on my own? I've been struggling withthe iCal Dictionary, but it
just seems very unhelpful.

Thanks,
-rev

 >> Stay informed about: Changing Events to different Calendar in iCal 
Back to top
Login to vote
Patrick Stadelmann

External


Since: Nov 12, 2003
Posts: 247



(Msg. 2) Posted: Fri Jan 16, 2004 1:27 am
Post subject: Re: Changing Events to different Calendar in iCal [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article ,
rev <rev RemoveThis @TheWaterCooler.com> wrote:

 > Basically, in iCal, I'm trying to move events that match a certain
 > criteria from one Calendar to another. I've got my script cycling
 > through all the events that I want to move, but I've got no clue how to
 > move them to a different Calendar.

Unless iCal provides a simpler way, the usual procedure would be to
gather the properties of the original event, and then create the new
event with the given properties. This is basically a copy, so if you
want to move the event, you'll need to delete the original afterwards.

Patrick
--
Patrick Stadelmann

 >> Stay informed about: Changing Events to different Calendar in iCal 
Back to top
Login to vote
rev

External


Since: Jan 15, 2004
Posts: 3



(Msg. 3) Posted: Fri Jan 16, 2004 1:27 am
Post subject: Re: Changing Events to different Calendar in iCal [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Patrick Stadelmann wrote:

  >>Basically, in iCal, I'm trying to move events that match a certain
  >>criteria from one Calendar to another. I've got my script cycling
  >>through all the events that I want to move, but I've got no clue how to
  >>move them to a different Calendar.
 >
 > Unless iCal provides a simpler way, the usual procedure would be to
 > gather the properties of the original event, and then create the new
 > event with the given properties. This is basically a copy, so if you
 > want to move the event, you'll need to delete the original afterwards.

Painful, but okay. How do I handle undefined values? For example:
set location of newEvent to location of oldEvent

Will cause a "iCal got an error: NSArgumentEvaluationScriptError" if the
oldEvent does not have a location associated with it.

-rev
 >> Stay informed about: Changing Events to different Calendar in iCal 
Back to top
Login to vote
Michelle Steiner

External


Since: Jul 15, 2003
Posts: 4218



(Msg. 4) Posted: Fri Jan 16, 2004 1:27 am
Post subject: Re: Changing Events to different Calendar in iCal [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article ,
rev <rev DeleteThis @TheWaterCooler.com> wrote:

 > Painful, but okay. How do I handle undefined values? For example:
 > set location of newEvent to location of oldEvent
 >
 > Will cause a "iCal got an error: NSArgumentEvaluationScriptError" if
 > the oldEvent does not have a location associated with it.

Use a try wrapper.

try
set location of newEvent to location of oldEvent
on error errMsg number errNumber --params are optional
-- handle error as necessary, to include simply ignoring the error
end try

--
Never play strip tarot.
 >> Stay informed about: Changing Events to different Calendar in iCal 
Back to top
Login to vote
Patrick Stadelmann

External


Since: Nov 12, 2003
Posts: 247



(Msg. 5) Posted: Fri Jan 16, 2004 2:29 am
Post subject: Re: Changing Events to different Calendar in iCal [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article ,
rev <rev RemoveThis @TheWaterCooler.com> wrote:

 > Painful, but okay. How do I handle undefined values? For example:
 > set location of newEvent to location of oldEvent
 >
 > Will cause a "iCal got an error: NSArgumentEvaluationScriptError" if the
 > oldEvent does not have a location associated with it.

Use a "try / on error" block.

Patrick
--
Patrick Stadelmann
 >> Stay informed about: Changing Events to different Calendar in iCal 
Back to top
Login to vote
rev

External


Since: Jan 15, 2004
Posts: 3



(Msg. 6) Posted: Fri Jan 16, 2004 3:10 am
Post subject: Re: Changing Events to different Calendar in iCal [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

99% there! But this question sort of feels like a potential bug in
Apple's stuff.

If I have an "allday event" then the "start date" property on the event
is one day before what I expect. So when I do a strict copy, the event
gets one day longer.

i.e.

If I have Christmas set as an all day event on "December 25", when I do
set oldStartDate to start date of oldEvent

It gets set to 4:00pm December 24.

So when I create the new event, it now spans from December 24th -
December 25th and has become two days.


e.g. Here's a script that creates an all day event for today (Thursday,
January 15th), but when I get back the start/end dates, the start date
is a day off (Wednesday, January 14th). Is that expected behavior?
----
tell application "iCal"
set testCalendar to ¬
(item 1 of (every calendar whose title is "Test"))
make new event at end of testCalendar with properties ¬
{end date:current date, ¬
start date:current date, ¬
summary:"Growing Date", ¬
allday event:true}

set myNewEvent to last event of testCalendar
display dialog "[" & (start date of myNewEvent) & ¬
"] to [" & (end date of myNewEvent) & "]"
end tell
----
 >> Stay informed about: Changing Events to different Calendar in iCal 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
iCal: doesn't return all events between two dates ? - Hi Problem: iCal doesn't return all events between two dates, although it should, a bug or due to faulty code ?. The crucial line in my code, which for the most part is based on the Apple supplied "Create Event Summary.scpt" is this: ...

Working with recurring events in iCal - Hi all, I am looking for a way to get some sort of summary information on calendars, I am especially interested in getting the total duration of some collection of events. iCal does not seem to provide such a funcitonnality. I did hear about Apple..

Script to remove duplicate events in iCal? - As an AppleScript newbie I'm trying to remove duplicates from an iCal calendar. Does anybody know of such a thing? My efforts are disappointing... I can not even access the properties of an event. The algorithm should be easy, I could ask iCal for..

Export a specific calendar from iCal - Hi, I'm new to AppleScript (and must say I find it very frustrating...). I'm trying to export a specific calendar from iCal, so got the following: tell application "iCal" to activate tell application "System Events" to tell process &...

Sending events to os 8.6 from X - Hello. I have an applescript residing on a machine running 8.6 with program linking turned on. Currently, from our machine running 9 I can run the remote script with an applescript using the 'tell application "finder" of machine "xyz&quot...
   Macintosh computer (Home) -> Apple Scripts All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]