The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniFocus > OmniFocus Extras
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Asign Category and Project to Actions Thread Tools Search this Thread Display Modes
Has anybody seen or written an apple script where you can modify the properties to automatically assign the category and project of selected actions. There are certain actions that are very common for me to do and it would be nice to just have them be assigned the right place to go at the end of the day in my in-box; instead of using the drop down from the inspector of multiple selected actions.

I know that there are delegated scripts that assign an action to a category but I am not having success modifying these.


Related:
The "AddFileToInbox" droplet would be awesome to have preassigned category and project to go into instead of just linking and going to the inbox for processing.
http://www.cerquant.com/omnifocus_scripts
 
FWIW, here's what I use to set context:


Code:
set newContext to my getContext("home")
set context of thisItem to newContext

on getContext(contextName)
	tell application "OmniFocus"
		tell front document
			set contextID to id of item 1 of (complete contextName as context)
			return first context whose id is contextID
		end tell
	end tell
end getContext
getContext returns the best match for a given string, so "home" would match "Home" before the "Home > Garden" context.
 
Quote:
Originally Posted by dbyler View Post
getContext returns the best match for a given string, so "home" would match "Home" before the "Home > Garden" context.
And if there is no match, you can always extend getContext to create one:

Code:
on getContext(contextName)
	tell application "OmniFocus"
		tell front document
			try
				first flattened context whose name contains contextName
			on error
				(make new context with properties {name:contextName})
			end try
		end tell
	end tell
end getContext
 
Neither of those are working for me, I have tried many ways to modify them to get them to work but no success.


Code:
property contextName : "Home"


tell application "OmniFocus"
	tell front document
		set contextID to id of item 1 of (complete contextName as context)
		return first context whose id is contextID
	end tell
end tell
end
Code:
on getContext("Home")
	tell application "OmniFocus"
		tell front document
			try
				first flattened context whose name contains "Home"
			on error
				(make new context with properties {name:"Home"})
			end try
		end tell
	end tell
end getContext
Sorry I am dumb as a nail. If you could spare the time, could you show an example of what you use on multiple selected actions that have no context and projects and you want to put them in context "Work : Online" (online being a context of work) and project "Research" in a Marketing folder.

I am not sure if you have to define the folders if there are multiple projects named "Research". Seems confusing to define since they can even be in the same folder with the same name.

Anyway just the context part would be helpful to me if the project part is too complicated.

Last edited by skillet; 2011-07-09 at 04:10 PM..
 
For oft-repeated batch assignments, you could specify the project name (and the name of its containing folder), together with the context name, at the top of a script of this general shape.

Code:
property pProjFolder : "Marketing"
property pProjName : "Research"
property pContextName : "Online"


tell application "OmniFocus"
	tell front document
		set oProject to first flattened project where (its name = pProjName) and (name of its folder = pProjFolder)
		set oContext to first flattened context where name = pContextName
		
		tell content of front document window
			set lstTasks to (value of selected trees where class of its value is inbox task or class of its value is task)
			repeat with oTask in lstTasks
				set context of oTask to oContext
				move oTask to end of tasks of oProject
			end repeat
		end tell
	end tell
end tell
 
Angels sing and the clouds part! I will be using this everyday, thank you Rob (& Dan)!!
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Project perspective that shows all sequential actions but no actions before start date? enigma2k OmniFocus 1 for Mac 2 2012-11-22 03:48 AM
Actions that don't leave "Overdue" category Faulkner OmniFocus for iPhone 5 2009-09-04 08:14 AM
Organize Projects by Category or Roles dwayneneckles OmniFocus 1 for Mac 6 2008-07-16 06:48 AM
Cleanup not assigning project-less action to my 'single actions' project bongoman OmniFocus 1 for Mac 0 2007-12-11 02:04 PM
I really need a third category... Janice OmniFocus 1 for Mac 42 2007-06-07 11:42 AM


All times are GMT -8. The time now is 01:45 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.