Skip navigation

Merge/import older iCal files to newer iCal?

1666 Views 19 Replies Latest reply: Jan 31, 2013 4:20 PM by John Maisey RSS
  • John Maisey Level 5 Level 5 (6,880 points)
    Currently Being Moderated
    Mar 4, 2012 1:22 PM (in response to MrMur)

    The forum's greedy emoticons stole a :( from the script.

     

    Try:

     

    ----------------------------------------
    -- John Maisey -- www.nhoj.co.uk -- 21 Feb 2012
    -- Modified 1 Mar 2012 
    ----------------------------------------
    set {myList, myCount, myFailures, calName} to {{}, 0, 0, "Recovered Events"}
    tell application "Finder" to set myPath to choose folder default location (path to desktop)
    set theFolders to my getSubFolders(myPath, {myPath})
    
    tell application "System Events"
              repeat with myFolder in theFolders
                        set myFiles to (files of myFolder whose name extension is "icalevent")
                        repeat with thisFile in myFiles
                                  set end of myList to (value of property list file (POSIX path of thisFile))
                        end repeat
              end repeat
    end tell
    
    tell application "iCal"
      activate
              if name of calendars does not contain calName then make new calendar with properties {name:calName}
              repeat with myEvent in myList
                        try
                                  set thisEvent to make new event at the end of events of calendar calName with properties {start date: (dueDate of myEvent), end date: ((dueDate of myEvent) + 1 * hours)}
                                  try
                                            set summary of thisEvent to |summary| of myEvent
                                  end try
                                  try
                                            set description of thisEvent to comment of myEvent
                                  end try
                                  try
                                            set allday event of thisEvent to fullDay of myEvent
                                  end try
                                  set myCount to myCount + 1
                        on error theErr
                                  set myFailures to myFailures + 1
      display dialog theErr
                        end try
              end repeat
              display dialog (myCount & " of " & (myCount + myFailures) & " events recovered to iCal") as text buttons {"OK"} default button "OK" with title "data recovery" with icon 1
    end tell
    
    on getSubFolders(myPath, mySet)
              tell application "System Events"
                        set myArray to folders of myPath
                        repeat with myItem in myArray
                                  set mySet to my getSubFolders(myItem, mySet)
                                  set end of mySet to (path of myItem) as alias
                        end repeat
              end tell
              return mySet
    end getSubFolders
    
    
  • John Maisey Level 5 Level 5 (6,880 points)
    Currently Being Moderated
    Mar 7, 2012 10:24 AM (in response to MrMur)

    I'm glad you found it helpful.

     

    MrMur wrote:

    If you plan to be in the States at some point, I will buy you a pint.

    I'll have to take you up on that some day.

  • GaleK14 Calculating status...
    Currently Being Moderated
    Jan 31, 2013 3:22 PM (in response to John Maisey)

    Hey John,

     

    I am having a similar problem and hoped you might be able to assist. I am x-fering all of my data from my MacBook OS X (V 10.4.11) to my new MacBookPro (V.10.8.2) I have been able to move over all of my data, but I am having issues importing my iCal .ics file. I have tried exporting "home.ics" and "corestorage.ics" when I import them onto the new laptop I receive the following error "Calendar can't read this calendar file. No events have been added to your calendar." Additionally, the laptop is rather old so it does not have iCloud so I cannot move over the files in that manner, I have tried both veritations of your script and have received the following error "0 of 0 events recovered."

     

    Lastly, iCal on old laptop is v 2.0.5 and Calendar on new MacBookPro is v 10.8.2

     

    Thank you in advance,

     

    -G

  • John Maisey Level 5 Level 5 (6,880 points)
    Currently Being Moderated
    Jan 31, 2013 4:20 PM (in response to GaleK14)

    Hi Gale,

     

    The scripts above are for a particular type of file that iCal used to make, not .ics files.  It will not work on .ics files.

     

    It is going to be hard to find out what is stopping your .ics files transferring without looking at them.

     

    You could try making a calendar on the old machine with a single event in and exporting the calendar and re-imorting it into Calendar on the new mac.  If that works it os probably due to some corruption in the data of the other files.

     

    Best wishes

     

    John M

1 2 Previous Next

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.