Thursday, November 09, 2006

Templates in the Template editor (revisited)

So after a bit of thought (and some help from the relevant forum) I've come up with a way to use templates in the Coderush Template Editor.
You'll recall my post some several minutes ago where I declared that it would be really useful to be able to execute a template whilst editing another template.

You'll also recall (because it really wasn't so very long ago) that CodeRush, at the time of writing, does not support this.

Well I've found a solution. It's not perfect by any means but it does help quite significantly. It turns out that AutoHotKey mentioned in a previous post is nearly perfect for the job.

It cannot do 'Selection Embedding', but it can do simple text replacement based on HotStrings.

A HotString is like the key sequence that might trigger a CodeRush Template.

In this case, the simple scripts of...
... create 5 HotStrings which expand suitably from one form to another.

Thus << becomes «
and >> becomes »

The difference is that these templates are system-wide and will work in any textbox or word processor.

However there is much that these Templates cannot do.

There is no Linked Identifiers, No simple «Field» switching and I don't appear to be able to set a location for the caret to finish up at.

So while these HotStrings are very useful for setting up «cursor»_«BlockQuote» and «FieldStart»-«FieldEnd» combos, they are entirely incapable of replacing them.

Still they are useful.

No comments: