Dave Schweisguth in a Bottle

How many meanings of that can you think of?

Migrating Palm application data to Android

leave a comment »

There can’t be many other people left in the world who have a Palm device whose data they want to move to something newer. I mostly used my series of Palm devices for their built-in productivity applications (Contacts, Calendar, Memos, Tasks) and I was happy with the most recent, a Treo, for six years. Although it’s surprisingly tough, having survived many falls onto concrete sidewalks with only a few scratches, I finally managed to break a few pixels in its screen recently. And the Palm Desktop software doesn’t run on Mac OS later than 10.4, so when I finally retire the older of my Mac laptops I won’t be able to sync the Treo. Time to move on.

Another reason I kept the Treo as long as I did is that I wasn’t looking forward to the migration. I’ve used Palms for twelve years, and I intend to keep my data. I expected it would be a significant project to move it all over. It wasn’t as bad as I feared —  Palm Desktop was prepared to bow out gracefully, in that it could export all of its data into standard or at least reasonable formats — but it took enough experimentation and fiddling that I’ve written it down here on the off chance that it will help someone else who still has this job ahead of them.

Source: Palm Treo 650 running Palm OS 5.4.8, synced to a Mac OS 10.4 laptop running Palm Desktop 4.2.1. A Mac OS 10.6 laptop pitched in too.

Target: Droid X running Android 2.2.1.

Contacts

Android’s stock Contacts application syncs with GMail contacts, so I saw no reason to look further. Palm Desktop can export contacts as vCards and GMail can import that format, so migrating from one to the other was relatively easy.

  1. Export contacts from Palm Desktop into vCard format. To preserve groups, export one group at a time, each into its own file. For example, save the Home group as home.vcf.
  2. Comments on Palm contacts become X-Palm-Custom# lines in vCards, where # is 1, 2, 3 etc. GMail ignores these. Convert them to NOTEs, which GMail does understand, by running them through the following script. For example, palm-vcf2gmail-vcf home.vcf > home-gmail.vcf.
  3. Import each file into GMail, creating a new group for each file.
  4. Go to Android Contacts and there they are, in the Google category. Sadly, the groups which I was so careful to create don’t appear on the Droid. Oh well; I can maintain them in GMail and if Android Contacts ever adds that feature I’ll be ready.

The script, palm-vcf2gmail-vcf:

#!/opt/local/bin/ruby
ARGF.each do |line|
  puts line.gsub /^X-Palm-Custom\d/, 'NOTE'
end


Hmmm; I could have done that with ruby -n. Next time.

Calendar

As with contacts, Android Calendar is probably adequate for me and syncs with Google Calendar. Google Calendar imports iCal and and Outlook CSV. Palm Desktop doesn’t export either of those, but it does export vCal, and the standard Mac OS iCal application imports vCal and exports iCal.

  1. Export the calendar from Palm Desktop, saving it as e.g. calendar.vcs.
  2. Import calendar.vcs into iCal, telling iCal that it’s in the vCal format. I imported into the newest version of iCal I had, 4.0.4, running on a different, newer laptop than the one running Palm Desktop, which had iCal 2.0. The two iCals export quite different iCal files, but I don’t know whether using the newer iCal made any difference.
  3. Examine the results in iCal. Fix any problems in the Palm’s Calendar app, resync, re-export from Palm Desktop and re-import into iCal (in a new calendar, to avoid confusion with previous attempts). Repeat until everything that can be fixed on the Palm has been. Here’s what I had to fix:
    • Who knows why, but I had a handful of events which repeated, but for only one day. On the Palm these look like non-repeating events; in iCal they repeat forever. I just found each of them in the Palm and set them to not repeat.
    • I didn’t have many events with notes, because it was usually easier to just put all of the text in the event, but I had a few notes on events from before I settled in to my current usage. I just appended each note that I wanted to keep to the text of its event and deleted the note. Fortunately there weren’t many and none were long. If you need to do something different, you’ll find event notes in your memo export file (see below). No idea how to keep them attached to their events.
  4. Fix any problems in iCal that can’t be fixed on the Palm. I had one such problem: repeating no-time events that began between early November and early May turned into series of two-day events in iCal, each beginning one day too early. It didn’t take too long to fix these manually.
  5. Export the calendar from iCal to a file, e.g. Calendar.ics.
  6. Import the file into Google Calendar. The only trick here is that Google Calendar allows you to import only 5000 events per day. I had just under 5000, so I could do it once, but when I had to fix something and do it again I had to wait a day!

I immediately missed Palm Calendar’s easy navigation. Google Calendar is better with two Labs add-ons: Year View and Jump to Date.

Afterthought: I might also have synced iCal to Google Calendar. Export and import was the first thing I tried and it worked, so I didn’t look further.

Memos

