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 > Developer > AppleScripting Omni Apps
FAQ Members List Calendar Today's Posts

 
Adding Project and Context Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
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.

d


Code:
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"
			launch
			try
				set this_file to (item i of the_files)
				tell application "Finder"
					activate
					open document file this_file using application file "Tex-Edit Plus.app" of folder "Tex-Edit Plus" of folder "Applications" of startup disk
					tell application "Tex-Edit Plus"
						activate
						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
 
 




Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding actions for a context but getting the wrong project gokubi OmniFocus for iPhone 3 2011-07-07 06:56 AM
Adding start date to project removes actions from Context view HSstudio OmniFocus 1 for Mac 5 2010-07-19 03:46 PM
Adding item with no context wmeleis@westernfog.com OmniFocus for iPhone 8 2009-03-29 10:02 AM
Adding New Context on 1.1 denrael OmniFocus 1 for Mac 6 2008-08-04 12:45 PM
Adding Sub-Context by typing gotung OmniFocus 1 for Mac 2 2008-08-04 08:22 AM


All times are GMT -8. The time now is 10:52 PM.


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