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

 
How to edit "Move Completed Items" helpful script Thread Tools Search this Thread Display Modes
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
 
Changing in both locations "path to desktop as string" to "path to documents folder as string" should do it
 
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
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.
Attached Thumbnails
Click image for larger version

Name:	Picture 5.png
Views:	1018
Size:	10.5 KB
ID:	1144   Click image for larger version

Name:	Picture 6.png
Views:	1008
Size:	6.2 KB
ID:	1145   Click image for larger version

Name:	Picture 7.png
Views:	1041
Size:	10.2 KB
ID:	1146  
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to move project into folder? [A: Tap Edit, tap item, tap "move" button in Tbar.] Avis OmniFocus for iPhone 4 2010-07-07 11:27 AM
How to move items? [A: Tap "edit", tap item, then use drag handle at right.] baldeagle OmniFocus for iPhone 3 2009-08-14 05:11 PM
Completed projects' un-checked items cause bad folder "remaining" count [BUG: Fixing] hardcoreUFO OmniFocus for iPhone 7 2009-08-04 04:37 PM
Script to fire a "completed" email? nateswart OmniFocus Extras 0 2008-10-01 01:01 PM
"Immediately hide completed items" santra OmniFocus 1 for Mac 2 2008-08-22 08:11 PM


All times are GMT -8. The time now is 08:27 AM.


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