How To: Sync Taskpaper and iPhone Notes over wifi (Formatted version)
IMPORTANT!: These instructions are for the version which formats the iPhone notes (Headings underlined, projects in blocks for clarity, @done tasks line-through, tags in blue, notes in grey). For the plain version, please visit these instructions.
- a Hacked iPhone or hacked iPod Touch with Notes installed
- Installer.app installed on the hacked iPhone
- Mac OS X 10.5+
- Python 2.5+
I love Taskpaper, and I love the iPhone Notes app (yeh weirdo, I know!) and together they make for an excellent and simple GTD solution. This tutorial will guide you through the processes needed to set up semi-automatic syncing bewteen the two - at the end of it you will have two applications (synctoiphone and syncfromiphone) which you can put in your dock, on the desktop, run from quicksilver or launchbar, whatever suits your needs most.
This works out of the box so to speak on Leopard, Tiger users may need to install a newer version of python - see footnote [1]. Usual disclaimers, you do this at your own risk etc as you will be directly writing to your iphone notes databse. It is prudent to make a backup copy should things go wrong.
Step 1: Getting your iPhone set up
Tap installer.app and navigate to the Network group. Assuming you have community sources installed (this is found under the sources group) you should see AFPd - install this on your iPhone.
Test your AFP setup by opening a new finder window, clicking on My Hacked iPhone under the Shared group. PLEASE NOTE the username/password prompt is for your iPhone NOT your mac. You should see something like this:
My Hacked iPhone can be renamed from within AFPd on the iPhone. For ease, I choose to remember my password in the keychain.
Next, open the notes app and create a new note with the first line being “Taskpaper” (omit the quotes, see first above image - you must type it exactly as I have, including the capital T, otherwise the apps will not work properly. If you do want to have something else, you will need to amend the python script at the heart of these apps).
Note down the number of this note as we will need it later, for example if there were 6 notes before you created this, the number will be 7. Please see footnote [2] if you run in to problems, this numbering maybe the root cause.
Step 2: Creating the ‘apps’
Download the following two Automator workflow files in this zip archive. Lets open up the first one, syncfromiphone.workflow.
When you open this up, you will see a run shell script module set to run some python commands. You will need to dive in here and change a couple of things (gasp!!). Firstly, get the note number we talked about in step 1 and place in betweem the double quotes. Look for the following lines of code
# ###### MAKE CHANGES TO Notes_Id HERE, REPLACE 7 #########
n = c.execute(’SELECT data FROM note_bodies WHERE note_id=”7″‘)
################
Next, change the script to tell it where your taskpaper file is. Look for the following lines and change accordingly. Note that you cannot use ~ to represent you as user, you will need to put the actual path in.
# ###### MAKE CHANGES TO YOUR PATH HERE, DO NOT USE ~ #########
o=open(”/Users/shortusername/Documents/ipodsync.taskpaper”,”w”)
#################
When done, choose File -> Save and save as an Application. Call it syncfromiphone or whatever suits you best. Drag into the Dock, into Applications, onto your desktop, into your Finder sidebar, you choose, its entirely up to you.
Now open up synctoiphone.workflow and similar to above, change the following:
# ###### MAKE CHANGES TO YOUR PATH HERE, DO NOT USE ~ #########
o=open(”/Users/shortusername/Documents/ipodsync.taskpaper”,”r”)
# ############
and
# ###### MAKE CHANGES TO Notes_Id HERE, REPLACE 7 #########
c.execute(’UPDATE note_bodies SET data=? WHERE note_id=”7″‘,a)
# ############
Choose File -> Save and save as an Application and call synctoiphone or similar. Place next to your first app.
Step 3: We’re Done!
OK, we should be done know. Whenever you want to sync taskpaper and notes, just open up a finder window and make sure that you are connected via AFP. Also make doubly sure that Root’s Home is also mounted - you may have to physically click on this folder in the finder to mount it.
Recommended: As an alternative, you can add two more modules to the begining of automator workflow (before the python module) which will connect to the AFP iphone automatically (I have not included as it has to be done for the specific iphone). Open up each workflow and drag in Get Specified Servers and add your iPhone. Input the iphone username and password, optionally add to keychain to avoid password prompt.
Now drag in the connect to servers module between the get specified servers and run shell script modules. Repeat for other workflow. Voila! Whenever you run the automator app with these two in, when prompted select Root’s Home in the list. Also, please see footnote [4]
Made changes to taskpaper and want to sync it up to the iPhone? Save any changes then launch the synctoiphone application. Made a few changes to the iphone version? Simple, just launch the syncfromiphone application then open up taskpaper (do not open up taskpaper first as the changes made will not refresh if you already have the taskpaper document open. What I have done is add an additional workflow module after the shell script in syncfromiphone to open up the taskpaper file).
Tab Key: As there is no tab key on the iPhone, insert 4 spaces and it will be converted during the down sync.
Icons: If you want to change your default automator robot icons for the apps you create above, find a copy of (rubbish) alternatives in this file
Thats pretty much it. Enjoy
Footnotes:
[1] You will need python 2.5 or above installed on your mac (if you are running Leopard then you are ok!). To find out which version you are running, open up Terminal and type python -V
[2] Everytime you create a new note, it is given a unique id (note_id in the database) which is incremental. For example if there are 6 notes and you create a seventh, it will be given the id of 7. However, if you create 6 notes, delete note 5 then create the Taskpaper note, it will be given the spare id of 5. If you are having problems, install sqlite database browser, navigate to note_bodies table and find the unique id.
[3] Any python developers out there?? This is my first attempt at python so may be a little rough around the edges.
[4] If you sync with the get specified servers method, it will mount the iphone. Therefore, if you try syncing more than once in any one session, Root’s Home will be greyed out as it has already been mounted, therefore you have to press cancel to ignore this step of the automator workflow. Also, dissallow AFPd broadcasting on your iPhone AFPd preferences so that you do not get duplicate afp sources in finder.
Blogged with Flock




