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

Re: little square box  after script runs

Expand Messages
  • rpdooling
    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)$//; } Do the
    Message 1 of 6 , Sep 29 7:18 PM
    • 0 Attachment
      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)$//;
      }

      Do the authorities (Jody et al.) know about this?

      Thanks so much, again, for the code. I've noticed it does not happen
      on some scripts. I'll keep reading those other messages.

      Rick

      --- In ntb-scripts@yahoogroups.com, "acummingsus" <acummingsus@g...>
      wrote:
      > if ($] > 5.006) {
      > $badchar = chr(26);
      > s/($badchar)$//;
      > }
      >
      > That, by Sheri, rids it. (either called at end or used as very last
      > part of your script)
      >
      > Grant explains the issue:
      >
      > http://groups.yahoo.com/group/ntb-scripts/message/202
      >
      > I agree with Grant. Also I think it is Notetab more than anything
      > else and that it coincides with ntb doesn't have full, 100% unicode
      > support unless I'm mistaken.
      >
      > ntb didn't do this with Perl 5.6.X
      >
      > ntb char 26 issue began when Perl 5.8.X came out. Perl 5.8.X has
      > improved unicode support above/over what Perl 5.6.X had.
      >
      > I've Perl script tool/macro used with other editors on Win, these
      > editors don't have the issue. Notetab is the only one that does this
      > char 26 for me.
      >
      > http://groups.yahoo.com/group/ntb-scripts/message/310
      >
      >
      http://groups.yahoo.com/group/ntb-scripts/messagesearch?query=character%2026
      >
      >
      http://groups.yahoo.com/group/ntb-scripts/messagesearch?query=character%2026
      >
      > Alan.
      >
      > --- In ntb-scripts@yahoogroups.com, "rpdooling" <rpdooling@y...> wrote:
      > > I'm sure this is something I should know, but I don't.
      > >
      > > When I run a Perl script in NoteTab, any script, even Numlines, as
      > > near as I can tell, I get a little square box added to my text after
      > > the script runs. Like so I don't know what it will look like when
      > > I post this.
      > >
      > > Anyone know what that could be?
      > >
      > > It's there whether I turn on invisible characters or not.
      > >
      > > Thanks,
      > >
      > > Rick
    • 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 2 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 3 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 4 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.