Jump to content

OmniFocus Task Actions [Updated to 3.1]


Recommended Posts

  • 1 month later...

Hi,

 

Great tool! Are there any plans to make this work for OmniFocus 2?

 

+1

 

This is a very valuable workflow that I used a lot with OmniFocus 1, thank you! Unfortunately, it does not seem to work for OmniFocus 2. Does it require a huge effort to update due to internal changes in new OmniFocus or is it feasible? I would like to contribute but I'm afraid I lack some coding skills for this task...

Link to comment

Hi,

 

Great tool! Are there any plans to make this work for OmniFocus 2?

 

Don't think the author has updated this recently. But I have this working with OmniFocus 2 (on Yosemite beta 3).

 

The issue is that the OmniFocus cache has moved in OF2. So, here's what you can do to patch things up ...

 

NOTE: Assuming you have downloaded the latest (from December 27 2013) version of the workflow and installed it.

 

1) Open Alfred options, and find the OmniFocus workflow. 

2) Double Click the central .of script action

3) At the bottom right of the action's pane, there is a button titled "Open workflow folder". Click that.

4) Edit the file ofHandler.sh

5) Near the top of the file, there is a getOFCacheDir() shell function. You need to edit the path in that function as follows ...

 

If your OF2 app came from Omni's web site, use this ...

local OFCD="${HOME}/Library/Containers/com.omnigroup.OmniFocus2/Data/Library/Caches/com.omnigroup.OmniFocus2"

If your OF2 app came from the Mac App Store, use this ...

local OFCD="${HOME}/Library/Containers/com.omnigroup.OmniFocus2.MacAppStore/Data/Library/Caches/com.omnigroup.OmniFocus2.MacAppStore"

Save the edited file. Restart Alfred.app. And you should be in business.

 

 

NOTE: I did this with the Mac app store version. Haven't tested the direct from Omni version. I guessed that path using info from the OmniFocus forums. If it doesn't work, suggest you browse your filesystem in that area starting with ~/Library/Containers and you should find it.

 

-Cheers

Link to comment

Don't think the author has updated this recently. But I have this working with OmniFocus 2 (on Yosemite beta 3).

 

The issue is that the OmniFocus cache has moved in OF2. So, here's what you can do to patch things up ...

 

NOTE: Assuming you have downloaded the latest (from December 27 2013) version of the workflow and installed it.

 

1) Open Alfred options, and find the OmniFocus workflow. 

2) Double Click the central .of script action

3) At the bottom right of the action's pane, there is a button titled "Open workflow folder". Click that.

4) Edit the file ofHandler.sh

5) Near the top of the file, there is a getOFCacheDir() shell function. You need to edit the path in that function as follows ...

 

If your OF2 app came from Omni's web site, use this ...

local OFCD="${HOME}/Library/Containers/com.omnigroup.OmniFocus2/Data/Library/Caches/com.omnigroup.OmniFocus2"

If your OF2 app came from the Mac App Store, use this ...

local OFCD="${HOME}/Library/Containers/com.omnigroup.OmniFocus2.MacAppStore/Data/Library/Caches/com.omnigroup.OmniFocus2.MacAppStore"

Save the edited file. Restart Alfred.app. And you should be in business.

 

 

NOTE: I did this with the Mac app store version. Haven't tested the direct from Omni version. I guessed that path using info from the OmniFocus forums. If it doesn't work, suggest you browse your filesystem in that area starting with ~/Library/Containers and you should find it.

 

-Cheers

 

Many thanks your tip got this working for me as well! I have the web site version of OF2 and your guess about the path was correct. Most of the functions work in OF2, but it seems that some functions where the workflow interacts directly with OF2 does not work as intended. Anyway, the workflow is now very useful for OF2 as well.

Link to comment
  • 1 month later...
  • 3 weeks later...
  • 2 weeks later...

Hi,

Just stumbled upon your workflow and it looks great! However, whenever I try to use the "Open in OF" option, Alfred keeps returning to me the error "Omnifocus got an error: can't set class <<FCvm>>  of document window id #### of document..." Can anyone tell me whats up? I primarily want to use this workflow to open up items in Omnifocus.

 

Thanks!

Link to comment
  • 5 months later...

Hey folks,

 

the workflow as in 3.1 and with the change suggested by cands is still working for finding and manipulating tasks. BUT Omnifocus will not open to show a task / project / context etc. Looks like there is a small bug in the script. Anybody with enough experience here to update the script?

 

Edit 2: I´ll copy the official OF documentation for how to open a specific thing in Omnifocus. That should be the key..

tell application "OmniFocus"
    tell default document
        make new document window with properties {perspective name:"Review"}
        activate "OmniFocus"
    end tell
end tell 

Edit: An idea: The bug might be the file focus.scpt within in the actions folder of the workflow (you get there by using the steps cands pointed out):


on run argv
	try
		set theMode to (item 1 of argv)
		set theObjName to (item 2 of argv)
		my focusInOF(theMode, theObjName)
	on error errmsg
		return errmsg
	end try
end run

on focusInOF(theMode, theObjName)
	tell application "OmniFocus"
		tell default document
			if theMode is "c" then
				set theList to flattened contexts where name = theObjName
			else if theMode is "p" then
				set theList to flattened projects where name = theObjName
			else if theMode is "f" then
				set theList to flattened folders where name = theObjName
			end if
			set oWin to make new document window
			tell oWin
				activate
				if theMode is "c" then
					set («class FCvm») of oWin to "context"
					tell sidebar
						set (selected smart group identifier) to "all-contexts"
					end tell
				else
					set («class FCvm») of oWin to "project"
					tell sidebar
						set selected smart group identifier to "all-projects"
					end tell
				end if
				if (count of theList) = 0 then return
				set theObj to item 1 of theList
				if theObj is missing value then return
				if theMode is "p" or theMode is "f" then
					set focus to {theObj}
				end if
				tell sidebar
					«event OTREisal» {theObj}
				end tell
			end tell
		end tell
	end tell
end focusInOF

I tried to locate the author - looks like he´s not around anymore. His blog also is down.

 

Hope we´ll get that running,

  David

Edited by nebaon
Link to comment
  • 1 month later...

I will look into this, but can't promise a quick fix. I think I know what needs to get changed, and I don't know yet what will happen to the rest of the workflow if I change it. It'll take some time (think weeks rather than hours).

I might have to rewrite entire scripts because of the omnifocus2 changes and before that I need to figure out what function calls what script where etc.

 

You can get 'find perspective' to work by changing $WORKFLOWDIR/bin/offv.scpt:

set pList to every perspective's name

should say:

set pList to perspective names
Looking forward to fixing this, after the holiday weekend ;)
 
Pax,
 
 
~ Tanja
Edited by tannie
Link to comment
  • 2 months later...

Has anyone had any luck updating this workflow to get the in Alfred functions working?

 

I was able to get some features working thanks to saggymac, but wasn't able to make the other suggested changes (if it can't open in textwrangler or a text app then I'm lost). 

Link to comment
  • 1 month later...

Has anyone had any luck updating this workflow to get the in Alfred functions working?

With saggymac's help suggestion I was able to search for tasks, but most other features don't work.

 

What files (or which expressions) need to be updated in order to have a working workflow again?

Link to comment
  • 1 year later...
  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...