Skip to content

Instantly share code, notes, and snippets.

@astyagun
Last active June 4, 2020 10:48
Show Gist options
  • Save astyagun/4b59dcf04af80bb32c4198b169e54f0a to your computer and use it in GitHub Desktop.
Save astyagun/4b59dcf04af80bb32c4198b169e54f0a to your computer and use it in GitHub Desktop.
Добавить действие "Запланировать следующее действие" с контекстом "Мак"
/*{
"author": "Anton Styagun",
"targets": ["omnifocus"],
"type": "action",
"identifier": "com.antonstyagun.planNextAction",
"version": "0.1",
"description": "Добавить действие \"Запланировать следующее действие\" с контекстом \"Мак\"",
"label": "Запланировать следующее действие",
"mediumLabel": "Запланировать следующее действие",
"paletteLabel": "Запланировать следующее действие",
}*/
// https://gist.github.com/astyagun/4b59dcf04af80bb32c4198b169e54f0a
(() => {
let action = new PlugIn.Action(function(selection) {
new Task('Запланировать следующее действие', taskInsertionPosition(selection)).addTag(tagNamed("Мак"));
});
action.validate = function(selection){
return app.platformName == 'macOS';
};
return action;
})();
function taskInsertionPosition(selection) {
if(selection.projects.length > 0)
return selection.projects[selection.projects.length - 1];
else if(selection.tasks.length > 0)
return selection.tasks[selection.tasks.length - 1].after;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment