Text Manipulation Functions?

Hi all—

I'd like to find a way for KM to type the first 6 characters of a variable (but not the full variable) into a field. (So if the variable has been assigned the value "ABCDEFGHIJKLMNOPQRSTUVWXYZ," I'd like KM to type "ABCDEF.") In a spreadsheet I might use a LEFT() function to achieve this, but I don't see any likely candidates in the KM functions list.

Am I missing a function? Any other clever ways to get that to happen?

Thanks in advance!


Try the Substring action documented in the wiki here: https://wiki.keyboardmaestro.com/action/Substring_of_Variable_or_Clipboard

That’ll get you the characters you want then to work with.


So it will! Thanks so much, tiffle!

Hey David,

The SubString action is very useful, although I'll nearly always opt for a regular expression myself.

Just 'cause I can.  :sunglasses:


Get Substring of String on the Clipboard.kmmacros (5.4 KB)

Just 'cause I can. :sunglasses:

Cue the Edsger Dijkstra question

Are you quite sure that all those bells and whistles ... belong to the solution set rather than the problem set?

: -)

Yes; quite.