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

 
Defer (or 'snooze') tasks/projects Thread Tools Search this Thread Display Modes
That's exactly what I need and it works well-thanks!
 
Is there any way that this can automatically fill in today's date for unscheduled tasks that you want to move?

At the moment if you use it on a task which doesn't have a specific date it does nothing as it doesn't realise that even though the date field is blank, you may still want to move this action to a few days from the current date.
 
Bevvy—for unscheduled tasks that you want to move, do you want to avoid seeing them for the specified number of days? If so, this "Snooze" script might suit your needs:

http://bylr.net/3/2009/02/omnifocus-snooze-script/
 
Quote:
Originally Posted by BevvyB View Post
Is there any way that this can automatically fill in today's date for unscheduled tasks that you want to move?

At the moment if you use it on a task which doesn't have a specific date it does nothing as it doesn't realise that even though the date field is blank, you may still want to move this action to a few days from the current date.
I too would find this convenient. This way I wouldn't have to have one script for snooze, and another for defer.
 
Hi there. I'm glad I searched for a script before trying to write one myself.

I don't seem to be able to select an item on the sidebar and run the script; it gives an error that there are "No valid task(s) selected".

It works if I select an item in the main outline list.

Is this a limitation of the script or of OF?
 
Script. It's possible to get the selection in the sidebar also.
__________________
Cheers,

Curt
 
Thanks Dan and Curt for this excellent script.

I modified the script slightly to include a start other than 12:AM so you can better filter actions visually that start during work hours. This way the grouping by start date will show "Start Today" items to do in the morning a little quicker. Using Remaining or Available under "Availability Filter helps me see what I need to do at home a little quicker (like a context for time).

It is set to 8AM but just change the number in the script at the top and the time in the dialog.

Code:
--Based on the snooze script at http://bylr.net/files/omnifocus/


