selectRange(int,int)

Parent Previous Next

TwScript:   TW.target.selectRange(int, int)


Position the cursor at the int position from the beginning of the document, and then selects as much text as indicated by the second integer.


TW.target.selectRange(100, 20);


If the text is available, would select twenty characters starting ant the 100th character of the document.


To merely position the cursor at a position from the beginning of the document see selectRange(int)



Example Using Propriety Latex Macro


 txt = TW.target.selection;

 

 if (txt == "")

   {txt = "Write Heading"}


TocLevel =  TW.getItem( null, "TOC Level", "0 - none,\n1 - section,\n2 - subsection ,\n3 - subsubsection", ["0","1","2","3"] , 1 , true ) ;


if (TocLevel != undefined)

 {

  TW.target.insertText("\n%{fontsize}{fontleading}{text}{Toc Level (1 = section) - 1,2,3}\n\\centreHeadToc{13}{15}{" + txt + "}{" + TocLevel + "}");

 

 TW.target.selectRange(TW.target.selectionStart - 4 - txt.length, txt.length);

 

  }

 

  null;



LaTeX



Created with the Personal Edition of HelpNDoc: Easily create HTML Help documents