layo
1
The attached macro is part of a larger macro that outputs text in CSV format. Is it possible to convert the text from CSV to sentence.
Therefore, instead of this being copied to clipboard:
Bay-breasted Warbler,Blackpoll Warbler,Black-throated Blue Warbler
This should be copied to clipboard (space after comma, and, full stop):
Bay-breasted Warbler, Blackpoll Warbler and Black-throated Blue Warbler.
sentence.kmmacros (1.5 KB)
Putting aside preference for or against Oxford commas, my personal habit is to write this kind of thing:
Sentence from CSV.kmmacros (3.5 KB)
Expand disclosure triangle to view JS source
const
xs = (kmvar.local_CSV || "").split(","),
n = xs.length;
return 1 < n
? `${xs.slice(0, -1).join(", ")} and ${xs[n - 1]}.`
: kmvar.local_CSV;
but you should also be able to do it with Keyboard Maestro variable arrays:
manual:Variable Arrays [Keyboard Maestro Wiki]