The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniOutliner > OmniOutliner 3 for Mac
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
OOpro setting Styles with Applescript Thread Tools Search this Thread Display Modes
Please help:

I am attempting to set the text colour in rows based on the status of checkboxes in two columns. I have entered two styles called TagTBD and TagComplete, these styles define the font colour to be red and green. My script runs and sets the styles and all seems well. However if I change the status of the check box e.g. Complete from unchecked to checked which would mean a change of styles the styles do not get updated. I do attempt to remove the styles before I apply the correct style but examination of the styles in the inspector show my named styles listed under the inherited section. How should I apply or remove a named style?

Here is my script:
Tell front document of application "OmniOutliner Professional"
-- Based on the example posted by DerekM thanks Derek
-- set up some counter variables
set ObsCount to 0
set rowCounter to 0
set CompleteCounter to 0
set StyleTagTbd to named style ("TagTBD")
set StyleTagComplete to named style ("TagComplete")
repeat with oneRow in rows --onerow is the row being processed
set rowCounter to rowCounter + 1
--Remove the styles
remove StyleTagTbd from named styles of styles of oneRow
remove StyleTagComplete from named styles of styles of oneRow
if (exists child of oneRow) then
-- if the row has a child then do nothing
-- I'm interested in the lowest level of
-- the outline only
else
(*I have two columns called Obs and Complete
in my Outline. I place a tick in the obs column
if I want the row to be included.
I place a tick in the Completed Column for items that are
completed.
The columns obs and complete should be of type checked *)
set IsObs to value of cell "Obs" of oneRow
set IsComplete to value of cell "complete" of oneRow

if IsObs is "checked" then
-- increment the counter
set ObsCount to ObsCount + 1
-- Set the style to TagObs
--remove every named style from named styles of style of oneRow
--remove every style from styles of style of oneRow
--if theNamedStyle is not missing value then
add StyleTagTbd to named styles of style of oneRow
--end if
end if
if IsComplete is "checked" then
--increment the counter
set CompleteCounter to CompleteCounter + 1
--remove every named style from named styles of style of oneRow
add StyleTagComplete to named styles of style of oneRow
end if
end if
end repeat
set itemsRemaining to ObsCount - CompleteCounter
-- Script reports total number of items to process,
-- the number of completed items and the number still
-- to do.
display dialog (((ObsCount as string) & " items to process. " & CompleteCounter as string) & " items completed, " & itemsRemaining as string) & " items to complete"
end tell
 
Belay my last,

It was a case of a "switch pigs" I was not saving my updated script to the correct location where the button on the button bar could run it. Thus I made changes which did not seem to work. Now that it is saved in the correct place it works.

Simon
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting AppleScript variable to text of a cell forum member OmniOutliner 3 for Mac 1 2012-06-29 01:45 PM
Setting AppleScript variable to text of a cell Patrick J OmniOutliner 3 for Mac 2 2011-12-03 03:31 PM
Setting diagram style through Applescript ? RobTrew OmniGraffle General 2 2011-03-08 05:19 AM
Setting Task Custom Data using Applescript jubo OmniPlan General 6 2007-08-22 10:05 AM
Suggestion concerning setting styles Target1 OmniOutliner 3 for Mac 0 2006-10-04 03:47 AM


All times are GMT -8. The time now is 10:29 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.