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

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

2
NewbieNewbie
2

    Sep 08, 2011#1

    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("#");
    }

    6,649559
    Grand MasterGrand Master
    6,649559

      Sep 08, 2011#2

      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.

      2
      NewbieNewbie
      2

        Sep 08, 2011#3

        Excellent, thanks Mofi, that's definitely more elegant and exactly what I wanted.