[...] Important! These instructions are for the plain version. If you would like your ihone note formatted (headings underlines, projects in blocks for clarity, tags in blue, notes in grey) please visit these instructions. [...]
This seems like a great way to bridge Taskpaper and the iPhone, if I only I could get it to work!
The downloaded files already had a connection address, so I removed that, mounted up my iPhone no problem and the script runs but no sync takes place happens. I’ve checked file paths and the notes id number and they are ok. Any idea what I might be doing wrong?
I’m running a UK 1.1.2 OTB phone.
Thanks
Hi Barry
Did you check the notes ID with something like SQLite Browser? Also make sure you use your short username.
Thanks for spotting and letting me know about the server already being in the workflow, should have removed that.
This is really odd. I’ve just used SQLite browser to double check the note_id and it is correct. If I run a quick sql command to get the table contents, it has been synced across to the phone, but it doesn’t display on the phone.
After rebooting the phone, the note is now displaying, but it only displays properly if I remove the context from each entry. If I leave them in, the first entry is okay, but it formats the rest of the content of the note as the context for the first message (hope that makes sense!)
Barry
Could you please add a short bulleted list at the very start of this article listing the requirements to make this work? Something like:
- a Hacked iPhone or hacked iPod Touch with Notes installed
- Installer.app installed on the hacked iPhone
- Mac OS X 10.5+
- Python 2.5+
Thanks a bunch. Very useful. I don’t use taskpaper, but using TextMate works a charm as well.
Hi there. You’re amazing.
Please get it touch with Jesse at HogBay and talk to him about making this part of TaskPaper.
)
( And while you’re at it, ask him if I can get TaskPaper for free, please
Could this work with anything but taskpaper?
If only you could get this working with leopard todos and hence ical/mail/Anxiety.app
Hello.
Is there a way to automatically unmount the iphone after a delay of a certain amount of time after the sync is complete? What do I have to add at the end of the automator workflow?
Cheers
Hi Shawin
Hadn’t thought of that, good idea. I’ll look into into, but off the top of my head you could probably add a shell script module at the end to ‘unmount /Volumes/My\ Hacked\ iPhone’ or some such command.
T.
[...] a Mac application was the issue. Fortunately a good friend from scotland found a way to do that - Sync TaskPaper GTD App with iPhone Notes. I am yet to purchase TaskPaper as the cost is way too high for me. Fortunately the TaskPaper data [...]
[...] a Mac application was the issue. Fortunately a good friend from scotland found a way to do that - Sync TaskPaper GTD App with iPhone Notes. I am yet to purchase TaskPaper as the cost is way too high for me. Fortunately the TaskPaper data [...]
Thanks a lot for the script! I just installed it on my 1.1.3 iPhone. In order to get this to work, I had to download the newest version of AFPd (version 0.3), which you can only download from the developers site. Version 0.3 is not available on Installer at the moment.
Once you install AFPd, you need to make some slight modifications to the scripts.
Find this path in both scripts:
/Volumes/Root’s Home/Library/Notes/notes.db
Change the path to this for 1.1.3 iPhones:
/Volumes/Mobile’s Home Dir/Library/Notes/notes.db
That’s it! You’re all set to use this great script on 1.1.3 iPhones
[...] Zoeken doet wonderen [...]
I am on iPhone 1.2 and OSX 10.4. Had to install the latest python 2.5, which did not update the soft links in /usr/bin, so everytime the script started it was using the old preinstalled python 2.3 version. After changing that, the next roadblock was that the “Root’s Home” folder is actually called “Root’s Home Dir”, so I updated that. Yet, everytime I tried I got an error. I opened a terminal and executed the python commands by hand, and found out I get an sqlite database is locked exception. Not sure why this is the case, but so far I could not get rid of it. Restarts of iPhone have not changed the situation. I have no more time to look into this, if anybody finds the solution be sure to post it here. Some hints: it could be that the sqlite DB on the iPhone is in an old format (2.8 or such vs 3.x). Apparently upgrading the DB has helped Trac to overcome the issue. Other hints: search for “thread safe” - maybe some of the clients involved are not.
what do you mean with “hacked” iPod Touch with notes installed? does this mean a jailbreaked iPod Touch? what if i already have bought the January software update?
Yes, a jailbroken iPhone/Touch. Mind you, after todays sdk anouncement I fully expect the above to die a death shortly…….
T.
Is there a solution for IPhone w/2.0 FW?
Afraid not Dave. Hopefully taskpaper for iPhone will be developed…..