CapnAverage

Create new task in OmniFocus inbox

42 posts in this topic

Hey everyone!
 
Just dipping my toe into the proverbial waters of Alfred 2 workflows, and managed to come up with this workflow.
 New%20OF%20Task.png
It creates a new named task in your OmniFocus inbox – it checks if OmniFocus is open and, if it's not, opens it so you don't have to.
 
It's not particularly complicated or elegant, but I hope it's useful to a couple of you out there!

 

DOWNLOAD: New OmniFocus Inbox Task Workflow

Share this post


Link to post

Love this script! I have one power user suggestion. If you use the following Applescript, you can do more than just add items to your inbox:

 

on alfred_script(q)
tell application "OmniFocus"
	tell default document
		parse tasks with transport text q
	end tell
end tell
end alfred_script

 

This will allow you to add items using the following syntax:

 

Action! @Context ::Project #Start #Due $Duration //Note

drking likes this

Share this post


Link to post

This is great! I was looking for an OmniFocus workflow this morning. I found another one but that always opened the OmniFocus Quick Entry window after I executed the alfred search. This is much smoother. Also, I added the lines Ryan M is talking about and changed the Subtext of the Keyword Search to "Action! @Context ::Project #Start #Due $Duration //Note". That way, I always see what I have to type if I want to further define its context or project.

 

Grab the updated Workflow here.

drking and telonaes like this

Share this post


Link to post

Thanks for this. Hugely helpful.
 
A few clarifications/changes. 
 
The "!" syntax is actually used for Flagging an Action.
So if you just enter text as in "todo myaction" it will NOT be flagged
But if you enter "todo myaction!" it will be flagged.
 
Also, using one instance of # will create a DUE date, while two instances will create a START DATE and then a DUE Date
So "myaction #today" creates a due date of today
But "myaction #today #tomorrow" creates a start date of today and a due date of tomorrow.
 
For clarity, I changed my subtext to:
Flag! @Context ::Project #Due (#Start #Due) $Duration //Note
 
Can someone point me to documentation which shows the complete lists of available syntaxs for OF? I searched on the Omni website, but could not find.

Share this post


Link to post

Thanks for this. Hugely helpful.

 

A few clarifications/changes. 

 

The "!" syntax is actually used for Flagging an Action.

So if you just enter text as in "todo myaction" it will NOT be flagged

But if you enter "todo myaction!" it will be flagged.

 

Also, using one instance of # will create a DUE date, while two instances will create a START DATE and then a DUE Date

So "myaction #today" creates a due date of today

But "myaction #today #tomorrow" creates a start date of today and a due date of tomorrow.

 

For clarity, I changed my subtext to:

Flag! @Context ::Project #Due (#Start #Due) $Duration //Note

 

Can someone point me to documentation which shows the complete lists of available syntaxs for OF? I searched on the Omni website, but could not find.

 

Dunno if I'm doing something wrong, but "todo test!! only creates an unflagged task "test!" at my side, same with "todo test #today #tommorrow", this just creates the task test #today #tommorrow. 

 

I'm using the downloadable script from above and have a supporter licences. Dunno if i have to change something on my settings? Thanks for help :)

 

cheers

Share this post


Link to post

I've made an addition to the script, to launch Omnifocus first, just in case it's not running; I was getting a hang on OF if I used my workflow without doing that:

 

on alfred_script(q)
	tell application "OmniFocus"
		launch
	end tell
	
	tell application "OmniFocus"
		tell default document
			parse tasks with transport text q
		end tell
	end tell
end alfred_script

Share this post


Link to post

Love this script! I have one power user suggestion. If you use the following Applescript, you can do more than just add items to your inbox:

 

on alfred_script(q)
tell application "OmniFocus"
	tell default document
		parse tasks with transport text q
	end tell
end tell
end alfred_script

 

This will allow you to add items using the following syntax:

 

Action! @Context ::Project #Start #Due $Duration //Note

where do you put this in the script to get it to work?

Share this post


Link to post

That's the entire script... Are you asking where in the workflow do you go to replace the original scrip with that one? That would be in the "Run NSApplescript" object of the workflow. Just double-click it, and the script window will appear.

Share this post


Link to post

Beautiful! Adding the natural language parsing makes this so much smoother than Quick Entry (and looks better!). (Hoping Omnigroup keeps this Applescript exposed in 2.0...) 

 

I added a Hotkey Trigger ("box") to the workflow so that I could access it via keyboard shortcut without even having to invoke Alfred. That also allows us to set the Argument field to "Selection in OS X". This pulls in any text you have selected before invoking the hotkey!

 

Here's the workflow with that modification: New Omnifocus Inbox Task

(Alfred imports Hotkey Triggers, but strips out the hotkey assignments, so you'll need to double click the hotkey step/box and press your desired hotkey. I used ⇧⌃A which works well for the scheme _mk_ recommends for his OF Task Actions workflow.)

 

Thanks everyone for your contributions to this workflow!

 

UPDATE 2013-06-21: fixed broken download link

Edited by khit

Share this post


Link to post

@mitchellm, thanks for letting me know about the dead link. not sure what went wrong but I reuploaded and have updated in my original post.

Share this post


Link to post

Hiya,

 

I am a huge fan of Alfred and Omnifocus.

 

I recently came across a natural language processing Alfred workflow for creating new tasks.

 

It's amazing.

 

Check it out:

 

http://www.dirtdon.com/?p=963

 

The creator is hoping someone will fork it in GitHub and pick it up from there. I've installed it and it's great but it could definitely use a community like the folks here to work on it.

 

I'm not a coder but I think it's only 500 lines of code and the guy who wrote it is fairly well known. I don't know him but I know his name from posts on Mashable and Macstories. 

 

It's not a simple Alfred workflow to install but if you follow the steps it's easy enough to do it. It could use packaging.

 

I'm happy to help anyone who needs I thought I would share this with the folks here.

 

Enjoy. :)

Share this post


Link to post

Has anyone tried using this with the Omnifocus 2 beta? I love the simplicity of this workflow.

 

 

This is what I get when I try to run it.

[ERROR: alfred.workflow.action.applescript] {

    NSAppleScriptErrorBriefMessage = "Expected end of line but found plural class name.";

    NSAppleScriptErrorMessage = "Expected end of line but found plural class name.";

    NSAppleScriptErrorNumber = "-2741";

    NSAppleScriptErrorRange = "NSRange: {278, 5}";

}

 

 

It opens OF when it's not open but it doesn't add the task.

Edited by Mafamaticks
metaedge likes this

Share this post


Link to post

Has anyone tried using this with the Omnifocus 2 beta? I love the simplicity of this workflow.

 

 

This is what I get when I try to run it.

[ERROR: alfred.workflow.action.applescript] {

    NSAppleScriptErrorBriefMessage = "Expected end of line but found plural class name.";

    NSAppleScriptErrorMessage = "Expected end of line but found plural class name.";

    NSAppleScriptErrorNumber = "-2741";

    NSAppleScriptErrorRange = "NSRange: {278, 5}";

}

 

 

It opens OF when it's not open but it doesn't add the task.

Same issue as well...trying to troubleshoot but haven't had much success.

 

UPDATE: 

 

Looks like the "parse tasks with transport text" script is not working with latest beta drop from Omnifocus.

 

I replaced  "parse tasks with transport text q" with "make new inbox task with properties {name:q}" which creates a simple inbox tasks for now (until they fix the issue)

 

Here is the Applscript, just copy/paste into the script editor.

on alfred_script(q)
	
	set theName to (q)
	set isRunning to false
	
	tell application "System Events"
		if exists process "OmniFocus" then
			set isRunning to true
		end if
	end tell
	
	if isRunning is true then
		tell application "OmniFocus"
			tell default document
				make new inbox task with properties {name:q}
			end tell
		end tell
	else
		tell application "OmniFocus" to activate
		
		tell application "OmniFocus"
			tell default document
				make new inbox task with properties {name:q}
			end tell
		end tell
	end if
	
end alfred_script
Edited by metaedge
Mafamaticks likes this

Share this post


Link to post

I got it working... the syntax of the parse command changed a bit with omnifocus 2:

on alfred_script(q)
	
	set theName to (q)
	set isRunning to false
	
	tell application "System Events"
		if exists process "OmniFocus" then
			set isRunning to true
		end if
	end tell
	
	if isRunning is true then
		tell application "OmniFocus"
			tell default document
				parse tasks into  with transport text q
			end tell
		end tell
	else
		tell application "OmniFocus" to activate
		
		tell application "OmniFocus"
				parse tasks into default document with transport text q
		end tell
	end if
	
end alfred_script

both ways of calling "parse" are shown in the script - just paste it to the script editor. Should work now!

binaryanomaly likes this

Share this post


Link to post

I got it working... the syntax of the parse command changed a bit with omnifocus 2:

both ways of calling "parse" are shown in the script - just paste it to the script editor. Should work now!

 

Yep this works, great, thx :)

Share this post


Link to post

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