This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Apr 9, 2016, 4:38 PM
453 Posts

assign a String to a key stroke

  • Category: Other
  • Platform: All
  • Release: 9.0.1
  • Role: Developer
  • Tags:
  • Replies: 9

When I create a new event I generally always (well almost always) enter a set block of code like say

try{

}catch(e){

//Error Message

}

so in the script editor I would like to assign this block of text to say <ctrl><Alt><B> or ???

I have searched through the Designer Preferences but can't find any place to assign something like this. Would sure save a lot of time as there are several block structures that I use regularly and would be a great assist to be able to assign them to some key strokes. 

Apr 9, 2016, 11:30 PM
586 Posts
hmmm

Is this Java or SSJS?  In Java this is built into the editor that you can "Surround code" by right clicking on the context menu.

In designer there is also the ability to have "Snippets" though that might be Java only as well.

 

Honestly if you want to have a key stroke equal something like this, I likely just need a third party app.  There's a bunch out there and all they do is something like this.  People use them in Word processing for signatures and all that.  That's probably your best bet.

Apr 10, 2016, 5:49 PM
453 Posts
Trying AutoHotKey

I just downloades AutoHotKey which really looks like overkill for what I need but appears to do what I need.

Apr 10, 2016, 9:24 PM
453 Posts
AutoHotKey might need so tweaking to work here, but it works fine in the Eclipse JS Editor

I try to set up Script blocks like this

try{

var debug:Boolean = false

}catch(e){

//My error trap

}

so I created this script for an <Alt><b>

!b::
send, try {{}`n
send,  `tvar debug:Boolean = false;`n
send, `n
send, `n
send, {}}catch(e){{}`n
send,  `tWFSUtils.sysOut("" {+} e.toString());`n`n
send, {}}`n
Return

works like a charm going to save a lot of time and spelling/case goofups.

Tried the <Alt><b> in here and the results are above, so key stroke must be unique, but you can set up pretty much any combination you want. <alt><b> is probably not a good choice probably will change that to <Ctrl><Alt><b> or something like that.

Apr 12, 2016, 2:02 PM
298 Posts
Code Snippets
Go to Window, Show Eclipse Views, Other. Search for Snippets and open the code snippets. Right click on the new view and use customize to create/edit the snippets.


This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal