PDA

View Full Version : Send Firefox URL to Omnifocus


spnyc
2007-08-13, 06:23 AM
Despite Firefox's dreadful applescript support, I have a posted a couple grab url Firefox scripts on my scripts download page along with installation and integration instructions:

http://www.sandro.org/omnifocus/

Enjoy..

ChuckieMac
2007-08-24, 09:57 PM
I decided I wanted to use a bookmarklet to do the same thing, so I created a simple AppleScript and packaged it as an application bundle and protocol handler.

I can now just click the bookmarklet in my bookmarks toolbar in Firefox, it launches the AppleScript and passes to it both the current URL and page title. The AppleScript then activates OmniFocus and creates a new task in the Inbox, with the title of the web page as the name of the task and the URL as the note.

I explain in more detail on my blog, where you'll also find a link to download the .dmg:

http://mcphate.org/mt/2007/08/copy_url_to_omnifocus.html

Be sure to read the ReadMe that's in the disk image; it explains how to create the bookmarklet. It also explains how to modify the AppleScript. I've packaged it as both read/write, so everyone has full access to the source code.

Suggestions for improvement are welcome...

Charles

apr400@yahoo.co.uk
2007-10-02, 06:27 AM
Useful bookmarklet.

If like me you don't like having the bookmark toolbar open you can turn the bookmarklet into a firefox toolbar button like this:

- Add to the bookmark toolbar as suggested in the instructions
- Open toolbars:customize...
- Drag the Bookmarklet to the main toolbar, position it where you like.
- Close customise.

- With something like Iconographer design an icon for the bookmarklet.
- Save in .ico format.
- Download and install the firefox addon "favicon picker 2"
- Set the icon of the bookmark to your .ico file.
- (favicon picker 2 can be disabled straight away if you like to minimise addons.)
- If you just want an icon and no text, then remove the bookmarklet's name in bookmarks organiser.

Hawkcode
2007-10-11, 02:27 PM
ChuckieMac,

I installed your CopyURLToOmniFocus and when I click the Bookmark, it launches the app and I get a Spinning black and white wheel for a sec, but nothing gets put into the inbox.

Any ideas?

curt.clifton
2007-10-11, 03:15 PM
One of today's builds broke the activate AppleScript command for OF. I suspect that's what's interfering with the script here.

Hawkcode
2007-10-11, 03:32 PM
I'll try it in the next rev.

Thanks

Rich

spnyc
2007-10-12, 04:03 AM
ChuckieMac,

I installed your CopyURLToOmniFocus and when I click the Bookmark, it launches the app and I get a Spinning black and white wheel for a sec, but nothing gets put into the inbox.

Any ideas?

I just tried the script with the most recent builds of both OF & FF and it did work. I have noticed one issue with FF which i noted on my OF Scripts page, but here it is:

NOTE: If you notice that the script was working then just stopped working, chances are that it's actually Firefox that is misbehaving. There is a bug in Firefox where after a period of time other applications (like applescripts, url manager pro, et al) cannot access the url/title of the current window and tab. I haven't figured out if it's related to having too many tabs open, running firefox for too long and memory bloat kicks in, or some odd issue with one of the extensions I have installed (and I have quite a few installed), or what. Unfortunately the only fix I have found to work is to restart Firefox, which if you have Tab Mix Plus installed shouldn't be an issue (check it's session save/restore options).

i know this isn't a "fix" by any means but until i can figure out why exactly things work then simply stop working, it's the only thing i can suggest. Please let me know if it does/doesn't work for you.

One of today's builds broke the activate AppleScript command for OF. I suspect that's what's interfering with the script here.
It did indeed, i have to tweak pretty much every script i have written. Ah the joys of Alpha-ness...

Hawkcode
2007-10-23, 01:05 PM
Any word if there's a new CopyURLToOmniFocus script working?

Thanks

Rich

fudster
2007-11-21, 07:44 PM
One of today's builds broke the activate AppleScript command for OF. I suspect that's what's interfering with the script here.

It seems that the "activate" command is still broken. I was able to get the script working by replacing the "activate" command with a "display dialog" - this brings OF to the front so that the rest of the script can run.

I played for a bit to try other ways to get OF to the front, but with my extremely limited knowledge of AppleScript I didn't get very far. I'll try to dig and learn more when I have more time.

I was hoping to be able to create / obtain a "quick entry tree" object, hoping that "activate" would work on it. (this, to me, would be the ideal behavior anyway - if OF has to be brought to the front for the URL capture anyway, I'd rather that the quick entry window came up so that the entry could be doctored before committing the capture.

curt.clifton
2007-11-22, 03:20 AM
fudster,

You might have a look at my Mail --> OF script for some code. It creates new tasks via the QuickEntry window. You can get the script here (http://www.rose-hulman.edu/~clifton/software.html#OF-Mail).

fudster
2007-12-03, 05:43 PM
fudster,

You might have a look at my Mail --> OF script for some code. It creates new tasks via the QuickEntry window. You can get the script here (http://www.rose-hulman.edu/~clifton/software.html#OF-Mail).

Hey Curt - I didn't see you reply post till now. I did indeed fix the script by taking a queue from the OmniFocus Mail rules script - I don't use "activate" or an alert dialog anymore - skipping that and going straight to "tell default document" seems to do the trick.

I plan to have a look at your Mail->OF script too, next time I play with OmniFocus/Script glue. Thanks Curt!

fudster
2007-12-03, 07:10 PM
Curt, I had a peek at your scripts - really nice work. I borrowed a little and modified the 'tell application "OmniFocus"' part of ChuckieMac's script so that the QuickEntry Window appears where the new task can be edited:


tell application "OmniFocus"
tell quick entry
activate
set newTask to make new inbox task with properties {name:("capture: " & theTitle), note:theAddress}
select {inbox task 1}
end tell
end tell

iNik
2008-06-20, 10:41 AM
Wow. I'd already started down this road before I found this thread. Too bad, too, it could have saved me a lot of work. Anyhoo, I thought I'd add my 25 to the array of scripts here, because I've been spending a lot of time on a very similar utility.

This little applet, like the other ones posted, takes a URL and turns it into an OmniFocus inbox task. However, it has some notable differences, because I wanted it to have a broader scope than just pulling pages from Firefox -- instead, I was shooting for making a REST api for OmniFocus. ( I explain this a little bit more in this post (http://forums.omnigroup.com/showthread.php?p=38458))

Some noticeable differences are that the URLs are crafted like normal URLs (x-omnifocus://newtask?name="foo bar"), and permit more parameters than you'd probably use with a bookmarklet. (context, project)

I included some bookmarklets that I think are kinda nifty because they let you include selected text on the current web page as a note in your task. I find that super duper handy.

Here's the applet: OmniFocus URI Handler (http://inik.net/omnifocus-uri-handler)

Feel free to borrow the javascript in the bookmarklets to enhance your own URL applets or use whatever you want of the applet itself for your own purposes.

iNik
2008-06-20, 11:00 AM
BTW, here's a Firefox trick: View the properties of your bookmark and add a short keyword (mine is "t" for task). When you find a page to clip, command-L to get to the address field, then type your shortcut, then hit return. There ya go, didn't have to touch the mouse.

pendolino
2009-02-12, 12:44 PM
this URI handler works extremely well!