View Single Post
Quote:
Originally Posted by RobTrew View Post
In the OmniFocus app:

Help > Release Notes > Archive (a link at the top)

Then search for "November 2" (no year specified)

This seems to be the fullest summary of the "parse tasks" syntax, including the specification of project & context.

(Might be worth a suggestion to Help > Support that it could usefully be included in the main help file)

--

I thank you for your post and have looked at the info you suggested above but it looked to me to be info on parsing from an email to OF. I already know the Project and context I want to add but don't seem to have the syntax down correctly to add this info. I want a default project of "Miscellaneous" with a default context of "Unassigned" Below is the current state of my folderactions script. Thanks!

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
					--set theText to read file ":Users:RoonToon:Desktop:Request.txt" -- open the file and get the contents
					set theText to read this_file
					set {od, my text item delimiters} to {my text item delimiters, "EndOfRequest"} -- set the text marker
					set requestText to text item 1 of theText -- get everything up to the marker
					set my text item delimiters to od -- clean up
					set reqLines to paragraphs of requestText -- get the lines of text
					set reqLines to items 8 through end of reqLines -- strip off the first 7 lines
					set reqLines to items 1 through 5 of reqLines & items 7 through end of reqLines -- strip line 6
					set reqLines to items 1 through 6 of reqLines & items 9 through end of reqLines -- strip lines 7 - 12
					set my text item delimiters to return
					set reqLines to reqLines as text -- convert the list back to text
					set my text item delimiters to od -- clean up
					set theText to text 2 through end of reqLines
					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			
				add this_file
			end try
		end tell
	end repeat
end adding folder items to