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 > OmniFocus > OmniFocus Extras
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Set project status to completed not working in script? Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Hi folks--
I've been trying to make a script that will allow me to mark projects completed from context view, since I get tired of switching over to do this. Unfortunately, something mysterious is happening: my changing of the project's completed status doesn't "take." I can successfully change the project's name or note, but not its completed status or completion date. Any thoughts? I stole the first bit of this code from the "reveal" script available here.

property toolName : "Mark Project Complete"

tell front document of application "OmniFocus"
	(* get the window the user is using *)
	set |w| to first document window whose index is 1
	tell |w|
		set theItems to selected trees of content
		if ((count of theItems) is 0) then
			display alert ¬
				"Select an action to " & toolName message "You have not selected an action"
		end if
		if ((count of theItems) is greater than 1) then
			display alert ¬
				"Select just one action to " & toolName message "You have selected more than one item, please select just one"
		end if
		set selectedItem to value of item 1 of theItems
		--set selectedItem to item 1 of theItems
		if ((class of selectedItem) is not task) then
			display alert ¬
				"Select an action to " & toolName message "You have selected something that isn't an action"
		end if
	end tell
	set P to containing project of selectedItem
	if (P is missing value) then
		display alert ¬
			"Select an action to " & toolName message "You can't mark the inbox complete!"
		(* a real project, not the inbox *)
		tell application "OmniFocus"
			set note of P to "Kilroy was here" --this works
			set completed of P to true
			set displaytext to completed of P as rich text
			set completion date of P to current date
			set displaytext to displaytext & " " & completion date of P as rich text
			display dialog displaytext --shows "false" and "no value"
		end tell
	end if
end tell

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
Script: Toggling the status of taskless folders RobTrew OmniFocus Extras 0 2012-10-01 10:19 AM
setting project + context via script (modifying a DEVONthink script) bernd OmniFocus Extras 2 2012-09-08 12:10 PM
due or flagged status filter - not working? djc225 OmniFocus 1 for Mac 1 2012-03-02 09:22 AM
a command for removing completed status? watchit OmniFocus 1 for Mac 2 2010-03-09 07:18 PM
Popup to ask if project is completed when last action completed esciara OmniFocus 1 for Mac 2 2007-09-04 03:59 AM

All times are GMT -8. The time now is 01:22 AM.

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