I sometimes want to attach a common note to multiple related tasks. I can select multiple tasks and adjust project, tags, defer date etc - but cannot seem to enter text into the “Note” window. I can probably work-around by creating a common tag - but an entry in “Note” seems more logical. Any thoughts, suggestions out there? Thanks.
FWIW, with this OmniJS script (OmniFocus 3.5 Test version) you can enter a note in a dialog and apply across selected tasks. Could be run in Script Editor with language tab selected to Javascript.
(() => {
// OMNI JS CODE ---------------------------------------
const omniJSContext = () => {
// main :: IO ()
const main = () => {
const ofSelectedTasksLR = () => {
const selection = document.windows[0].selection.tasks;
return selection.length === 0 ? (
Left('No Selected Tasks')
) : Right(selection)
}
// textDialogPLR :: String -> Promise (Either String String)
const textDialogPLR = strDialog => strLabel => strText => {
const
form = new Form();
form.addField(
new Form.Field.String(
'strField',
strLabel,
strText
)
)
return form
.show(strDialog, 'OK')
.then(
x => Right(
Object.values(x.values)[0]
),
y => Left('User Canceled')
)
}
return textDialogPLR('Attach Note to Selected Tasks')(
'Note'
)('Default Text')
.then(
either(showLog)(
// Fill with OF Data
strNote => bindLR(
ofSelectedTasksLR()
)(
tasks => tasks.map(
task => {
task.note = strNote
return task
}
)
)
)
)
};
// GENERIC --------------------------------------
// https://github.com/RobTrew/prelude-jxa
// 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;
// either :: (a -> c) -> (b -> c) -> Either a b -> c
const either = lf => rf => e =>
e.type === 'Either' ? (
e.Left !== undefined ? (
lf(e.Left)
) : rf(e.Right)
) : undefined;
// showLog :: a -> IO ()
const showLog = (...args) =>
console.log(
args
.map(JSON.stringify)
.join(' -> ')
);
// main
return main()
}
// JXA CONTEXT -----------------------------------------
// standardAdditions :: () -> Application
const standardAdditions = () =>
Object.assign(Application.currentApplication(), {
includeStandardAdditions: true
});
function runOmniJSWithArgs(f) {
const
sa = standardAdditions(),
strURL = 'omnifocus://localhost/omnijs-run?script=',
strCode = encodeURIComponent(
`(${f})(${Array.from(arguments)
.slice(1).map(JSON.stringify)})`
),
omniJSurl = strURL + strCode;
return sa.openLocation(omniJSurl)
}
return runOmniJSWithArgs(
omniJSContext
);
})();
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.