Skip to content

Instantly share code, notes, and snippets.

View doug4j's full-sized avatar

Doug Johnson doug4j

View GitHub Profile
// 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;
//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
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.
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,
//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);
// 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;
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 = []
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
if (selectedLen == 0) {
//app.displayDialog("Nothing selected in Omnifocus");
} else {
// jshint esversion:6
(function() {
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;
-- Modified from: http://bylr.net/3/2011/07/omnifocus-script-get-total-time-of-selected-items/
on main()
tell application "OmniFocus"
tell content of first document window of front document
--Get selection
set totalMinutes to 0
set validSelectedItemsList to value of (selected trees where class of its value is not folder and class of its value is not tag)
set totalItems to count of validSelectedItemsList
if totalItems is 0 then