Jump to content

Create new task in OmniFocus inbox


Recommended Posts

I still can't get this to work. It opens Omnifocus 2 OK if it is not running but does not create the new action.

A pain as I always use Alfred to place new tasks into OF.

 

Fixed in now. My error, script works fine. Thanks.   :unsure:

Edited by timlawson
Link to comment
  • 3 weeks later...

sorry, but I'm a complete beginner to using these workflows, I have tried copying and pasting in the scripts in this thread into Dan's original workflow but nothing is working.  I would really apprciate it someone could explain step by step to to get this working for omnifocus 2?  

 

Thanks

Link to comment
  • 2 weeks later...

This is great, most convenient! It works great for me in OF2 with the code update zagdul provided. (Only thing not working for me is that I when I activate the workflow using a hotkey, the next time I open Alfred the previous calls to the workflow are not available by pressing the Up Arrow, which may be useful if you add several new tasks with similar settings. However, I guess that this is the expected behavior for Alfred and is not related to the workflow. Opening Alfred and typing todo it works of course.)

 

Thanks!

Edited by cands
Link to comment
  • 2 weeks later...

I tweaked the original script similar to zagdul above. Here it is: 

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 false then
		tell application "OmniFocus" to activate
	end if

	tell application "OmniFocus"
		parse tasks into default document with transport text q
	end tell
	
end alfred_script

Link to comment
  • 2 weeks later...
  • 2 weeks later...

Tim, i still can't get this script to work for me.  I have cut and paste the recommended script for this workflow and it does not populate Omnifocus 2. 

 

For those having issues, download this version of the workflow: New OmniFocus Inbox Task.alfredworkflow

 

It is the same version provided by khit but with the modified Applescript provided above.

 

If you still encounter issues, make sure to delete the prior version of the workflow before installing this version.

Link to comment
  • 2 months later...

I installed the workflow posted by jarhead above. Using OF 2.04 it parses my text correctly except that the project description the two colons attached upfront. So @myContext::MyProject//MyNote  results in a project that is named ::MyProject   Any idea how I can lose the colons?

 

BTW, using just one colon parses OK also but still has that colon attached to the Project/Task Name.

Link to comment
  • 1 month later...
  • 8 months later...

Added some code to the AppleScript and a ‘Post Notification’ step to Dan's great workflow so it now triggers a notification in the Notification Center with the task name that the new OmniFocus task was created. I have set it up with 'command-N' as the Hotkey.

 

You can download the updated workflow here:

https://dl.dropboxusercontent.com/u/6967006/New%20OmniFocus%20Inbox%20Task%20with%20Notification.alfredworkflow

Link to comment

 

Added some code to the AppleScript and a ‘Post Notification’ step to Dan's great workflow so it now triggers a notification in the Notification Center with the task name that the new OmniFocus task was created. I have set it up with 'command-N' as the Hotkey.

 

You can download the updated workflow here:

https://dl.dropboxusercontent.com/u/6967006/New%20OmniFocus%20Inbox%20Task%20with%20Notification.alfredworkflow

 

 

Thanks for that :-) 

Link to comment
  • 3 months later...

Thanks for the updated workflow hwend88.

 

I just discovered something that was not mentioned. If you make sure the Hotkey Trigger argument is set to "Selection in OS X" you can select some text and quickly make a task from it. I added a Prefix of "//", without the double quotes, and I can now move an emailed task to the workflow with ease. Simply highlight the email body, activate via the hotkey and press command+left then command+up and type in the task name plus all the flags. This allows you to created a task in OmniFocus from a long email fairly quickly and get back to Inbox Zero.

 

I'm not sure what the limit is but I just tested it with 50 paragraphs of text from fillertext.com and it worked flawlessly.

Now it's GTD time B)

 

 

Link to comment
  • 3 months later...

I purchased OmniFocus 2 from App Store.

 

Not sure if that's only me, but I have to replace OmniFocus with com.omnigroup.OmniFocus2.MacAppStore in the script in order to make it work.

on alfred_script(q)
	set theName to (q)
	set isRunning to false

	tell application "System Events"
		if exists process "com.omnigroup.OmniFocus2.MacAppStore" then
			set isRunning to true
		end if
	end tell

	if isRunning is false then
		tell application "com.omnigroup.OmniFocus2.MacAppStore" to activate
	end if

	tell application "com.omnigroup.OmniFocus2.MacAppStore"
		parse tasks into default document with transport text q
	end tell
end alfred_script

I believe you can run the following script in Script Editor to get the application name in your system:

get id of application "OmniFocus"
Link to comment
  • 1 month later...

I know this is probably just me being daft, but it took me a while to work out why I couldn't get this workflow to create tasks, and thought I'd mention it here in case it helps anyone.

 

These workflows will only work with Omnifocus Pro.

 

I don't have pro, just the standard version, and in console logs, I see this:

15/06/2016 07:41:40.732 Alfred 3[895]: [ERROR] AppleScript Error: {
    NSAppleScriptErrorAppName = OmniFocus;
    NSAppleScriptErrorBriefMessage = "Scripting OmniFocus is a Pro feature.";
    NSAppleScriptErrorMessage = "OmniFocus got an error: Scripting OmniFocus is a Pro feature.";
    NSAppleScriptErrorNumber = "-1743";
    NSAppleScriptErrorRange = "NSRange: {293, 55}";
}

So now I just have to work out if I want to spend the extra $40 to upgrade

Link to comment
  • 7 months later...

Great Workflow. thx.

 

Two Qs:

 

1)

Does anyone know how to extend the script such that it also adds the selected emails to the note/description of the newly created OF description entry? I.e. if I am working through my emails in Apple Mail, I sometimes would love to create OF tasks for certain conversations which contain the full email conversations as url in the description / note of the OF task (such that I can click them easily when working through my OF tasks, instead of searching every again in my email program)

 

2)

Does anyone know how to create a new project on the fly (if not yet existent in OmniFocus)? Currently this workflow only recognises projects that already exist in OF. 

 

Thx :-)

Kristina 

Link to comment
  • 3 months later...
On 10/2/2015 at 4:54 PM, hwend88 said:

Added some code to the AppleScript and a ‘Post Notification’ step to Dan's great workflow so it now triggers a notification in the Notification Center with the task name that the new OmniFocus task was created. I have set it up with 'command-N' as the Hotkey.

 

You can download the updated workflow here:

https://dl.dropboxusercontent.com/u/6967006/New%20OmniFocus%20Inbox%20Task%20with%20Notification.alfredworkflow

 

Is there a new link? That link appears to be dead. Looks like a great workflow! 

Link to comment
  • 1 month later...

Hi!

I've downloaded this, and I have a slight problem.

When adding a task, I am not able to select/add project or context. when typing @ or :: and start typing the name of a project or context, nothing happens.

If I just type ::Testproject and action it, the task is saved without a project.

I am running Omnifocus 2.9.1. 

I tried using the debugger, but it didn't show any errors.

 

Does anybody have a clue what might be wrong?

 

Thanks!

Link to comment
  • 3 months later...
  • 3 weeks later...

so, for some reason, this did not do anything, or caused this error:

 

Quote

[2017-10-05 13:55:44][ERROR: action.applescript] {
    NSAppleScriptErrorBriefMessage = "Expected end of line but found identifier.";
    NSAppleScriptErrorMessage = "Expected end of line but found identifier.";
    NSAppleScriptErrorNumber = "-2741";
    NSAppleScriptErrorRange = "NSRange: {380, 5}";
}

 

I found, that the error does not occur, if you run the script as standard osascript, not as NSAppleScript

 

I changed the script as follows:

 

set q to "{query}"
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 false then
	tell application "OmniFocus" to activate
end if

tell application "OmniFocus"
	tell default document
		parse tasks into it with transport text (q)
	end tell
end tell

the corresponding action is "Script", Language "osascript (AS)"  with input as "{query}"

Link to comment
  • 1 month later...
  • 9 months later...
On 6/21/2013 at 1:53 PM, khit said:

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

So I'm still using this workflow 5 years later and it rocks… any way to update it to work with tags?

Link to comment

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...