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

  1. !!Script
  2. // Copyright ⌐ 2000 - Modelworks Software
  3.  
  4. /**
  5. @Tool: findMatchingParen~find the matching closing paren. 
  6. @EndTool: 
  7. @Summary: findMatchingParen~find the matching closing paren
  8. */
  9.  
  10. function DoCommand()
  11. {
  12.     var editor = getActiveEditor();
  13.     if (editor)
  14.     {
  15.         var selection = editor.getSelection();
  16.         var delimiter = editor.copy(selection);
  17.         if (delimiter == '(')
  18.         {
  19.             var list = editor.findNextDelimiters('(', ')', 
  20.                 selection.startLineIndex, selection.startCharIndex);
  21.             
  22.             if (list)
  23.             {
  24.                 var range = list.removeHead();
  25.                 editor.select(range);
  26.             }
  27.         }
  28.         else
  29.         {
  30.             alert("To use findMatchingParen first select the opening paren");
  31.         }
  32.     }
  33. }
  34.  
  35. !!/Script
  36.  
  37.