I recently took the plunge and decided to setup Android CM9 (ICS 4.0) on my HP Touchpad in a dual-boot config using the instructions found here. I have to say, in the weeks since I started using Android on the tablet, I have spent almost no time in WebOS. I don’t miss it at all, which makes me a little sad. However, the plethora of apps now available on my tablet quickly cured me of my unhappiness!
One app that I have been using increasingly is Evernote. Although there was a Mojo-based Evernote client, a native WebOS one never got developed for the Touchpad. Now that I am using Ice Cream Sandwich on my tablet, I was able to install the free HD Evernote Android app on my tablet and start sharing my notes across multiple devices like I always wanted. However, one thing was missing – all my legacy memos and notes that I’ve carried from my old VisorPhone, through the Treo and Centro years, and on to my Palm Pre. Some of those notes are still useful, and some are just archives. Either way, I wanted them in my new favourite note management tool. Here are the steps I went through to bring my memos across the divide from WebOS to Evernote.
Export memos from WebOS using the following steps:
1. Create a file named memo_extract.sh with the following contents:
luna-send -n 1 -f -a com.palm.app.notes palm://com.palm.db/find ‘{“query”:{“from
“:”com.palm.note:1”}}’
exit
2. Ensure novaterm is installed and works on your Linux desktop, then run the script:
$ cat memo_extract.sh|novaterm > memos.json
This will create file memos.json on your computer, containing all the WebOS memos in JSON format.
3. Remove the first line from the memos.json file that looks like the following:
root:# luna-send -n 1 -f -a com.palm.app.notes palm://com.palm.db/find ‘{“query”:{“from”:”com.palm.note:1″}}’
and save the file.
4. Go the the web site
http://www.utilities-online.info/xmltojson/#.UOpJ6tHgOdk
to convert the JSON to XML. Copy and paste the JSON text into the appropriate box, and hit the button to generate the corresponding XML.
5. Next step is to import this XML into a database for some quick manipulation; I use MySQL, but Access or Oracle will probably also work, although the steps will vary.
6. Ensure MySql 5.5 server is installed:
$ sudo apt-get install mysql-server-5.5
7. Then connect to the server, and create a table to import the memo.xml file generated above into the database:
$ mysql test –local-infile
mysql> create table webos_memos (id varchar(100),kind varchar(100), rev varchar(100), sync varchar(100), color varchar (20), createDate int, timeStamp int, modDate int, modTime int, position varchar(100), text varchar(2000), title varchar(2000));
mysql> LOAD XML LOCAL INFILE ‘memo.xml’ into table webos_memos rows identified by ‘<results>’;
mysql> select count(*) from webos_memos;
+———-+
| count(*) |
+———-+
| 105 |
+———-+
1 row in set (0.00 sec)
mysql>
8. Create a sql script file named get_memos.sql with contents:
select text from webos_memos;
9. Run the script from the shell command line:
$ mysql -t test < get_memos.sql| sed ‘s/|/^/g’ >memos.txt
This will put all the memos in a text file memos.txt, separated using the upcaret ^.
10. Create a shell script gen_memfiles.sh and make it executable:
$ touch gen_memfiles.sh
$ chmod a+x gen_memfiles.sh
11. Insert the following contents:
OLDIFS=$IFS
MEMOS=`cat memos.txt`
#field separator is ^
IFS=^
#clear everything
rm files/*
i=1
#loop over all memos, put in their own file
for memo in $MEMOS
do
#remove leading newlines
memo=${memo//$’\n’/}
if [ -z $memo ]
then continue
fi
#put first line to use as the title in Evernote
#remove tabs, they cause problems on import
title=`echo $memo|head -1| sed ‘s/\t/ /g’`
echo $title
echo “Generating memo file $i…”
echo $title > files/$i.txt
echo $memo >> files/$i.txt
i=`expr $i + 1`
done
#restore IFS
IFS=$OLDIFS
12. Make a sub-directory files to hold the notes:
$ mkdir files
13. Run the shell script gen_memfiles.sh:
$ ./gen_memfiles.sh
This will put each memo in a numbered txt file in the files sub-directory.
14. Copy the files sub-directory to a Windows PC with the Evernote client installed.
15. Start up the Evernote client on the Windows PC, and configure the Tools->Import Folder option to import from the files directory you copied over.Hit OK.
16. Your notes should all import, using the first line of the generated memo file as the title. You may have a few extraneous notes with garbage, as well as a few outliers that get rejected, but this method should handled most WebOS memos.
Good luck!