Monday November 1, 2021; 10:55 PM EDT
- (I've decided to call Drummer's scripting language "Drumkit" until Dave picks a better one.)#
- Update: See here for additional context.#
- Since keyboard commands are iffy on the iPad, I figure I'll need a way to do things with the selected text, so I poke around the DW menu and there's an example using a verb that looks close, op.getLineText(). #
- Normally with Drumkit snippets you just put them on a node by themselves and hit command-slash and Drummer runs it. But to test something that uses the current selection, you need a different way to call the script. #
- So, enable the Scripts menu, and add the command there. Highlight a node in the outline, select Get Line Text from my new menu command, and voila, it works. In fact, you can test it on the entry in the Scripts menu itself. I love things like that.#
- So, pull up Docserver and go looking for something that will get me the selection. It's got to be possible because Drummer has a "make link" icon. And there it is, op.getSelectedText(). Add that as a new command to the Scripts menu, and... the dialog box is empty, no text at all. I was all set to file a bug, but while getting repro steps—absolutely the most critical part of reporting any bug—I realized what was going on. When you tap on the Scripts menu, that takes the selection focus away from the outline, so by the time the script runs, there's nothing to select. So I can't really report that as a bug.#
- But I still want to be able to do it, so let's try putting it in the Iconbar. I have no idea what icon names are available, but the top one is a big plus sign. Turns out, we do in fact have an icon named "minus", and my new "click the minus sign to show an alert dialog with the highlighted text" feature I just added to Drummer works great!#
- It is going to be weird working in an outliner for code, but for short snippets I think I can get used to it. For longer stuff I think I will probably still prefer a full IDE. #