1

As an example, I have written a simple rule to camelCase text. It uses the following spec:

spec="camel case <txt>"

which correctly modifies the text said after the command 'camel case'.

But this still isn't as flexible as built-in commands like "Capitalise That" are.

For example, "Capitalise That" can be used to operate on the text currently selected by the mouse. That makes it very easy to edit existing code.

Can this functionality be achieved in dragonfly?

1 Answers1

0

Yes, but you'll have to get creative. Use a Dragonfly Function Action to press keys to highlight the text you want to capitalize. (For example, Shift-Right or Control-Shift-Left.) While still in the function called by the Function Action, read the text by sending keys for Control-C, then getting the contents of the clipboard. Then you can modify it however you want and print it back out.

synkarius
  • 324
  • 1
  • 8
  • Thanks – I can see how that could work for the specific case of capitalising the selected text, albeit a little brittlely. Clearly DNS underneath the hood has a more flexible mechanism for generically dealing with the 'that' in 'capitalize that', as 'that' can refer to either recently written text, or selected text. It's a pity that in dragonfly we have to 'hand hack' each of these mechanisms separately, but its better than nothing. Thanks for clarifying! – Fergal Reid Mar 30 '16 at 14:38
  • It is brittle, but DNS tracks state whereas Dragonfly does not. I didn't mention this because you were specifically asking about Dragonfly, but I maintain a Dragonfly project called Caster, which adds a bunch of advanced Dragonfly actions and a few other goodies to the mix, including "ContextSeeker", an action which is able to look back at the previous thing you said (provided that the previous thing you said is a command and not free dictation -- none of the Natlink frameworks will remember free dictn) and act on the last spoken command. More info [here](https://github.com/synkarius/caster). – synkarius Mar 31 '16 at 21:45