The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniOutliner 3 for Mac (http://forums.omnigroup.com/forumdisplay.php?f=9)
-   -   Script Help (http://forums.omnigroup.com/showthread.php?t=3905)

gcrump 2007-06-19 04:04 PM

Script Help
 
I have an outline that has a due date column and a done date column. I would like to write an applescript that will find rows that have been mark completed since the last time the script was run and put today's date into the done date column for that row and then clear the date out of the due date column for that row. Since the done date column would be blank until the script runs. I think if the script ran looking for complete items where the done date is blank that would give me the rows that had been completed since the last time the script was run.

Unfortunately I have no idea what the script would look like... Can someone help?

George

DerekM 2007-06-20 12:55 PM

This should do what you want assuming your due and done column are date types. If you're using rich text you'll need to change the comparison.

*ooops forgot to check the due column for a value, fixed*

tell application "OmniOutliner Professional"
tell front document
repeat with theRow in every row
-- change "done" to the name of your done column
set theDate to value of cell "done" of theRow
if theDate is missing value then
if (value of cell "due" of theRow is not missing value) then
set value of cell "done" of theRow to "today"
-- change "due" to the name of the due column
set value of cell "due" of theRow to missing value
end if
end if
end repeat
end tell
end tell

gcrump 2007-06-21 03:01 PM

Thanks very much, that did work, figured out to the state is checked. Now I would like to then set the style of that row to use the strikeout attribute... I attempted (see comment) but no luck....

tell application "OmniOutliner Professional"
tell front document
repeat with theRow in (every row whose state is checked)
-- change "done" to the name of your done column
set theDate to value of cell "Done" of theRow
if theDate is missing value then
if (value of cell "Due Date" of theRow is not missing value) then
set value of cell "Done" of theRow to "today"
-- change "due" to the name of the due column
set value of cell "Due Date" of theRow to missing value
--- change to strikeout attribute
--- set style of theRow to bold
end if
end if
end repeat
end tell
end tell

gcrump 2007-06-21 03:18 PM

Never Mind. Got it to work. Here is the completed code:

tell application "OmniOutliner Professional"
tell front document
repeat with theRow in (every row whose state is checked)
-- change "done" to the name of your done column
set theDate to value of cell "Done" of theRow
if theDate is missing value then
if (value of cell "Due Date" of theRow is not missing value) then
set value of cell "Done" of theRow to "today"
-- change "due" to the name of the due column
set value of cell "Due Date" of theRow to missing value
remove every named style of style of theRow from named styles of style of theRow
set myStyle to named style ("DoneItem")
add myStyle to named styles of style of theRow
end if
end if
end repeat
end tell
end tell

DerekM 2007-06-21 03:42 PM

Use this:
add named style "StrikeOut" to named styles of style of theRow

*never mind, you beat me to it :) *


All times are GMT -8. The time now is 08:12 PM.

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