home *** CD-ROM | disk | FTP | other *** search
/ PC User 2001 August / APC_Aug2001_CD2.iso / features / web_dev / files / mwjpp516.exe / %MAINDIR% / Tools / Smartkeys / completeParenthesis.script < prev    next >
Encoding:
Text File  |  2001-06-19  |  958 b   |  36 lines

  1. !!Script
  2. // Copyright ⌐ 1997-1998 - Modelworks Software
  3.  
  4. /**
  5. @Tool: completeParenthesis~inserts a closing parenthesis and places 
  6. the caret between the opening and closing parenthesis. Defined for all file types. 
  7. Typing <code>(<tab></code> results in:
  8. <code> (<caret>)</code>
  9. @EndTool: 
  10. @Summary: completeParenthesis~inserts a closing parenthesis 
  11. */
  12.  
  13. function DoCommand()
  14. {
  15.   var path = File.getToolsPath() + "\\Smartkeys\\completeParenthesis.script";
  16.   Application.registerSmartKeyHandler("*", "(\t", path, 
  17.     "Complete: (<tab> with ()");
  18. }
  19.  
  20. function OnEvent(editor,lineBuffer)
  21. {
  22.   var selection = editor.getSelection();
  23.   editor.insert(selection.startLineIndex, selection.startCharIndex, 
  24.     ")");
  25.  
  26.   editor.select(selection.startLineIndex, selection.startCharIndex, 
  27.     selection.startLineIndex, selection.startCharIndex);
  28.     
  29.   editor.setActive("Complete Parenthesis");
  30.   return true;
  31. }
  32.  
  33. !!/Script
  34.  
  35.  
  36.