Hide_Done_Entries_Scripts


Outdated!!!

This information is for TaskPaper 2 which is old and outdated. TaskPaper 3 is the current version of TaskPaper. For TaskPaper 3 support please visit the support forums.


These scripts, "Hide Done Entries' and "Hide Done Entries in a Project" hide done entries and their descendants. The remaining entries are projects, tasks and, optionally, notes, that are not yet done. "Hide Done Entries in a Project" works in a single project, which is selected from a pop-up list. The scripts work by assigning a temporary tag to "Done" entries and then searching for entries without that tag. To remove the tag and search, run the script a second time. The option to show notes is set in the first line of each script. The default is "true".

For some history, see this TaskPaper discussion thread. The latest versions of the scripts can be found here.

Hide Done Entries:

            (* Hide done entries and their descendants. 
            This script temporarily tags the entries to hide and shows everything else. 
            Run the script again to remove the temporary tags and restore the view.
            Choose to show or hide notes by setting a property in the first line of the script.
             http://groups.google.com/group/taskpaper/browse_thread/thread/11aaa8f117f453f 
             Version 2.0
            *)
            property show_notes : true --set "true" or "false"
            tell application "TaskPaper"
                tell front document
                    if length of (search with query "@dd") > 0 then
                        repeat with x in search with query "@dd -d -a"
                            delete (every tag of x whose name is "dd")
                        end repeat
                        set search field string to ""
                    else
                        repeat with x in search with query "@done -a +d"
                            if text content of x is not "" then
                                make tag at end of x with properties {name:"dd"}
                            end if
                        end repeat
                        if show_notes is true then
                            set search field string to " (content !=\"\") and not @dd"
                        else
                            set search field string to "(type = \"project\" or type = task) and (content !=\"\") and not @dd"
                        end if
                    end if
                end tell
            end tell

Hide Done Entries in a Project

            (* Hide done entries in a project. Choose a project and show only entries not yet done. This is done by 
            is done adding a temporary tag to done entries and descendants of done entries 
            Run the script once to choose the project. and a second time to remove the tag.
             http://groups.google.com/group/taskpaper/browse_thread/thread/11aaa8f117f453f 
            *)
            property show_notes : true

            tell application "TaskPaper"
                tell front document
                    if length of (search with query "@dd") > 0 then
                        repeat with x in search with query "@dd"
                            delete (every tag of x whose name is "dd")
                        end repeat
                        set search field string to ""
                    else
                        set _pnames to name of every project
                        set _choice to choose from list _pnames
                        if _choice is false then
                            set search field string to ""
                            return
                        else
                            set _srch to item 1 of _choice as string
                            repeat with x in search with query "project = \"" & _srch & "\" and (@done -a +d)"
                                make tag at end of x with properties {name:"dd"}
                            end repeat
                            if show_notes is true then
                                set search field string to "project = \"" & _srch & "\" and content !=\"\" and not @dd"
                            else
                                set search field string to "(type = \"project\" or type = task) and (content !=\"\" and project = \"" & _srch & "\") and not @dd"
                            end if
                        end if
                    end if
                end tell
            end tell