
Last one for the day. I've been using OmniOutliner to compile information on all of our contracts, and one of the things I wanted to do was highlight rows where something was missing. This will prompt the user for the columns to check and whether to highlight when all the columns are missing data, or any of them. OmniOutliner Pro has a standard style called "Highlight" that the script will assign to anything that matches.
-- highlight gaps in user-specified column tell front document of application "OmniOutliner Professional" set theColumns to the name of every column choose from list theColumns with title "Highlight Gaps" with prompt "Select a column. Rows where this column is empty will be highlighted." with multiple selections allowed set theHighlightColumns to result choose from list {"all", "any"} with title "Match on Gaps" with prompt "Choose to match rows where any or all selected columns are empty." default items {"all"} set theJoinType to result if the (count of theHighlightColumns) is greater than 0 then repeat with oneRow in rows -- clear existing styles set theStyle to style of oneRow remove named styles of theStyle from named styles of theStyle set value of every attribute of theStyle to missing value set style of oneRow to named style ("Default") -- set our defaults set isMissingValue to false if item 1 of theJoinType is "all" then set isMissingValue to true end if repeat with theHighlightColumn in theHighlightColumns set theType to value of cell theHighlightColumn of oneRow set theState to state of cell theHighlightColumn of oneRow if item 1 of theJoinType is "any" then if theType is missing value or theType is equal to "" or theState is unchecked then set isMissingValue to true end if else if (theType is not missing value and theType is not equal to "" and theType is not equal to "unchecked") or theState is checked then set isMissingValue to false end if end if end repeat if isMissingValue then set style of oneRow to named style ("Highlight") end if end repeat end if end tell
Posted by Jason at September 2, 2007 06:56 PM