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


Click here to return to the 'Move Memos from a Palm device into the iPhone's Notes app' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Move Memos from a Palm device into the iPhone's Notes app
Authored by: Boing2999 on Feb 05, '11 05:40:43AM
Okay, ancient topic, but it comes up in google search so I may as well add my solution. I recently upgraded to 10.5 (I've got a powerPC Mac, and mainly wanted to upgrade iOS to 4.2...), and finally got the Notes entry in Mail. So I decided to give it a go and move all my Palm notes from Palm Desktop into Mail. Unfortunately, I needed to do it only once, so I didn't really bother making it user friendly. 1) Export your notes in "Tab + Return" format as "notes".
2) run this python script in the same directory:
import mailbox, email, datetime, re

# read in memo data (format tab and return!)
f = open("notes", "rb")
m = f.read()
f.close()

# split data into individual memos and fields
notes = []
for n in m.split("\r"):
	notes.append([x.replace(chr(0xa6), "\n").decode("mac_roman") for x in n.split("\t")])

# map from month names (german) to number
month = {
	u'Januar':1,
	u'Februar':2, 
	u'M\xe4rz':3, 
	u'April':4, 
	u'Mai':5, 
	u'Juni':6, 
	u'Juli':7, 
	u'August':8, 
	u'September':9, 
	u'Oktober':10, 
	u'November':11, 
	u'Dezember':12 
}

# convert memos into an mbox-formatted database
mbox = mailbox.mbox("palm.mbox")
for n in notes:
	if len(n) > 1:
		mail = email.message.Message()
		mail["X-Uniform-Type-Identifier"] = "com.apple.mail-note"
		mail["From"] = "Palm Desktop Import"
		subject = ""
		if n[5] != "":
			subject += "[%s] " % n[5]
		if n[6] != "":
			subject += "[%s] " % n[6]
		subject += n[0]
		mail["Subject"] = subject.encode("utf-8")
		t = None
		d = None
		m = re.match(r"([0-9]+):([0-9]+)", n[2])
		if m:
			t = datetime.time(int(m.group(1)), int(m.group(2)), 0)
		m = re.match(r"([0-9]+)\. (.*) ([0-9]+)", n[3])
		if m:
			d = datetime.date(int(m.group(3)), month[m.group(2)], int(m.group(1)))
		m = re.match(r"([0-9]+)\. (.*) ([0-9]+)", n[4])
		if m:
			d = datetime.date(int(m.group(3)), month[m.group(2)], int(m.group(1)))
		if t != None and d != None:
			mail["Date"] = datetime.datetime.combine(d, t)
		elif d != None:
			mail["Date"] = d
		mail.set_payload((n[0] + "\n" + n[1]).encode("utf-8"), "utf-8")	
		msg = mailbox.mboxMessage(mail)
		mbox.add(msg)

mbox.close()
You'll have to fix the month names to your local language. And you may want to tweak subject format or mail format to your taste.
3) import "palm.mbox" into Mail (mbox format)

[ Reply to This | # ]