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)
-   -   How to edit "Move Completed Items" helpful script (http://forums.omnigroup.com/showthread.php?t=14379)

rogbar 2009-11-03 12:24 PM

How to edit "Move Completed Items" helpful script
 
I can really use this script, but it wants Done.003 to be on the Desktop, where I don't want it. How can I edit the script so that Done.003 will be in my Documents folder?

------------------

tell application "OmniOutliner Professional"

-- format today's date in an appropriate way
set today to current date
set dateString to month of today & " " & day of today & ", " & year of today as string

set original to front document of application "OmniOutliner Professional"

-- open Done.oo3 if it exists and set path, if not, create it
try
open file ((path to desktop as string) & "Done.oo3")
set doneDoc to document named "Done.oo3"
on error
set doneDoc to make new document at beginning of documents
set doneDocPath to ((path to desktop as string) & "Done.oo3")
tell front document
make new row at end of rows
try
save in doneDocPath
on error number errNum from badObj -- time out error handling
end try
end tell

set topic of first row of doneDoc to dateString
end try


-- create the entry for today in the done document if it isn't already there
if not (exists (last child of doneDoc)) then
tell doneDoc
make new row at end of rows
end tell
end if

set newRow to last child of doneDoc
if dateString is not equal to (topic of newRow) then
set newRow to make new row at end of rows of doneDoc
set topic of newRow to dateString
end if

-- copy the checked items
duplicate (every row of original whose state is checked and has subtopics of it is false) to end of children of newRow
delete (every row of original whose state is checked and has subtopics of it is false)
set expanded of newRow to true

try
save doneDoc
on error number errNum from badObj -- time out error handling
end try

end tell

DerekM 2009-11-03 12:55 PM

Changing in both locations "path to desktop as string" to "path to documents folder as string" should do it

whpalmer4 2009-11-03 01:08 PM

3 Attachment(s)
And better yet would be cleaning it up like this:
[code]
property doneDocName : "Done.oo3"

tell application "OmniOutliner Professional"

-- format today's date in an appropriate way
set today to current date
set dateString to month of today & " " & day of today & ", " & year of today as string

set original to front document of application "OmniOutliner Professional"

-- open Documents/Done.oo3 if it exists and set path, if not, create it
set doneDocPath to ((path to documents folder as string) & doneDocName)
try
open file doneDocPath
set doneDoc to document named doneDocName
on error
set doneDoc to make new document at beginning of documents
[/code]

A word of warning: this script won't copy over the structure of your completed stuff exactly, as nested items will only have the completed leaves copied, and then subsequent runs will capture the parents but not retain the structure, as seen in the before/after images attached.


All times are GMT -8. The time now is 04:38 AM.

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