Android has no standard to-do application (curse the slack-jawed target user, consuming and never producing!). I went with Note Everything, which is free, widely used and not too much more ambitious than Memos, which is all I want for now. Note Everything imports a CSV format exported by Palm Desktop for Windows, but Palm Desktop for Mac OS doesn’t export that CSV format, so I needed to convert to it myself.

  1. Export all memos from Palm Desktop to the “tab and return” format. Export only the title and body fields.
  2. Convert tab-and-return to CSV using the following script, e.g. tab-and-return2note-everything all.tab-and-return > all.csv.
  3. Connect the Droid to the Mac with its USB cable and copy all.csv to the Droid.
  4. In Note Everything, go to Menu -> More -> Import -> Import from Palm memos and import the file.
  5. The script puts all memos in the Unfiled group, since that’s where I kept all of my memos in the Palm Memo app. Now that group is useless, so move all of the memos manually from Unfiled to “Main folder” and delete Unfiled.

The script, tab-and-return2note-everything:

#!/opt/local/bin/ruby
# Converts Palm Desktop's "tab and return" export format to the CSV format that
# Note Everything expects when "importing from Palm memos".
tar = ARGF.read
lines = tar.split "\r"
lines.each do |line|
  # Skip notes attached to calendar entries
  next if line =~ /Handheld Note: Date Book/
  line.gsub! "\246", "\n"
  line.gsub! "\t", "\n"
  line.gsub! '"', '""'
  puts "\"Unfiled\", \"#{line}\""
end


Tasks

As with Tasks, Memos has no standard Android replacement. Astrid seems to be the only third-party to-do app which is relatively mature and can import from a file, and then only with the not-free Power Pack add-on. Like other third-party to-do apps, Astrid can sync with Google Tasks and other task managment web applications, but neither Google Tasks nor the other web apps I looked at can import tasks from a file, so that doesn’t help.  The only recourse was to reverse-engineer Astrid’s backup format, which, fortunately, is just simple XML.

  1. Export To Dos from Palm Desktop in Tab & Return format. Include only the Category 1 and To Do columns, in that order. Save as, for example, to-do.tab-and-return.
  2. Convert to Astrid backup format with the following script, e.g. palm2astrid to-do.tab-and-return > user-110314-1600.xml.
  3. Copy the fake backup to the astrid directory on the Droid.
  4. In Astrid, go to Menu -> Backups -> Import Tasks and import the fake backup.

The script, palm2astrid:

#!/opt/local/bin/ruby

def escapeHTML(string)
string.gsub! '&', '&'
string.gsub! '<', '&lt;'
string.gsub! '>', '&gt;'
string.gsub! '"', '&quot;'
end

tar = ARGF.read

puts <<EOS
<?xml version='1.0' encoding='utf-8' ?>
<astrid version="174" format="2">
EOS

created = Time.now.to_i

tar.split("\r").each do |line|
line.gsub! "\255", '\''
category, text = line.split "\t"
escapeHTML category
escapeHTML text
puts <<EOS
<task calendarUri="" completed="0" created="#{created}" deleted="0" details=" |  | &lt;img src='silk_tag_pink'/&gt; #{category}" detailsDate="#{created}" dueDate="0" elapsedSeconds="0" estimatedSeconds="0" flags="0" hideUntil="0" importance="2" modified="#created" notes="" postponeCount="0" recurrence="" notificationFlags="6" lastNotified="0" notifications="0" snoozeTime="0" timerStart="0" title="#{text}">
<metadata created="#{created}" key="tags-tag" value="#{category}" />
</task>
EOS
end

puts <<EOS
</astrid>
EOS



Note that this script will probably not work with versions of Astrid other than 3.7.2, which is what I copied the backup format from.

Later I ran across the Got To Do Android app, which syncs with the ToodleDo web app, which can import from a tab-and-return export of Tasks from Palm Desktop. The job is done and I’m happy with Astrid for now so this will remain the road not taken.

PalmReader documents

Palm Memos only handled memos up to some not very large size, and it wasn’t able to search within a memo, so I had a collection of larger text documents which I’d converted into Palm Reader format and read in Palm Reader. The situation on Android is the same: by experiment, Note Everything can handle documents up to a size of about 341Kb; it truncates larger documents on import. For documents below that size, I just copied the plain-text originals to the Droid and imported them into Note Everything using its file-at-a-time and directory-at-a-time import.

That left a couple of larger documents. I copied the plain-text originals of those to the Droid, too, but I read them with iReader, which handles documents up to at least 3-something Mb.

Ringtone

I last added a ringtone to the Treo in 2006 using phonezoo.com, and it was still there for me. I just told Phonezoo what kind of phone I had now and sent myself “Huxley Beagle Howling”.

Advertisements

Written by dschweisguth

March 15, 2011 at 21:58

Posted in Android, Palm, Ruby

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s