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

How do you add existing projects and contexts Thread Tools Search this Thread Display Modes
OK still working on this folderAction. I would like to learn how to add a Project and a Context to a task. The code below is working just like I want except I would like to add a default project of "Miscellaneous" and a default context of "Unassigned" Thanks for any insight you may provide.


on adding folder items to my_folder after receiving the_files
	repeat with i from 1 to number of items in the_files
		tell application "OmniFocus"
				set this_file to (item i of the_files)
				tell application "Finder"
					open document file this_file using application file "Tex-Edit" of folder "Tex-Edit Plus" of folder "Applications" of startup disk
					tell application "Tex-Edit Plus"
						delete text from line 1 to line 7 of window 1
						select contents of window 1
						set singleTask to false
						set theText to contents of window 1
						close window 1 without saving
						tell application "OmniFocus"
							set singleTask to true
							tell default document
								set myNewTasks to parse tasks with transport text theText as single task singleTask
							end tell
							set start date of first item of myNewTasks to (current date) + 1 * days
							set due date of first item of myNewTasks to (current date) + 4 * days
						end tell
					end tell
				end tell
				add this_file
			end try
		end tell
	end repeat
end adding folder items to
Cross-posting can make things a little confusing.

I've responded to the copy of this query at
Originally Posted by RobTrew View Post
Cross-posting can make things a little confusing.

I've responded to the copy of this query at
Sorry my mistake.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving existing projects to folders Mange OmniFocus for iPad 2 2012-03-11 11:34 AM
Contexts on Projects avit OmniFocus 1 for Mac 7 2012-01-17 08:14 AM
can't move pre-existing project in to pre-existing folder kbs1138 OmniFocus 1 for Mac 3 2011-06-16 10:22 AM
New projects showing as collapsed in existing perspectives jhogan OmniFocus 1 for Mac 8 2008-07-25 09:57 AM
Indication for existing action for projects/contexts ksrhee OmniFocus 1 for Mac 1 2007-08-16 06:44 AM

All times are GMT -8. The time now is 07:09 AM.

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