Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

iCal: Duplicate/Move items between calendars Apps
iCal will normally allow you to export a calendar, and then import it into the calendar of your choice. However, if your desired calendar is on an Exchange server AND it's not your primary calendar on that account, iCal lists those calendars as grayed out.

With a little AppleScript, we can get most of those back, and into any calendar you want.

In AppleScript editor, copy-paste the following and run. Or you can grab it off my public MobileMe folder. You will be provided a list of calendars as the source, anther list as the destination, and then confirm that you want to copy ALL the items from one to the other.

Cancel at any time to quit.

Unfortunately I could not figure out how to create reoccuring events easily in the same statement as the non-reoccuring ones. Please take this into account when copying events.
--iCal Event Duplicator.scpt
--Writen by Mike Cramer
--January 10, 2011 ~ 4pm CST
--
--Assume GPL style license.

tell application "iCal"
  
  set TheCalendars to name of calendars
  
  set theSourceCalendar to ""
  set theDestinationCalendar to ""
  
  choose from list TheCalendars with title "Please select a source calendar" without empty selection allowed
  set theSourceCalendar to result as string
  
  if theSourceCalendar is "" then
    --do nothing
  else
    
    set theOtherCals to {}
    repeat with anItem in TheCalendars
      if (anItem as string) is not (theSourceCalendar as string) then set theOtherCals to theOtherCals & anItem
    end repeat
    
    choose from list theOtherCals with title "Please select a destination calendar" without empty selection allowed
    set theDestinationCalendar to result as string
    
    
    if theDestinationCalendar is "" then
      --do nothing
    else
      
      display dialog "Copy calendar events from " & theSourceCalendar & " to " & theDestinationCalendar & "?" buttons {"OK", "Cancel"} default button 2
      if the button returned of the result is "OK" then
        set TheEvents to events of calendar theSourceCalendar
        
        repeat with anEvent in TheEvents
          
          tell anEvent
            set theProperties to properties
            
            set THEdescription to description
            if THEdescription = missing value then set THEdescription to ""
            set thestartdate to start date
            if thestartdate = missing value then set thestartdate to ""
            set THEenddate to end date
            if THEenddate = missing value then set THEenddate to ""
            set THEalldayevent to allday event
            if THEalldayevent = missing value then set THEalldayevent to ""
            set THErecurrence to recurrence
            if THErecurrence = missing value then set THErecurrence to ""
            set THEexcludeddates to excluded dates
            --      if THEexcludeddates = missing value then set THEexcludeddates to ""
            set THEstatus to status
            if THEstatus = missing value then set THEstatus to ""
            set THEsummary to summary
            if THEsummary = missing value then set THEsummary to ""
            set THElocation to location
            if THElocation = missing value then set THElocation to ""
            set THEurl to url
            if THEurl = missing value then set THEurl to ""
            
          end tell
          
          tell calendar theDestinationCalendar
            make new event at end with properties {description:THEdescription, start date:thestartdate, end date:THEenddate, allday event:THEalldayevent, summary:THEsummary, location:THElocation, url:THEurl}
          end tell
        end repeat
      else
        --do nothing
      end if
    end if
  end if
end tell

[crarko adds: I tested this, and it works as described, although I don't have an Exchange hosted calendar to try it with at the moment.]
    •    
  • Currently 2.00 / 5
  You rated: 3 / 5 (2 votes cast)
 
[9,794 views]  

iCal: Duplicate/Move items between calendars | 2 comments | Create New Account
Click here to return to the 'iCal: Duplicate/Move items between calendars' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
iCal: Duplicate/Move items between calendars
Authored by: michaelbach on Jan 12, '11 08:13:05AM
I have battled with the same problem and found you don't need to set all event properties, rather duplicate the event to the destination calender like so

repeat with anEvent in TheEvents
	duplicate anEvent to end of theDestinationCalendar
end repeat
Best, Michael.

[ Reply to This | # ]
iCal: Duplicate/Move items between calendars
Authored by: bobcote on Apr 20, '11 12:19:26AM

Would it be possible for you to modify that script so that it would first verify if an exact same event already exists in the destinationCalendar? This way, when executing the script next time, only new events from the subscribed calendar would be copied. Because right now, I'm getting duplicates for each events every time I execute the script, and since I would like to automate it to execute every hour, that needs to be changed. I just don't know how to code scripts.
Thank you



[ Reply to This | # ]