Change ## to => (or 'Code Snippets' or whatever!)

This forum is user-to-user based and not regularly monitored by IDM.
Please see the note at the top of this page on how to contact IDM.

Change ## to => (or 'Code Snippets' or whatever!)

Postby Davey » Thu Sep 08, 2011 8:57 am

I don't know what to call this so I'll describe it...

In UES Configuration, IDE->IntelliTips->Miscellaneous there is a option to Change ".." to "->"

Is there any way to add extra options to UES? (WeBuilder has something similar which they call 'snippets', although you have to press Ctrl-J in that, which isn't ideal)

I would like to be able to Change "##" to '=>'

---

I wrote the following script to run on pressing the '#' key, but it's not brilliantly elegant and I was hoping there is a better way...

//write the string "=>" to the currently active document
UltraEdit.activeDocument.key("LEFT ARROW");
if (UltraEdit.activeDocument.isChar('#')){
UltraEdit.activeDocument.key("DEL");
UltraEdit.activeDocument.write("=>");
} else {
UltraEdit.activeDocument.key("RIGHT ARROW");
UltraEdit.activeDocument.write("#");
}
Davey
Newbie
 
Posts: 2
Joined: Thu Sep 08, 2011 8:44 am

Re: Change ## to => (or 'Code Snippets' or whatever!)

Postby Mofi » Thu Sep 08, 2011 10:35 am

Well, yes, there is a better method.

Open Advanced - Display/Modify Templates.

Enter as name for your first template for example Insert # and enter as text just #.

Select in the drop down list the next template, enter as name Insert => and enter as text just =>.

Close the dialog with button OK. Now you can insert these templates from the menu Insert, from the Template List view, from a customized toolbar, from within a script or a macro. But that would not be helpful for you.

So open next Advanced - Configuration - Key Mapping, scroll down in the list of commands to InsertTemplate0 and assign the key # to this command. On the next command InsertTemplate1 assign the multi-key ## (one # in upper, one in lower field).

UltraEdit inserts now => when you press quickly ##. But when you just press # and wait the specified time in the key configuration dialog before continue typing, the character # is inserted.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4049
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Change ## to => (or 'Code Snippets' or whatever!)

Postby Davey » Thu Sep 08, 2011 2:36 pm

Excellent, thanks Mofi, that's definitely more elegant and exactly what I wanted.
Davey
Newbie
 
Posts: 2
Joined: Thu Sep 08, 2011 8:44 am


Return to UEStudio General Discussion