(*
	# DESCRIPTION #
	
	This script "snoozes" the currently selected actions or projects by setting the start date to given number of days in the future.
	
	
	# LICENSE #
	
	Copyright © 2010 Dan Byler (contact: dbyler@gmail.com)
	Licensed under MIT License (http://www.opensource.org/licenses/mit-license.php)
	
	
	# CHANGE HISTORY #
	
	0.2c (2010-06-22)
	-	Actual fix for autosave
	
	0.2b (2010-06-21)
	-	Encapsulated autosave in "try" statements in case this fails
	
	0.2 (2010-06-15)
	-	Fixed Growl code
	-	Added performance optimization (thanks, Curt Clifton)
	-	Changed from LGPL to MIT license (MIT is less restrictive)
		
	0.1: Original release. (Thanks to Curt Clifton, Nanovivid, and Macfaninpdx for various pieces of code)

	
	# INSTALLATION #
	
	-	Copy to ~/Library/Scripts/Applications/Omnifocus
 	-	If desired, add to the OmniFocus toolbar using View > Customize Toolbar... within OmniFocus

	
	# KNOWN BUGS #
	
	-	When the script is invoked from the OmniFocus toolbar and canceled, OmniFocus returns an error. This issue does not occur when invoked from the script menu, a FastScripts or Quicksilver trigger, etc.
		
*)

property showAlert : false --if true, will display success/failure alerts
property useGrowl : true --if true, will use Growl for success/failure alerts
property defaultSnooze : 1 --number of days to snooze by default
property alertItemNum : ""
property alertDayNum : ""
property growlAppName : "Dan's Scripts"
property allNotifications : {"General", "Error"}
property enabledNotifications : {"General", "Error"}
property iconApplication : "OmniFocus.app"
property startTime : 8 --Military time to start

tell application "OmniFocus"
	tell front document
		tell (first document window whose index is 1)
			set theSelectedItems to selected trees of content
			set numItems to (count items of theSelectedItems)
			if numItems is 0 then
				set alertName to "Error"
				set alertTitle to "Script failure"
				set alertText to "No valid task(s) selected"
				my notify(alertName, alertTitle, alertText)
				return
			end if
			
			display dialog "Snooze start date for how many days from today? Start time will be 8:AM" default answer defaultSnooze buttons {"Cancel", "OK"} default button 2
			set snoozeLength to (the text returned of the result) as integer
			set todayStart to (current date) - (get time of (current date))
			if snoozeLength is not 1 then
				set alertDayNum to "s"
			end if
			set selectNum to numItems
			set successTot to 0
			set autosave to false
			repeat while selectNum > 0
				set selectedItem to value of item selectNum of theSelectedItems
				set succeeded to my snooze(selectedItem, todayStart, snoozeLength)
				if succeeded then set successTot to successTot + 1
				set selectNum to selectNum - 1
			end repeat
			set autosave to true
			set alertName to "General"
			set alertTitle to "Script complete"
			if successTot > 1 then set alertItemNum to "s"
			set alertText to successTot & " item" & alertItemNum & " snoozed. The item" & alertItemNum & " will become available in " & snoozeLength & " day" & alertDayNum & "." as string
		end tell
	end tell
	my notify(alertName, alertTitle, alertText)
end tell

on snooze(selectedItem, todayStart, snoozeLength)
	set success to false
	tell application "OmniFocus"
		try
			set newStart to (todayStart + (86400 * snoozeLength + (startTime * 3600)))
			set start date of selectedItem to newStart
			set success to true
		end try
	end tell
	return success
end snooze

on notify(alertName, alertTitle, alertText)
	if showAlert is false then
		return
	else if useGrowl is true then
		--check to make sure Growl is running
		tell application "System Events" to set GrowlRunning to ((application processes whose (name is equal to "GrowlHelperApp")) count)
		if GrowlRunning = 0 then
			--try to activate Growl
			try
				do shell script "/Library/PreferencePanes/Growl.prefPane/Contents/Resources/GrowlHelperApp.app/Contents/MacOS/GrowlHelperApp > /dev/null 2>&1 &"
				do shell script "~/Library/PreferencePanes/Growl.prefPane/Contents/Resources/GrowlHelperApp.app/Contents/MacOS/GrowlHelperApp > /dev/null 2>&1 &"
			end try
			delay 0.2
			tell application "System Events" to set GrowlRunning to ((application processes whose (name is equal to "GrowlHelperApp")) count)
		end if
		--notify
		if GrowlRunning ≥ 1 then
			try
				tell application "GrowlHelperApp"
					register as application growlAppName all notifications allNotifications default notifications allNotifications icon of application iconApplication
					notify with name alertName title alertTitle application name growlAppName description alertText
				end tell
			end try
		else
			set alertText to alertText & " \r \rp.s. Don't worry—the Growl notification failed but the script was successful."
			display dialog alertText with icon 1
		end if
	else
		display dialog alertText with icon 1
	end if
end notify
 
Thanks, everyone, for your input.

Bevvy, Henri—I've just pushed a new version to Github that addresses your concerns.

Skillet—it includes the ability to set start time for "snoozed" items, although still respects the times of existing start/due dates.

Jasong—I haven't added the ability to select items from the sidebar because it's sometimes not visually obvious what's selected and I don't want to mistakenly trigger the script. Let me know if you feel strongly about this though and I can add it.

Here's the changelog:

Code:
	0.4 (2011-07-07)
	-	New option to set start time (Default: 8am)
	-	New snoozeUnscheduledItems option (default: True) lets you push the start date of unscheduled items.
	-	No longer fails when a Grouping divider is selected
	-	Reorganized; incorporated Rob Trew's method to get items from OmniFocus
	-	Fixes potential issue when launching from OmniFocus toolbar
Source here; direct download here
 
Quote:
Originally Posted by dbyler View Post
Although still respects the times of existing start/due dates.
Nice work Dan, I will be using both now.

I like both approaches
1) Always Deferring by the amount from the current set date (i.e. repeating tasks that aren't going to happen this week that you want to keep on the same days)

2) Having all the actions start on the same day regardless of when they were set to originally start (I use more often).

Keep up the nice work, very useful.
 
It would be great if the script was able to defer a project due date, when invoked from an action (in that project) that has no due date of its own. (OF assumes the action is due when the project is due, so this would make sense.)
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Applescripts: Better Templates, Complete Tasks From Mail.app Sender, and Batch-Defer pxldot OmniFocus Extras 25 2014-04-01 06:55 AM
Is it possible to see Defer and Due dates at the project level? jelmore OmniFocus 2 for Mac (Private Test) 1 2013-04-30 12:00 PM
repeating projects/tasks when all tasks/subtasks are complete? djc225 OmniFocus 1 for Mac 1 2012-03-20 06:55 PM
Snooze (not "defer") tasks/projects dbyler OmniFocus Extras 0 2009-02-26 06:59 PM
Snooze button Mitch Wagner OmniFocus 1 for Mac 8 2009-02-21 05:29 AM


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


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