View Single Post
In the meanwhile I have redrafted both scripts to make them work under OS X 10.4.11

(It looks as if something may have slipped between cup and lip in the Omni-implementation of the text collection of the cell object - there is some Applescript slippage between "text" and "texts" at work here)

Wordcount

Code:
tell application "OmniOutliner Professional"
	set intWords to 0
	set intTexts to 0
	set iText to 0
	
	tell front document
		repeat with oRow in rows
			repeat with oCell in cells of oRow
				if type of column of oCell is rich text then
					set intTexts to count of text of oCell
					repeat with iText from 1 to intTexts
						set intWords to intWords + (count of words of text iText of oCell)
					end repeat
				end if
			end repeat
		end repeat
	end tell
	
	display dialog (intWords as string) & " words"
end tell
Character Count

Code:
tell application "OmniOutliner Professional"
	set intChars to 0
	set intTexts to 0
	set iText to 0
	
	tell front document
		repeat with oRow in rows
			repeat with oCell in cells of oRow
				if type of column of oCell is rich text then
					set intTexts to count of text of oCell
					repeat with iText from 1 to intTexts
						set intChars to intChars + (count of characters of text iText of oCell)
					end repeat
				end if
			end repeat
		end repeat
	end tell
	
	display dialog (intChars as string) & " characters"
end tell

Last edited by RobTrew; 2008-11-30 at 12:00 PM..