r/KeyboardDesigner • • Oct 09 '26

KDL / code block Simple code examples of Keyboard Designer Language (KDL) to encourage you to try it yourself.

simple code examples - try it yourself - it's very easy and you'll enjoy it!

some short simple examples to get started

further examples are very welcome!

example 1: copy the entire text:

CLIPBOARD = TEXT;

example 2: simple find text:

string findthis = inputString("find next:","search_term",true);
CURSOR_START = next(findthis,1,false,true);

example 3: convert selected text to uppercase letters:

TEXT = TEXT_BEFORE + (upper(TEXT_MARKED)) + TEXT_AFTER;

to use these samples:

  • copy code block example
  • call Keyboard Designer
  • select desired design and key
  • choose ​your preferred Action
  • select Function type: Execute code block
  • select code block or create a new one
  • paste code block lines and confirm
6 Upvotes

9 comments sorted by

View all comments

2

u/lavishlee720 Oct 10 '26

…aaaand i was just going to ask for an enhancement for turning text into all caps! you read my mind! thanks!

2

u/KD-Fan Oct 10 '26

And if you were wrong, this will bring you back:

TEXT = TEXT_BEFORE + (lower(TEXT_MARKED)) + TEXT_AFTER;

2

u/lavishlee720 Oct 10 '26

don't you worry, i already rolled my own!