1 2 Previous Next 19 Replies Latest reply: Jan 31, 2013 4:20 PM by John Maisey
MrMur Level 1 Level 1 (0 points)

I'm trying to merge/import old iCal files from a circa-2005 iMac to my MacBook Pro (purchased in Dec. 2010). The files were pulled directly from the iMac onto an external hard drive, before the failing iMac stopped working completely. My iCal won't recognize the old files for importing. I just came back from the local Apple store Genius Bar, and the person there was stumped in whatever he tried. Is there a method for resurrecting these older iCal files? Thanks very much in advance for any help offered.

  • 1. Re: Merge/import older iCal files to newer iCal?
    John Maisey Level 5 Level 5 (6,880 points)

    Hi,

     

    Are the calendars in .ics files?

     

    Best wishes

    John M

  • 2. Re: Merge/import older iCal files to newer iCal?
    MrMur Level 1 Level 1 (0 points)

    Hi,

     

    No, they are .icalevent files. I tried changing a file's extension to .ics and opening it up but got a message that iCal couldn't read it.

     

    MrMur

  • 3. Re: Merge/import older iCal files to newer iCal?
    John Maisey Level 5 Level 5 (6,880 points)

    Hi MrMur,

     

    The .icalevent files are 'metadata' files used to help Spotlight index your data in OSX 10.4. They do not contain enough data to give you any more than basic information for an event. For example they do not store the repeat pattern of an event.  The information could be extracted (I did it using Applescript), but it would never have held the full event information, just what Spotlight needed.

     

    The better files to get from the old OSX 10.4 backup are in ~/Library/Application Support/iCal (where ~ is the path to the old User's Home folder). Buried in there would have been one corestorage.ics file for each calendar. Do you still have the contents of that folder?

     

    Best wishes

    John M

  • 4. Re: Merge/import older iCal files to newer iCal?
    MrMur Level 1 Level 1 (0 points)

    Hi, John,

     

    Alas, the iMac on which the corestorage.isc files resided is no more and has departed this life. I'm afraid all I have left are the memories and the .icalevent files. I guess I did a sloppy job of rescuing things before my iMac went screen-up.

     

    Happily, my goal is to simply to retrieve basic information from the .icalevent files showing what I had typed into a day's file (for instance, "2 pm doc appointment"). Being able to get that info into my iCal would give me a valuable record of past events and activities. I don't know if that's what you were referring to by "metadata." If so, is it a relatively simple task using Applescript to mine that data and make it attachable to my current iCal?

     

    Thanks for all your help.

     

    MrMur

  • 5. Re: Merge/import older iCal files to newer iCal?
    John Maisey Level 5 Level 5 (6,880 points)

    Hi,

     

    Try the script below and let me know how it goes.

     

    Open Applescript Editor (Applications/Utilities/Applescript Editor) copy the script below into a new window and press the Run button. A window to select the folder where the files are stored will appear. Navigate and select the folder containing your files.

     

    As mentioned above you will only recover the title, notes and time of the events from the .icalevent files.

     

    Best wishes

    John M

     

     

    ----------------------------------------------
    -- John Maisey -- www.nhoj.co.uk -- 21 Feb 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 type identifier is "com.apple.ical.bookmark")
                        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
                                  make new event at the end of events of calendar calName with properties {summary: (|summary| of myEvent), start date: (dueDate of myEvent), end date: ((dueDate of myEvent) + 1 * hours), description: (comment of myEvent), allday event: (fullDay of myEvent)}
                                  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
    
    
  • 6. Re: Merge/import older iCal files to newer iCal?
    MrMur Level 1 Level 1 (0 points)

    Hi, John,

     

    The script did not work, unfortunately. It ran and concluded with the iCal data recovery message of "0 of 0 events recovered to iCal."

     

    Just to be certain, I went back in the iCal calendar to the dates contained in the iCal events involved (I used two test files that I had copied from older iCal events) but found no entries.

     

    The script DID create a new Calendar Group called "Recovered Events," so it seems to have functioned to a certain extent.

     

    Thanks very much for the script, though. I appreciate the effort and thoughtfulness. It does appear to be quite a script -- I hope it wasn't one you worked on just for this.

     

    MrMur

  • 7. Re: Merge/import older iCal files to newer iCal?
    John Maisey Level 5 Level 5 (6,880 points)

    Hi,

     

    In that case it looks like it didn't find the files by type identifier.

     

    Try replacing the line:

     

    set myFiles to (files of myFolder whose type identifier is "com.apple.ical.bookmark")
    

     

    with:

     

    set myFiles to (files of myFolder whose name extension is "icalevent")
    

     

    Let me know how it goes.

     

    John M

  • 8. Re: Merge/import older iCal files to newer iCal?
    MrMur Level 1 Level 1 (0 points)

    Hi, John,

     

    I'm afraid that didn't work, either, although it seemed like a good idea. Here's what resulted in both of the instances I ran the adjusted script:

     

     

    MrMur

  • 9. Re: Merge/import older iCal files to newer iCal?
    John Maisey Level 5 Level 5 (6,880 points)

    Hi,

     

    I cannot see the image you posted. Did it find any of the items?

     

    Best wishes

    John M

  • 10. Re: Merge/import older iCal files to newer iCal?
    MrMur Level 1 Level 1 (0 points)

    John,

     

    I THINK it found the items that I had in the folder. The error message that occurred from the last script included info within one of the test files. Below is a PDF of that error message; with luck you can see it.

     

    Thanks much again.

     

    MrMur

     

     

  • 11. Re: Merge/import older iCal files to newer iCal?
    John Maisey Level 5 Level 5 (6,880 points)

    Sorry, still cannot see it.  What did the error message say?

  • 12. Re: Merge/import older iCal files to newer iCal?
    MrMur Level 1 Level 1 (0 points)

    I apologize for that, John. Apparently, images can't be copied into the message area.

     

    The error message started with "Can’t get comment of {entityID" then ran a long string of numbers that did not appear to relate to anything I could discern, then "summary”Work night" ("Work night" was the actual text I had entered into the calendar that day), then "privateID" with a repeat of the earlier number string, "then

    dueDate:date “Monday, August, 7, 2006 12:00 AM”, attendees:{}}." That is the date for which I had entered "Work night."

     

    MrMur

  • 13. Re: Merge/import older iCal files to newer iCal?
    John Maisey Level 5 Level 5 (6,880 points)

    MrMur wrote:

     

    The error message started with "Can’t get comment of {entityID"...

     

    I see. Try this one and let me know how you get on.

     

     

    ----------------------------------------
    -- 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 datedueDate 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
    
    
  • 14. Re: Merge/import older iCal files to newer iCal?
    MrMur Level 1 Level 1 (0 points)

    Hi, John,

     

    "Without seeing the data you have feels a bit like playng darts in a dark room. "

     

    Some of my most successful darts games have been in the dark -- although the people standing nearby didn't always agree.

     

    The latest script didn't seem to get as far as my test files. I got a puzzling "Syntax Error" message that stated: Expected "," or "}" but found identifier.

     

    MrMur

1 2 Previous Next