View Single Post
Quote:
Originally Posted by whpalmer4 View Post
My code gave an example of looping through all of the rows in the document.
(This was randomly bumped by a piece of spam, but FWIW ...)

A variant approach which may give a little more speed (and possibly simplicity ?) is to get a whole list of values in a single apple event by evaluating a property of a reference.

Code:
tell application id "com.omnigroup.OmniOutlinerPro3"
	tell front document
		-- quickly get a *list* of values by evaluating a property of a reference
		set refCol to a reference to cell "Ricarico" of rows
		set lstValues to value of refCol
		
		-- Iterate through an applescript list (faster and simpler)
		-- rather than through a collection in an application object model 
                --(slower and more complex)
		set lngTotal to 0
		repeat with varValue in lstValues
			if contents of varValue is missing value then
				-- skip
			else
				set lngTotal to lngTotal + varValue
			end if
		end repeat
	end tell
end tell