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
(() => { | |
'use strict'; | |
/* | |
A JavaScript for Automation script for BBEDIT | |
Cycle the case of selected text :: Mixed -> Upper -> Lower -> Mixed | |
(If the selection is collapsed, the nearest word will be selected) |
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
// A draft JXA library which aims to provide macOS BBEdit | |
// (https://www.barebones.com/products/bbedit/) | |
// | |
// with some of the iOS Drafts 5 (http://getdrafts.com/) | |
// editor functions. | |
// Save this file as '~/Library/Script Libraries/BBDrafts.js' | |
// Rob Trew (c) 2018 |
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. | |
// This is the *whitespace pretty-printed* version |
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 ':--:' |
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
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
// 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
# 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
// 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" |
NewerOlder