Skip to content

Instantly share code, notes, and snippets.

View doug4j's full-sized avatar

Doug Johnson doug4j

View GitHub Profile
var app = Application('OmniFocus');
app.includeStandardAdditions = true;
var doc = app.defaultDocument;
var rootTags = getActiveRootOrderedTags(doc)
app.displayDialog(tagsNamesAsString(rootTags))
function getActiveRootOrderedTags() {
var allTags = doc.flattenedTags();
var answer = ""
var answer = []
// jshint esversion:6
(function() {
var app = Application("OmniFocus"); //This assumes that OmniFocus is installed on MacOS
app.includeStandardAdditions = true;
var doc = app.defaultDocument;
var perspectiveName = doc.documentWindows.at(0).perspectiveName();
if (perspectiveName != "Projects") {
app.displayDialog("[Error] Selected prospective must be 'Projects'");
return;
//Modified from https://discourse.omnigroup.com/t/creating-a-new-task-with-javascript-for-automation-jxa/22393/2
var app = Application('OmniFocus');
app.includeStandardAdditions = true;
var doc = app.defaultDocument;
var newTask = app.InboxTask({
name: 'sample task',
note: 'a note',
});
app.quickEntry.inboxTasks.push(newTask);
var projName = "My First Auto-created Project";
var app = Application("Omnifocus")
app.includeStandardAdditions = true
var doc = app.defaultDocument
var matchingProjects = doc.flattenedProjects.whose({name: projName})
var theProject = null
if (matchingProjects.length == 0) {
theProject = app.Project({
name: projName,
The PowerPanel for Linux software is major help system to monitor UPS, which support USB and serial port.
The pwrstatd program will run as a daemon process, it startups since system is booting.
The pwrstatd is major to communicate with UPS and to help system to do graceful shutdown while the power events is aware.
The other program called pwrstat, it helps user to get status of the UPS and settings of the pwrstatd daemon.
It also allows user to configure the UPS and pwrstatd daemon.
//Also see question and answer at https://discourse.omnigroup.com/t/add-a-new-task-and-set-the-project-it-belongs-to-via-javascript-of3/44111
var app = Application('OmniFocus');
app.includeStandardAdditions = true;
var doc = app.defaultDocument;
var content = doc.documentWindows.at(0).content;
var selectedTree = content.selectedTrees();
var selectedLen = selectedTree.length
var proj = null
// jshint esversion:6
(function() {
var start = new Date().getTime();
var app = Application('OmniFocus'); //This assumes that OmniFocus is installed on MacOS
app.includeStandardAdditions = true;
var doc = app.defaultDocument;
var content = doc.documentWindows.at(0).content;
var selectedTree = content.selectedTrees();
var selectedLen = selectedTree.length;