set up direct access to OmniFocus projects

From your noodle to other noodles. Talk about ways to get the most from Hazel. Even exchange recipes for the cool rules you've thought up.

Moderators: Mr_Noodle, Moderators

set up direct access to OmniFocus projects

Postby ecormany » Mon Aug 06, 2012 9:48 pm

i'm a new OmniFocus user. i really like it, and i hoped that i could directly access projects via my launcher app of choice, LaunchBar, but this isn't the case. curiously, you can do that with Spotlight. the reason is that OF keeps files that link to projects in a cache folder (~Library/Caches/Metadata/com.omnigroup.OmniFocus), but their filenames are non-descriptive hashes. the reason they show up nicely in Spotlight is because their Title attribute is set to the name of the project. Hazel to the rescue.

Code: Select all
if all of the following conditions are met for the file or folder being matched
    Kind is OmniFocus Project Metadata
    Date Added is after Date Last Matched
    Title matches [• project title]
do the following
    Make alias in folder OmniFocus Projects
    Rename with pattern [• project title]

the rule creates aliases to the project files in a separate folder and renames them with their Title attribute. add that folder to the LaunchBar index and you now have direct access to projects by name.

the only shortcoming right now is that it doesn't work for projects with a / character in the title, due to limitations on Hazel's rename functionality. if anyone has a workaround for that, i'd love to add it to the rule!
ecormany
 
Posts: 21
Joined: Wed Apr 25, 2012 6:15 pm

Re: set up direct access to OmniFocus projects

Postby Mr_Noodle » Tue Aug 07, 2012 3:23 pm

Hazel shouldn't have any problem renaming files with "/" in them (just tested it). I suggest you email support with specifics if it isn't working for you.

Keep in mind, though, that in Finder, "/" actually is a ":" when viewed at a lower level (like in Terminal). One way to look at it is in Finder-land, ":" is used to separate folders in a path whereas in Terminal-land, it's "/".
Mr_Noodle
Site Admin
 
Posts: 2904
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: set up direct access to OmniFocus projects

Postby ecormany » Fri Aug 17, 2012 10:27 am

just tested this. it looks like / is not getting escaped or converted to : properly. i even tried creating an OF project with a : in the title, and that didn't cause an error, and its alias showed up in the Finder displaying a /

here's the log for an error thrown by a project named "test / project 2":

Code: Select all
2012-08-17 10:18:53.885 hazelworker[12362] adNSHgTX6zy.ofocus-project-metadata: Rule create named aliases in Docs subfolder matched.
2012-08-17 10:18:53.913 hazelworker[12362] [File Event] Alias created: Created alias for file /Users/ed/Library/Caches/Metadata/com.omnigroup.OmniFocus/adNSHgTX6zy.ofocus-project-metadata in folder /Users/ed/Documents/OmniFocus Projects.
2012-08-17 10:18:54.035 hazelworker[12362] Error creating FSRef for path /Users/ed/Documents/OmniFocus Projects/test : -43 - File not found
2012-08-17 10:18:54.035 hazelworker[12362] Move path failed. Could not get FSRef for destination path /Users/ed/Documents/OmniFocus Projects/test .
2012-08-17 10:18:54.036 hazelworker[12362] [Error] File rename failed: Could not rename /Users/ed/Documents/OmniFocus Projects/adNSHgTX6zy-1.ofocus-project-metadata to test / project 2.

also, i don't think this happened when i was originally testing this rule, but as written above, projects with / in the title will actually trigger an infinite loop. i'm guessing it's because when Hazel throws an error it doesn't mark the file as Matched, so it keeps trying (and failing) over and over again?
ecormany
 
Posts: 21
Joined: Wed Apr 25, 2012 6:15 pm

Re: set up direct access to OmniFocus projects

Postby Mr_Noodle » Fri Aug 17, 2012 12:27 pm

Actually, there might be an issue with the alias and rename actions. It should work for copy and move though. I'm looking into it.
Mr_Noodle
Site Admin
 
Posts: 2904
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: set up direct access to OmniFocus projects

Postby Mr_Noodle » Fri Aug 17, 2012 1:58 pm

Ok, I think the problem here is that the / is being introduced via a custom token so it is not getting escaped. For comparison purposes, if you just do a rename and type in a / directly into the pattern, it will work correctly. I'll look into fixing it for the next patch.
Mr_Noodle
Site Admin
 
Posts: 2904
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: set up direct access to OmniFocus projects

Postby ecormany » Mon Aug 20, 2012 4:22 pm

excellent, thanks! i had to pass it as a token because the new name depends on an extended attribute of the original file. (my first attempt at writing the rule just tried to do rename with Title and it tried to pull a Title attribute from the alias, which obviously had none!)
ecormany
 
Posts: 21
Joined: Wed Apr 25, 2012 6:15 pm

Re: set up direct access to OmniFocus projects

Postby masterninja01 » Wed Feb 27, 2013 6:36 pm

Wow, this is one piece that I've been looking for to enhance quicksilver and OF.

But, I still don't get you entered for the token "project title" or how you entered it.
masterninja01
 
Posts: 1
Joined: Wed Feb 27, 2013 6:30 pm

Re: set up direct access to OmniFocus projects

Postby Mr_Noodle » Fri Mar 01, 2013 5:20 pm

It's a custom token. I'm guessing it's just set to be (...) so it captures the full title field.
Mr_Noodle
Site Admin
 
Posts: 2904
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: set up direct access to OmniFocus projects

Postby chrisWhite » Sat Mar 23, 2013 11:02 pm

I'm loving this ecormany, thanks for posting it!

By any chance has anyone found a way to automatically delete the aliases for projects that have been finished or deleted?
chrisWhite
 
Posts: 2
Joined: Tue Sep 27, 2011 7:11 pm


Return to Tips & Tricks/Rule Recipe Exchange

Who is online

Users browsing this forum: No registered users and 1 guest



Copyright © 2006-2012 Noodlesoft, LLC, All Rights Reserved. Mac and the Mac logo are trademarks of Apple Computer, Inc., registered in the U.S. and other countries.