I know we’ve already got “Apply Forecast Tag”, but I think it would be helpful to have a hotkey for “Plan for Today” that sets the Planned Date on a selected task to today.
Planned dates seem incredibly powerful long term (a calendar perhaps?), but in the short term I would love to be able to plan things for today with a hotkey (and unplan them as well).
I mean it’s pretty trivial to make one (and perhaps one should be posted just for funzies) but I think that this should just be included as standard, for the simple reason that a LOT of people will be using this.
Until this gets added to the product you can use the following script, which respects the Default time for planned dates setting, and assign a keyboard shortcut to it: Planned for Today.omnifocusjs (1.1 KB)
/*{
"author": "Patrick",
"targets": ["omnifocus"],
"type": "action",
"identifier": "com.patrick.SetPlannedDateToToday",
"version": "1.0",
"description": "Set the Planned Date of the selected tasks to today",
"label": "Plan for Today",
"mediumLabel": "Plan for Today",
"longLabel": "Set Planned Date to Today",
"paletteLabel": "Plan for Today",
"image": "signpost.right"
}*/
(() => {
const action = new PlugIn.Action(selection => {
// 1. Fetch the default time string (e.g. "08:00" or "00:00:00")
let timeString = settings.objectForKey('DefaultPlannedTime') || "00:00:00";
const parts = timeString.split(":").map(Number);
const [h = 0, m = 0, s = 0] = parts;
// 2. Construct “today at default time”
const cal = Calendar.current;
const todayStart = cal.startOfDay(new Date());
const dc = new DateComponents();
dc.hour = h;
dc.minute = m;
dc.second = s;
const plannedToday = cal.dateByAddingDateComponents(todayStart, dc);
// 3. Apply to every selected task
selection.tasks.forEach(task => {
task.plannedDate = plannedToday;
});
});
return action;
})();