Loading ...
Sorry, an error occurred while loading the content.

TOC generetor adapted for pTools

Expand Messages
  • fjmancho
    Hi peditors: I have adapted this TOC generetor for pTools (*not-pedit*) users following the ideas and tips of John and Klinda in the forum. I have now tested
    Message 1 of 4 , Jul 16, 2008
    • 0 Attachment
      Hi peditors:


      I have adapted this TOC generetor for pTools (*not-pedit*) users following the ideas and tips of John and Klinda in the forum. I have now tested it for some months in my T3. I would like to know other users experience before posting it at peditors.com

      There are two scripts. The first one generates the TOC and the second one works as a jumper.

      a. TOC generator: It checks whether you have or not a previous table of contents (if so, it deletes it) and generates a new table of contents and places it at the begining of the text. The user must decide which are the lines for the TOC by marking them with' (ascii 39).

      b. Jumper: It takes you from a specific point in the TOC section to that specific point in the text.


      If you are a PsLink user, you will most likely want to jump using PsLink tags. In that case, you don't need the jumper (at least for memos).

      The scirpt works with text files, proved you are not jumping over too long text sections. (I have tested it on CardTEXT).

      NOTE THAT there is a small requirement before you run the scirpt: You need to configure 2 "favorite texts" in pSearchTool. For that you may follow this steps:
      a. Call pSearchTool
      b. Type, say, 1 in the "Find text field" (1 or whatever number, or letter you type, will be the way of calling this configuration by the script. There should not be other "favorite" search starting by 1 or the character you have actually chosen)
      c. UNCHECK all the possiblilities ("ignore case", "use REGEXP", "start at top", "within words")
      d. Press AddFav button
      e. Add a second "favorite text": 2 in the "find text field"; "use REGEXP" and "min match" check boxes selected.

      ALSO NOTE that there are three conventional marks with which the script operates:

      ­ (ascii 173): placed below the first line in the memo, it indicates that a TOC is actually present (and the script will delete it). The pScript takes care of it.

      ' (ascii 39): it must be inserted at the begining of the lines you want to add to the TOC. The lines will be highlited by the script and incorporated to the Table of Contens.

      _____***_____; it indicates the end of the TOC. The TOC generetor itself produces it in the process of the script.



      a. TOC generetor



      {TOCgen0::/GZ
      /&specAct[237] /*DIA off*/
      /&varSet@[$1,0]
      /&varSet@[$2,-1]
      /eh
      /&specAct[10]S4. /*selects 1st line*/
      /&script$[@@TOCgen1@@]}
      {TOCgen1:: /* adds 1st line and begining of the TOC to $A varible*/
      /K /Kq /xn­/xn /xt/xt-----TOC-----/xn /K. /K2cA /p8/p29
      /&script$[@@TOCgen2@@]}

      {TOCgen2:: /*it checks whether there is previous TOC (ascii 173)*/
      /e@ /&ifScript@ [$$==173,@@TOCgen3@@]/&script$[@@TOCgfind1@@]}

      {TOCgen3:: /*deleting previous TOC*/
      /&specAct[8]/xEpst F0/p10 / _____***_____/xEpst fd
      /&script$[@@TOCgen4@@]}

      {TOCgen4::/&specAct[10]S6. /&script$[@@TOCgen5@@]}
      {TOCgen5:: /Ki /K /xs /!/KP /&script$[@@TOCgen51@@]}
      {TOCgen51:: /p8 /&script$[@@TOCgfind1@@]}


      {TOCgfind1:: /*finding ' at line start and adding lines to variable $A*/
      /&specAct[8] /xEpst F2/p10 ^'
      /&script$[@@TOCgfind2@@]}
      {TOCgfind2:: /xEpst f /&script$[@@TOCgfind3@@]}
      {TOCgfind3:: d/p29 /&script$[@@TOCgfind4@@]}
      {TOCgfind4:: /*if decission to print*/
      /!/$c /&varSet@[$1,$$]
      /&ifScript@ [$1<=$2, @@TOCprint@@]/&script$[@@TOCgfind5@@]}
      {TOCgfind5::/&varSet@[$2,$1] /&specAct[10]S4./&script$[@@TOCgfind6@@]}
      {TOCgfind6:: /K@ /Kq /xn /K. /K2aA /p29 /&script$[@@TOCgfind7@@]}
      {TOCgfind7:: /*it calls pSearch again and goes to TOCgfind2*/
      /&specAct[8] /&script$[@@TOCgfind2@@]}


      {TOCprint:: /*adding end of TOC and printing it*/
      /eh /K /K4cA /xn /xt/xt_____***_____ /KP/xz}


      If you have PsLink, the TOC might consist in bookmark links.
      TOCgfind6 should be in this case:

      {TOCgfindM6:: /Ki /K@ ·° /KQ · /xn /K. /K2aA /p29 /&script$[@@TOCgfindM7@@]}


      In this case ° stand for your "bookmark" tag in PsLink and · should be your tag for Memo in PsLink.

      b. JUMPER

      {TOCjump0::/GZ/&specAct[10]S4.
      /&script$[@@TOCjump1@@]}
      {TOCjump1:: /Kq /Kc /&script$[@@TOCjump2@@]}
      {TOCjump2:: /&specAct[8]
      /xEpst F1/p10
      /xc P
      /xEpst f
      /xEpst d /xz}


      Regards

      Jose
    • fjmancho
      There is *another requirement* to be taken into account: pTextTool should be set up to continue mode (just check S menu) Hi peditors: I have adapted this TOC
      Message 2 of 4 , Jul 16, 2008
      • 0 Attachment
        There is *another requirement* to be taken into account: pTextTool should be set up to continue mode (just check S menu)





        Hi peditors:


        I have adapted this TOC generetor for pTools (*not-pedit*) users following the ideas and tips of John and Klinda in the forum. I have now tested it for some months in my T3. I would like to know other users experience before posting it at peditors.com

        There are two scripts. The first one generates the TOC and the second one works as a jumper.

        a. TOC generator: It checks whether you have or not a previous table of contents (if so, it deletes it) and generates a new table of contents and places it at the begining of the text. The user must decide which are the lines for the TOC by marking them with' (ascii 39).

        b. Jumper: It takes you from a specific point in the TOC section to that specific point in the text.


        If you are a PsLink user, you will most likely want to jump using PsLink tags. In that case, you don't need the jumper (at least for memos).

        The scirpt works with text files, proved you are not jumping over too long text sections. (I have tested it on CardTEXT).

        NOTE THAT there is a small requirement before you run the scirpt: You need to configure 2 "favorite texts" in pSearchTool. For that you may follow this steps:
        a. Call pSearchTool
        b. Type, say, 1 in the "Find text field" (1 or whatever number, or letter you type, will be the way of calling this configuration by the script. There should not be other "favorite" search starting by 1 or the character you have actually chosen)
        c. UNCHECK all the possiblilities ("ignore case", "use REGEXP", "start at top", "within words")
        d. Press AddFav button
        e. Add a second "favorite text": 2 in the "find text field"; "use REGEXP" and "min match" check boxes selected.

        ALSO NOTE that there are three conventional marks with which the script operates:

        ­ (ascii 173): placed below the first line in the memo, it indicates that a TOC is actually present (and the script will delete it). The pScript takes care of it.

        ' (ascii 39): it must be inserted at the begining of the lines you want to add to the TOC. The lines will be highlited by the script and incorporated to the Table of Contens.

        _____***_____; it indicates the end of the TOC. The TOC generetor itself produces it in the process of the script.



        a. TOC generetor



        {TOCgen0::/GZ
        /&specAct[237] /*DIA off*/
        /&varSet@[$1,0]
        /&varSet@[$2,-1]
        /eh
        /&specAct[10]S4. /*selects 1st line*/
        /&script$[@@TOCgen1@@]}
        {TOCgen1:: /* adds 1st line and begining of the TOC to $A varible*/
        /K /Kq /xn­/xn /xt/xt-----TOC-----/xn /K. /K2cA /p8/p29
        /&script$[@@TOCgen2@@]}

        {TOCgen2:: /*it checks whether there is previous TOC (ascii 173)*/
        /e@ /&ifScript@ [$$==173,@@TOCgen3@@]/&script$[@@TOCgfind1@@]}

        {TOCgen3:: /*deleting previous TOC*/
        /&specAct[8]/xEpst F0/p10 / _____***_____/xEpst fd
        /&script$[@@TOCgen4@@]}

        {TOCgen4::/&specAct[10]S6. /&script$[@@TOCgen5@@]}
        {TOCgen5:: /Ki /K /xs /!/KP /&script$[@@TOCgen51@@]}
        {TOCgen51:: /p8 /&script$[@@TOCgfind1@@]}


        {TOCgfind1:: /*finding ' at line start and adding lines to variable $A*/
        /&specAct[8] /xEpst F2/p10 ^'
        /&script$[@@TOCgfind2@@]}
        {TOCgfind2:: /xEpst f /&script$[@@TOCgfind3@@]}
        {TOCgfind3:: d/p29 /&script$[@@TOCgfind4@@]}
        {TOCgfind4:: /*if decission to print*/
        /!/$c /&varSet@[$1,$$]
        /&ifScript@ [$1<=$2, @@TOCprint@@]/&script$[@@TOCgfind5@@]}
        {TOCgfind5::/&varSet@[$2,$1] /&specAct[10]S4./&script$[@@TOCgfind6@@]}
        {TOCgfind6:: /K@ /Kq /xn /K. /K2aA /p29 /&script$[@@TOCgfind7@@]}
        {TOCgfind7:: /*it calls pSearch again and goes to TOCgfind2*/
        /&specAct[8] /&script$[@@TOCgfind2@@]}


        {TOCprint:: /*adding end of TOC and printing it*/
        /eh /K /K4cA /xn /xt/xt_____***_____ /KP/xz}


        If you have PsLink, the TOC might consist in bookmark links.
        TOCgfind6 should be in this case:

        {TOCgfindM6:: /Ki /K@ ·° /KQ · /xn /K. /K2aA /p29 /&script$[@@TOCgfindM7@@]}


        In this case ° stand for your "bookmark" tag in PsLink and · should be your tag for Memo in PsLink.

        b. JUMPER

        {TOCjump0::/GZ/&specAct[10]S4.
        /&script$[@@TOCjump1@@]}
        {TOCjump1:: /Kq /Kc /&script$[@@TOCjump2@@]}
        {TOCjump2:: /&specAct[8]
        /xEpst F1/p10
        /xc P
        /xEpst f
        /xEpst d /xz}


        Regards

        Jose
      • John Markley
        Hi Jose - ... ... Using the favorites to control the checkboxes as you have done is more efficient of pScript space for sure. I just want to point
        Message 3 of 4 , Jul 16, 2008
        • 0 Attachment
          Hi Jose -

          Quoting fjmancho <fjmancho@...>:

          > Hi peditors:
          >
          >
          > I have adapted this TOC generetor for pTools (*not-pedit*) users
          > following the ideas and tips of John and Klinda in the forum. I have
          > now tested it for some months in my T3. I would like to know other
          > users experience before posting it at peditors.com


          <<SNIP>>

          > NOTE THAT there is a small requirement before you run the scirpt:
          > You need to configure 2 "favorite texts" in pSearchTool. For that
          > you may follow this steps:
          > a. Call pSearchTool
          > b. Type, say, 1 in the "Find text field" (1 or whatever number, or
          > letter you type, will be the way of calling this configuration by
          > the script. There should not be other "favorite" search starting by
          > 1 or the character you have actually chosen)
          > c. UNCHECK all the possiblilities ("ignore case", "use REGEXP",
          > "start at top", "within words")
          > d. Press AddFav button
          > e. Add a second "favorite text": 2 in the "find text field"; "use
          > REGEXP" and "min match" check boxes selected.
          >

          Using the favorites to control the checkboxes as you have done is
          more efficient of pScript space for sure. I just want to point out
          for other users that there is another way to do the same thing without
          using the favorites. Paul has thoughtfully made *two* tokens for each
          checkbox, one a "check it on" switch, and one a toggle. Using the
          "on" token (an upper case letter) always results in the box checked
          on, regardless of its initial state. Combining the "on" token
          followed by the "toggle" token (same letter in lower case) results in
          the box being unchecked regardless of the initial state. So you could,
          instead of your favorite #1, put into the pScript the following -

          /xEpst I/xEpst i
          /xEpst S/xEpst s
          /xEpst U/xEpst u
          /xEpst W/xEpst w

          which results in all the boxes unchecked. For favorite #2 it would be

          /xEpst U/xEpst M

          The info about what letter does what is in the on-board info in
          pSearchTool by tapping the info "i" icon top right of the pSearchTool
          screen.

          ~ John
        • fjmancho
          ...... Original Message ....... ... I didn t know and it seems a good idea Joseph
          Message 4 of 4 , Jul 16, 2008
          • 0 Attachment
            ...... Original Message .......
            On Wed, 16 Jul 2008 12:18:42 -0400 John Markley <jmmjr@...> wrote:
            >Paul has thoughtfully made *two* tokens for each
            >checkbox, one a "check it on" switch, and one a toggle.


            I didn't know and it seems a good idea




            Joseph
          Your message has been successfully submitted and would be delivered to recipients shortly.