# Summarize Tasks button by Dan Rahmel # Create a node, place this code in the body text, and set the node headline to: # @button SummarizeTasks? # # This button will search the child nodes of a parent node for lines that # contain the bar(|) character. # Any lines that have the bar character are retrieved and added to a list. # The list is then placed in the body text of the parent node. # # I use this to organize a daily summary to-do list. All of my projects are # kept as child outlines and a task list for each is contained in the body text # of each node. Therefore, I can have children with body text such as: # # Get two eggs: 11/13/2006 15:38:54, completed # Break eggs: 11/13/2006 15:39:10, completed # Cook eggs: | # Eat eggs: # # In this list, only the task I'm currently working on (Cook eggs) will # be added to the summary list.

tasks = "" # Search each child node for myP in p.subtree_iter():

myBody = myP.bodyString() # Split the body text into individual lines myList = myBody.split("n") # Search each line for a bar character for myLine in myList:

numBars = myLine.count("|") # If there are any bars in the line, add to task list if numBars:

tasks += myLine + "n"

# Set body text of selected node to task list p.setBodyStringOrPane(tasks)