A script which counts the number of words in the front Bike document:
In Script Editor, with the language drop-down at top-left set to JavaScript
, you can test the code below, which gives a message like:
"208472 words in Moby Dick.bike"
(() => {
"use strict";
// Word count for Bike
// Rob Trew @2022
// Ver 0.1
const
bike = Application("Bike"),
frontDoc = bike.documents.at(0),
space = /\s+/gu;
return frontDoc.exists(0) ? (() => {
const
n = frontDoc.rows.name()
.join(" ")
.split(space)
.length;
return `${n} words in ${frontDoc.name()}`;
})() : "No documents open in Bike.";
})();
You could also drop it into an Execute JavaScript for Automation action in Keyboard Maestro, and choose a hotkey trigger for it:
BIKE : rough word count.kmmacros.zip (1.6 KB)
See: Customizing Bike