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 Today's Posts

 
Combining Tasks Thread Tools Search this Thread Display Modes
Concatenating the notes from two or more tasks is a straightforward idea, but how would you propose to resolve the task name? Display them and pick one? Type in a new one? Arbitrarily choose one automatically and go with it?
 
hrmmm.... Well– In never noticed the way the clip-o-tron handles multiple messages, so I guess it handles them well...

I just checked.

I keeps the first message subject as the title of the task in omnifocus...

But then– in the first lines of the note of the task– it lists the subjects off all the source emails. Then, skips a line, and then underneath displays the body of all the messages. Something parallel would be great.
 
This script will combine two or more selected tasks. The first one is kept as the base and the rest are appended and then deleted. I haven't figured out how to retain any formatting that may be in the notes so the new task will be all plain text if that matters to you.

Code:
-- Combine two or more selected tasks into one
tell application "OmniFocus"
	tell document window 1 of default document
		set _trees to selected trees of content
		if (count of _trees) < 2 then
			display dialog "You must have more than one task selected"
		else
			set _tasksToDelete to {}
			set _masterTask to value of item 1 of _trees
			set _names to "From:  " & name of _masterTask
			set _notes to name of _masterTask & return & note of _masterTask
			repeat with i from 2 to count of _trees
				set _task to value of item i of _trees
				set end of _tasksToDelete to _task
				set _names to _names & return & "From:  " & name of _task
				if note of _task is not "" then
					set _notes to _notes & return & return & name of _task & return & note of _task
				end if
			end repeat
			set note of _masterTask to _names & return & return & _notes
			repeat with _task in _tasksToDelete
				delete _task
			end repeat
		end if
	end tell
end tell
 
Brilliant!!!!!

Thank you so much!

This is going to save me hours each week!
 
If you also wanted to preserve formatting you could back-up your data and then experiment with something like the following:

Code:
tell application id "com.omnigroup.omnifocus"
	tell content of front document window of front document
		set lstTasks to value of selected trees where (class of its value is task)
		if length of lstTasks < 2 then return
		set oFirstTask to first item of lstTasks
		set lstRest to items 2 thru end of lstTasks
		
		tell oFirstTask -- INSERT TITLE OF FIRST TASK AT START OF ITS OWN NOTE
			insert name & return & return at before characters of note
			duplicate last character of note to after last character of note
			insert return & return at before last character of note
			delete last character of note
			
			repeat with oTask in lstRest -- APPEND TITLES AND NOTES OF OTHER TASKS TO NOTE OF FIRST TASK
				duplicate last character of note to after last character of note
				insert ((return & return & (name of oTask) as string) & return & return) at before (last character of note)
				delete last character of note
				duplicate (characters of note of oTask) to after (characters of note)
				delete oTask
			end repeat
		end tell
	end tell
end tell
 
I definitely like the idea that you're checking to make sure what's selected are actually tasks. I should have added a caveat to my script that there wasn't any real error checking going on. However, "where (class of its value is task)" always results in lstTasks being empty for me. I had to remove that clause to get it to recognize the selected tasks.

Your script did preserve the formatting perfectly, but it took 13 seconds to combine two small emails. I'll have to examine what you're doing in more detail when I have time later.

Thanks for the update.
 
 




Similar Threads
Thread Thread Starter Forum Replies Last Post
combining planning view and context view Gizmo OmniFocus 1 for Mac 7 2011-11-23 12:47 PM
Combining lines stevechamp OmniGraffle General 1 2007-12-17 01:38 AM
Dividing and combining rows Harvey Leff OmniOutliner 3 for Mac 1 2007-11-25 11:41 AM
Combining two OmniFocus documents? jasong OmniFocus 1 for Mac 3 2007-07-03 02:42 PM
Combining shapes - masking, cutout, cutaway, compositing… chirsten OmniGraffle Extras 0 2006-11-22 03:17 PM


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


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