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

Re: little square box  after script runs

Expand Messages
  • acummingsus
    ... (important stuff at/near bottom after Perl while loop stuff) Well, yes. But each iteration of a while loop works/processes one line of a ntb file (unless
    Message 1 of 6 , Sep 29 8:30 PM
    • 0 Attachment
      --- In ntb-scripts@yahoogroups.com, "rpdooling" <rpdooling@y...> wrote:
      > Alan,
      >
      > Following those links of yours, she had another that just ran it on
      > the last line:
      >
      > if (eof && $] > 5.006) {
      > $badchar = chr(26);
      > s/($badchar)$//;
      > }

      (important stuff at/near bottom after Perl while loop stuff)

      Well, yes. But each iteration of a while loop works/processes one
      line of a ntb file (unless file slurp was used). And this iteration
      repeats. And a (key) 1 (TRUE) is returned as long as lines remain in
      the file.

      Then, last line of file gets iterated/processed. And, now, next . . .

      It's, here's how a while loop terminates: after the last line of file,
      a zero (key) is returned. And, what we speak of here about while is:
      "while it's TRUE (we do this process)". In Perl, a zero is false.

      So, at end of script, *after* the closing bracket of the while loop,
      you *are* at end of file. (so there's no need for the eof function
      given the code is either placed or called in child/sub_routine like
      fashion, placed where I mentioned).

      If you do not place the code where I mentioned and instead have it
      further up in the script, then on each loop you are needlessly doing a
      check that tests if it is the end of file (slowing down the script a bit).

      Look at some more of the archive posts. There was a post therein
      where Sheri had queried about how to do it without multiple/repeat
      checking for the end of the file.

      Oh well, maybe you need to repeatedly check. I cannot remember and I
      may be getting mixed up. And I'm on Linux. And Win is not turned on.

      (perhaps this might better) It can be done with clip code at very end
      of clip as in:

      H="clip"
      ^!RunPerl perl_para_moddr
      clip_code_here_2_rid_char_26

      H="_perl_para_moddr"
      perl_code_here
      end_of_perl_code

      Search the clip list archives for char 26 or similar will turn up hits.
      >
      > Do the authorities (Jody et al.) know about this?
      >

      I suspect they know something. What, I do not know. Wouldn't hurt to
      check (I suppose).

      Alan.
    • acummingsus
      ... wrote: [ snip ] ... OR (using Perl to rid char 26) H= clip ^!RunPerl perl_para_moddr ^!clip_code_here_to_*select*_only the last several lines of doc
      Message 2 of 6 , Sep 29 9:18 PM
      • 0 Attachment
        --- In ntb-scripts@yahoogroups.com, "acummingsus" <acummingsus@g...>
        wrote:
        [ snip ]
        > (perhaps this might better) It can be done with clip code at very end
        > of clip as in:
        >
        > H="clip"
        > ^!RunPerl perl_para_moddr
        > clip_code_here_2_rid_char_26
        >
        > H="_perl_para_moddr"
        > perl_code_here
        > end_of_perl_code

        OR (using Perl to rid char 26)

        H="clip"
        ^!RunPerl perl_para_moddr
        ^!clip_code_here_to_*select*_only the last several lines of doc
        ^!RunPerl _pl_badchar26

        H="_perl_para_moddr"
        perl_code_here
        end_of_perl_code

        H="_pl_badchar26"
        #!perl
        $badchar = chr(26);
        while (<>) {
        s/$badchar//;
        }

        (in the substitution) I don't think you need either the parenthesis or
        the extra $ which in this/her/Sheri case the extra $ signify
        end_of_string.

        This latter that I presented is suppose to work in theory due to look
        in help about ^!RunPerl works either a selection of text or the whole
        doc if there's no selected area!!!!

        And (since the last two lines of doc are selected) it
        (H="_pl_badchar26") would only run/work/process only on the last line
        or two of the doc (so, *VERY* quick).

        Alan.
      • rpdooling
        Alan, I m following and learning as I go, and have indeed put the Perl code in a couple of scripts. However, I have concluded that since it s a NoteTab
        Message 3 of 6 , Sep 30 11:09 AM
        • 0 Attachment
          Alan,

          I'm following and learning as I go, and have indeed put the Perl code
          in a couple of scripts. However, I have concluded that since it's a
          NoteTab problem, not a Perl one, I am going to simply add NoteTab code
          to the end of any clip that runs Perl. The ANSI 26 code probably
          doesn't show in this post, but it's there and NoteTab finds it, even
          if you just cut and paste it in.

          ^!Jump TEXT_END
          ^!Replace "" >> "" b

          Thanks!

          Rick


          --- In ntb-scripts@yahoogroups.com, "acummingsus" <acummingsus@g...>
          wrote:
          > --- In ntb-scripts@yahoogroups.com, "acummingsus" <acummingsus@g...>
          > wrote:
          > [ snip ]
          > > (perhaps this might better) It can be done with clip code at very end
          > > of clip as in:
          > >
          > > H="clip"
          > > ^!RunPerl perl_para_moddr
          > > clip_code_here_2_rid_char_26
          > >
          > > H="_perl_para_moddr"
          > > perl_code_here
          > > end_of_perl_code
          >
          > OR (using Perl to rid char 26)
          >
          > H="clip"
          > ^!RunPerl perl_para_moddr
          > ^!clip_code_here_to_*select*_only the last several lines of doc
          > ^!RunPerl _pl_badchar26
          >
          > H="_perl_para_moddr"
          > perl_code_here
          > end_of_perl_code
          >
          > H="_pl_badchar26"
          > #!perl
          > $badchar = chr(26);
          > while (<>) {
          > s/$badchar//;
          > }
          >
          > (in the substitution) I don't think you need either the parenthesis or
          > the extra $ which in this/her/Sheri case the extra $ signify
          > end_of_string.
          >
          > This latter that I presented is suppose to work in theory due to look
          > in help about ^!RunPerl works either a selection of text or the whole
          > doc if there's no selected area!!!!
          >
          > And (since the last two lines of doc are selected) it
          > (H="_pl_badchar26") would only run/work/process only on the last line
          > or two of the doc (so, *VERY* quick).
          >
          > Alan.
        Your message has been successfully submitted and would be delivered to recipients shortly.