The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus Extras (http://forums.omnigroup.com/forumdisplay.php?f=44)
-   -   OF iPhone HTML Export Script (http://forums.omnigroup.com/showthread.php?t=5152)

wkoffel 2007-10-11 08:19 PM

OF iPhone HTML Export Script
 
Hey folks. I've been using a custom script for a few weeks now that exports my OF tasks to a simple HTML file that's iPhone-friendly. Basically, I trigger it via a hotkey on my laptop, it exports the HTML file, and then transfers it up to my public webserver, where I can access it from anywhere via Safari on the iPhone. It's not a full interface, just a read-only view, which is totally sufficient for things like checking my errands list on my way home from work, etc.

I figured with the recent demise of the official OF iphone support, it made sense to share my early work on this. Of course, this was way more useful to me anyway, since my laptop is not an always-on webserver, nor do I want to punch holes in my home firewall.

So a skeleton of my script can be found at:

[url]http://fountainsoft.com/mac/of_iphone_export_sample.rb[/url]

I hadn't actually looked at the OF iPhone rails app until after I wrote this, but it turns out they are using a similar technique, namely grabbing the OF data using AppleScript hooks from ruby. I then use another ruby library to help generate markup that's compatible with the IUI examples from [url]http://www.joehewitt.com/iui/[/url]

This script is not really a production-ready package. But if you'd like to try to run it, you'll run a couple one-time setup steps:

- install rubygems. If you have something like macports, try "port install rb-rubygems" in your terminal (you should already have ruby on your mac by default)
- "sudo gem install markaby"
- "sudo gem install rb-appscript"

Then to run the script, simply save it somewhere (we'll assume Desktop for now), and type:
- "~/Desktop/of_iphone_export_sample.rb"

And it will dump an HTML file to your desktop that you can put where you please.

My actual script varies in a few ways:
- Instead of dumping the results to a file on the desktop, I create a temp file and then have some more lines of ruby that upload it using SCP and ssh-agent managed keys to my webserver automatically.
- I changed the paths for iui.js and iui.css to reference a location on my target machine, so I don't hammer Hewitt's unofficially hosted IUI files.
- I make some calls out to the shell to show Growl notifications for the start and finish of the export, so I have some visual cue that it's working.
- I use Quicksilver to trigger an applescript that calls this ruby script using a hotkey, so I get one-keystroke access to the export whenever I've been updating my GTD.

Hope this is of at least a passing interest to some iPhone users out there. If there's a lot of interest, I would consider updating it somewhat, to make it more user-friendly, create a helpful installer, something like that. Alternatively, if the OmniGroup wants to run with an idea like this instead of a dedicated server, go for it!! You guys have the resources I don't to make a solution like this work better. One obvious solution would be to publish such an export to a .Mac account for easy viewing on-the-go.

-Will

wkoffel 2007-10-12 06:25 AM

Note, when you run the script, you either need to make it executable, or alternatively, just run

"ruby ~/Desktop/of_iphone_export_sample.rb"

Sorry for the confusion.

haraldmartin 2007-10-15 02:49 AM

Great!
With this script as a base, I changed/added some functionality to make if work offline (without EDGE/Wifi on iPhone)

1. Generate a html page with from OF (your script)
2. Convert the html output to a DATA URI using the [URL="http://http://www.insanelygreattees.com/FilemarkMaker/FilemarkMakerSource.zip"]Perl version[/URL] of [URL="http://www.insanelygreattees.com/news/?p=51"]FileMarkMaker[/URL]
3. Convert Safari's Bookmark.plist to to plain text/xml
4. Replace the current Todo-list bookmark with the new bookmark
5. Save Bookmarks.plist file and convert it back to binary.

Then your tasks should be syncable only by running one script (which could be a toolbar button in OF or set as a QuickSilver trigger or a run as a Cron/Launchd job etc)

I'll test it some more and then post it here. Right now it would only work if you have one data-uri in your bookmarks but that shouldn't be too hard to fix.

RuleRulez 2007-10-30 12:54 AM

I've tried to install Rubgems on Leopard. No success.

Any hints?

haraldmartin 2007-10-30 03:48 AM

@RuleRulez: Ruby and Rubygems are already installed by default in Leopard. try "gem list" in Terminal and you will see. Install new gems like you did before, sudo gem install mygem

granin 2007-11-03 02:58 AM

this script seems to be amazing! but i can't install it, on leopard i'm stuck with installing : "sudo gem install rb-appscript" ,
I get this:
pc20:~ misha$ sudo gem install rb-appscript
Building native extensions. This could take a while...
ERROR: While executing gem ... (Gem::Installer::ExtensionBuildError)
ERROR: Failed to build gem native extension.

ruby extconf.rb install rb-appscript
can't find header files for ruby.

curt.clifton 2007-11-03 06:26 AM

I'm not running Leopard yet, but I wonder if you need to install the Developer Tools for the native extensions build to work. Have you installed the Developer Tools for Leopard?

haraldmartin 2007-11-09 08:22 AM

OmniFocus → iPhone script for offline viewing
 
2 Attachment(s)
Hi

here is the script I've been using for a week or two to export my OF tasks into a Safari (data)bookmark to make my tasks available even when I'm offline.

The html export script is based on the script in the beginning of this thread but I had to simplify the html a bit (and remove almost all javascript) since Safari seems to have problems with it when used as a bookmark.

I'm running this script as a Launch Agent every second hour, configured using [URL="http://macupdate.com/info.php/id/19879/lingon"]Lingon[/URL] so the bookmark/data is up to date the next time I'm syncing my iPhone.

Please backup you bookmarks and other data before running it. I'm not responsible for any data loss, so please be careful.

Installation:
[LIST=1][*]Unzip the files wherever you like[*]Create a new bookmark in Safari with address "data:text/html". Choose a name you like (mine is "ToDo")[*] Make sure you have Apple's Developer Tools installed (can be found at [URL="http://developer.apple.com"]developer.apple.com[/URL] or on your OS X installation disk[*] If you're not on Leopard, install [URL="http://rubygems.org"]Rubygems[/URL][*] Install the markaby gem: "sudo gem install markaby" from the Terminal[*] Install the appscript gem: "sudo gem install rb-appscript" from the Terminal[*]Run the .app script and see if your tasks get exported[/LIST]
Make sure you have set iTunes to sync Safari's bookmarks.
The script is kind of a hack so you might need to fix it (like change the path to growlnotify) but it works for me like this.

Note: It's the .app or the ruby (.rb) script you should use, the other files (css, js etc) are just helpers.

[URL="http://burnfield.com/martin/wordpress/wp-content/uploads/OFfline.zip"]Get it here[/URL]

Tinchohs 2007-11-09 04:32 PM

I got the following error...
 
1 Attachment(s)
[QUOTE=haraldmartin;24238]Hi

here is the script I've been using for a week or two to export my OF tasks into a Safari (data)bookmark to make my tasks available even when I'm offline.

The html export script is based on the script in the beginning of this thread but I had to simplify the html a bit (and remove almost all javascript) since Safari seems to have problems with it when used as a bookmark.

I'm running this script as a Launch Agent every second hour, configured using [URL="http://macupdate.com/info.php/id/19879/lingon"]Lingon[/URL] so the bookmark/data is up to date the next time I'm syncing my iPhone.

Please backup you bookmarks and other data before running it. I'm responsible for any data loss, so please be careful.

Installation:
[LIST=1][*]Unzip the files wherever you like[*]Create a new bookmark in Safari with address "data:text/html". Choose a name you like (mine is "ToDo")[*]Run the .app script and see if your tasks get exported[/LIST]
Make sure you have set iTunes to sync Safari's bookmarks.
The script is kind of a hack so you might need to fix it (like change the path to growlnotify) but it works for me like this.

Note: It's the .app or the ruby (.rb) script you should use, the other files (css, js etc) are just helpers.

[URL="http://burnfield.com/martin/wordpress/wp-content/uploads/OFfline.zip"]Get it here[/URL][/QUOTE]

Thanks SO much for posting this. I got an error that I am attaching. I am running Leopard, so I am unsure if it's related to this. Any suggestions? Thanks SO much again... Martin.

haraldmartin 2007-11-10 01:20 AM

Sorry, forgot to add this to the installation instruktions. Make sure you have Apple's Developer Tools installed (they're free on your OS X installation disk or on developer.apple.com). Then you'll need to install two gems to make it work. Just do this in the Terminal (Applications → Utilities → Terminal):

If you're not on Leopard, you'll need to make sure [URL="http://rubygems.org"]Rubygems[/URL] is installed. Then install the gems needed:

sudo gem install markaby
sudo gem install rb-appscript

Ciao
Martin


All times are GMT -8. The time now is 05:58 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.