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. DO NOT POST YOUR QUESTIONS HERE.

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: 25
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: 4096
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: 25
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: 4096
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: 4096
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: 25
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: 4096
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

Re: set up direct access to OmniFocus projects

Postby mlondon » Mon Oct 21, 2013 4:16 pm

Hi,

Hazel newbie here...

Sorry, but I need a little help with this.

- Which "Folder" should I place this in in Hazels pref-pane?
- Do I have to do anything to trigger it the first time? What causes this list of alias's to be built so LaunchBar can find them?
- Then do I need to setup a LaunchBar index rule to find them?

Thank yuou !
mlondon
 
Posts: 1
Joined: Mon Oct 21, 2013 4:11 pm

Re: set up direct access to OmniFocus projects

Postby pickerin » Mon Dec 09, 2013 8:50 pm

mlondon wrote:- Which "Folder" should I place this in in Hazels pref-pane?

You want to add the folder:
/Users/YOURUSERNAME/Library/Caches/Metadata/com.omnigroup.OmniFocus
- Do I have to do anything to trigger it the first time? What causes this list of alias's to be built so LaunchBar can find them?

Nope. As soon as you save the rule the first time it should fire and start making and renaming Aliases.
- Then do I need to setup a LaunchBar index rule to find them?

Yes, you'll then want to add the Destination Folder (wherever you put it) as an Index folder for LaunchBar.
Thank yuou !

No problem.

Also, the custom token was a bit tricky for me. Basically, for the last condition:
  • Select "Other", then scroll through all of the attributes available in an OmniFocus Project Metadata file to find "Title"
  • Set it to "matches"
  • Click on the "dot" for a Custom token
  • Name it "project title"
  • Click on "..." next to Anything for the match value
pickerin
 
Posts: 2
Joined: Tue Nov 05, 2013 7:36 am

Re: set up direct access to OmniFocus projects

Postby ecormany » Tue Dec 10, 2013 7:09 pm

mlondon, thanks for explaining the bits that i glossed over.

unfortunately, i decided i had to disable this rule after i updated to Mavericks. if you've ever dealt with aliases much in OS X, you know that sometimes it can be quite stupid about including quicklook information in them and making them unnecessarily large (often bigger than the original file). this rule started filling up a folder with 11MB aliases to 16–20K project files. couldn't figure out how to change that behavior, but if i can i'll definitely turn the rule back on.
ecormany
 
Posts: 25
Joined: Wed Apr 25, 2012 6:15 pm

Re: set up direct access to OmniFocus projects

Postby JBB » Sun Jan 12, 2014 6:47 pm

By any chance has anyone found a way to automatically delete the aliases for projects that have been finished or deleted?


I wondered the same thing myself. I think it would require a rule in the new folder of aliases, that would run from time to time and check for broken aliases, and then delete them. I think an AppleScript could do this as a test condition. Mr. Noodle?
JBB
 
Posts: 16
Joined: Mon Sep 12, 2011 6:09 pm

Re: set up direct access to OmniFocus projects

Postby JBB » Wed Jan 15, 2014 12:07 am

I think this will work on the folder with readable project names:

Code: Select all
if all of the following conditions are met
    Kind is Alias
    Date Last Matched is not Today
    Passes AppleScript [embedded script]
do the following
    Move to Trash


The embedded script is:

Code: Select all
tell application "Finder"
     try
          set orgFile to original item of file theFile
          if orgFile exists then
               return false
          else
               return true
          end if
     on error
          return true
     end try
end tell
JBB
 
Posts: 16
Joined: Mon Sep 12, 2011 6:09 pm

Re: set up direct access to OmniFocus projects

Postby kristalharri » Fri Jan 31, 2014 6:29 am

I have tried "Finder" application..It runs actually really well..But in the middle,it displays an error called "Authentication Required" What does it mean? I just fed up of trying again and again.. :( :( :(
If you are confused about how to take google apps backup ? Visit us...!!!
kristalharri
 
Posts: 1
Joined: Fri Jan 31, 2014 6:25 am

Next

Return to Tips & Tricks/Rule Recipe Exchange

Who is online

Users browsing this forum: Google [Bot] and 2 guests



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.