This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Ver 0.2 | |
// Restores syntax highlighting by recompiling | |
// either restoring cursor or placing it at first error found | |
// Assumes installation of node.js | |
// http://nodejs.org/download/ | |
// with npm at: | |
var pathNPM = '/usr/local/bin'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function run() { | |
// KEYBOARD MAESTRO VARIABLES IN YOSEMITE JXA JAVASCRIPT FOR APPLICATIONS | |
// FINDING, CREATING, READING, UPDATING | |
// SIMPLE EXAMPLE - TOGGLING A BOOLEAN KM VARIABLE FROM .js | |
var strKMVarName = "flag"; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function run() { | |
// Rob Trew 2015 | |
// Ver 0.01 | |
// UI day/night toggling through OS X 10.10 JXA Javascript for Automation | |
// SWITCH FROM DAY-TIME DARK MENU BAR AND DOCK WITH DARK BACKGROUND | |
// TO NIGHT-TIME *ALL DARK* | |
// (TOGGLE MODE AND BACKGROUND TO BRIGHT, THEN INVERT ALL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Rob Trew @complexpoint 2015 | |
function run() { | |
"use strict"; | |
var blnUseKeyboardMaestro = false; | |
// EDIT TO NAMES OF TWO ALTERNATIVE SOUND OUTPUT DEVICES | |
var dctSources = { // A unique substring for each is enough | |
primary: "Internal", | |
secondary: "Elgato" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# An lf command in my ~/.bash_profile | |
# like a simple ls, but selects the glob-matched files in the Finder | |
# `lf *.txt` to Finder-select all *.txt files in the working directory | |
# `lf *.[^t]?? to Finder-select all files with a 3-char extension which doesn't start with t | |
lf() { | |
local IFS=":"; local f=$@; local seln=""; fldr="$(pwd)" | |
for l in ${f[@]}; do | |
if [[ ! -d $l ]]; then | |
seln=$seln"file \"$l\", " | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// YOSEMITE Javascript for Applications JXA | |
// Capture the main result links from a Google search page as Markdown | |
// ( Using XPath to search for <a> elements which are children | |
// of elements with class 'r' | |
var resultLinksMD = function () { | |
var r = document.evaluate( | |
"//*[@class='r']/a", | |
document, null, 0, null | |
), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set strJS to " | |
var xpathResults = document.evaluate('//*[@class=\\'r\\']/a', document, null, 0, null), | |
lst = [], | |
oNode; | |
while (oNode = xpathResults.iterateNext()) { | |
lst.push([ | |
'[', | |
oNode.text, | |
'](', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
'use strict'; | |
// OSX JavaScript for Applications lacks the persistent 'properties' | |
// of AppleScript (in which global variables and properties persist between script runs) | |
// but we can, of course, serialise to JSON or plist at the end of a script | |
// parsing it at the start of the next run. | |
// Here is one approach to persistence between script runs | |
// using JSON.stringify() and JSON.parse() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
((options) => { | |
'use strict'; | |
// (NB JavaScript for Automation – JXA: Save as .scpt ) | |
// Selected DEVONthink Sheet -> DEVONthink markdown record (MMD table) | |
// (New record containing MMD table created is same group as selection) | |
// Uses original fileName stem, with '.md' appended. | |
// Default alignment string is centered ':--:' |