Hi all,
I’m looking for a way to move a Task back to the Inbox. Manually in the app I would remove the project and context, so I tried this via a script, but I cannot figure out how to either remove the project attribute of a task a re-assign the Inbox project ( if that exists? ) to a task.
Any help is highly appreciated!
BTW I’m using Javascript, not AppleScipt.
Thanks in advance
How do you do that in the app ?
Tasks in OmniFocus have an .inInbox read-only property. So, I think it’s not currently possible to move a task back to the Inbox.
FWIW, I use this script to duplicate tasks to the Inbox (it only preserves .name property).
// unlocked2412
// Using some of drafts8 wonderful JS - Prelude functions
(() => {
'use strict';
// jxaMain :: IO ()
const jxaMain = () => {
// main :: IO ()
const main = () => {
const
sa = standardAdditions(),
lrTasks = ofSelectionLR();
return isLeft(lrTasks) ? (
sa.displayNotification(lrTasks.Left)
) : lrTasks
.Right
.map(x => x.name())
.map(ofNewInboxTask)
};
// GENERICS
// JS - Apps
// ofNewInboxTask :: Name String -> OF Task
const ofNewInboxTask = strName => {
const of = Application('OmniFocus'),
doc = of.defaultDocument,
dctTask = {
name: strName
},
oTask = of.InboxTask(dctTask);
return doc.inboxTasks.push(oTask)
}
// ofSelectionLR :: () -> Either [OF Task]
const ofSelectionLR = () => {
const
appOF = Application('OmniFocus'),
ds = appOF.documents;
return bindLR(
bindLR(
// Documents ?
ds.length > 0 ? (
Right(ds[0].documentWindows)
) : Left('no docs'),
// Windows ?
ws => ws.length > 0 ? (
Right(ws[0].content.selectedTrees)
) : Left('no windows')
),
// Selection ?
seln => seln.length > 0 ? (
Right(seln.value())
) : Left('no selection')
)
}
// JS - Automation
// standardAdditions :: () -> Application
const standardAdditions = () =>
Object.assign(Application.currentApplication(), {
includeStandardAdditions: true
});
// JS - Prelude
// Left :: a -> Either a b
const Left = x => ({
type: 'Either',
Left: x
});
// Right :: b -> Either a b
const Right = x => ({
type: 'Either',
Right: x
});
// bindLR (>>=) :: Either a -> (a -> Either b) -> Either b
const bindLR = (m, mf) =>
m.Right !== undefined ? (
mf(m.Right)
) : m;
// isLeft :: Either a b -> Bool
const isLeft = lr =>
lr.type === 'Either' && lr.Left !== undefined;
// MAIN
return main()
};
return jxaMain();
})();
The Inbox technically isn’t a “project.” But I have to ask “why put it back in the inbox?”
Maybe put it in a temporary holding project called “Black Hole”. The Black Hole will contain all the items that you are not sure about. It’s a temporary holding area for you. When you are ready to review, visit the Black Hole project and re-assign when you’re ready.
I use the inbox to temporarily catch any new tasks. When I go to the inbox, I purge everything. Every item has a place in your life. If it doesn’t have a place in your life, why bother?
How do you do that in the app ?
- select the Task
- open the Inspector
- select project and press delete key
- select context and press delete key
That puts the task back in the inbox.
But I have to ask “why put it back in the inbox?”
I often have tasks in agenda lists that after talking to the person need new clarification whether it became a action for me or simply some reference material. My workflow today is that I move those items back to the Inbox. I usually clean up my agenda lists during the weekly review, but if I don’t want to wait till then to clarify it again I move them back since I empty this daily. Creating a dedicated project for that wouldn’t help me necessarily as I’d like to go to just one place for my daily processing which is already the OF Inbox
FWIW, I use this script to duplicate tasks to the Inbox (it only preserves .name property).
Thanks! That might be helpful. I’ll tinker with it if I can preserve more attributes than just the name.
Thanks again for you help!
Patrick
1 Like
@unlocked2412 Thanks for the script and idea! Copying the task actually works for me.
Here the script in case somebody else is looking for something similar
var of = Application('OmniFocus');
var ofDoc = of.defaultDocument;
var w = ofDoc.documentWindows()[0];
var contentTree = w.content();
var selectedTrees = contentTree.selectedTrees();
for (var i = 0, len = selectedTrees.length; i < len; i++) {
var task = selectedTrees[i].value();
dctTask = {
name: task.name(),
note: task.note(),
creationDate: task.creationDate()
}
var n = of.InboxTask(dctTask);
ofDoc.inboxTasks.push(n);
task.delete();
}