Word count
Not logged in

2006-01-22 - Brian Theado - in a private email, James LaRue asked me (among other things) about getting the word count of an outline. Here is some code that can be placed in your startup script (Edit->Edit Startup Script) to accomplish this.

 proc wordCount tree {
    # Accumulate all titles into a list, one title per list item
    set titles {}
    $tree walk root n {
        if {$tree keyexists $n title} {
            lappend titles $tree set $n title

# Join titles into a single string, condense multiple whitespace chars, # then split on whitespace and count result return llength [split [regsub -all {\s+} [join $titles { }]]] }

# Control-Shift-w bind Outline <Control-W> [bad-link: namespace code { ::outlinewidget::showConsole puts &quot;[wordCount [[winfo parent %W]namespace code { ::outlinewidget::showConsole puts "[wordCount [[winfo parent %W treecmd]] words" }]

Pressing the Control-Shift-w key combination will open the console window and display the number of words in the current outline.

2006-01-23 - Brian Theado - I fixed a problem with displaying the console on unix and I fixed the problem with multiple consecutive whitespace characters inflating the word count.