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

Odd Find Behavior

Expand Messages
  • dhayes@liveonthenet.com
    I used the FIND ^%NAG% IST command in a clip to find text in a document. NAG was set to $142 with a leading space as shown. However, the highlighted text
    Message 1 of 14 , Apr 15, 2001
      I used the FIND ^%NAG% IST command in a clip to find text in a
      document.

      NAG was set to " $142" with a leading space as shown. However, the
      highlighted text found was "$142" without a leading space in the
      example document shown below.

      blah blah blah $142 blah blah blah

      Why was the leading space *not* included in the highlighted text as a
      result of the find process?
    • Jody
      Hi dhayes, Try it again. I was able to do it here. Perhaps you had an option set that you did not realize or the space was not in your search criteria. ...
      Message 2 of 14 , Apr 15, 2001
        Hi dhayes,

        Try it again. I was able to do it here. Perhaps you had an
        option set that you did not realize or the space was not in your
        search criteria.

        >I used the FIND ^%NAG% IST command in a clip to find text in a
        >document.
        >
        >NAG was set to " $142" with a leading space as shown. However,
        >the highlighted text found was "$142" without a leading space in
        >the example document shown below.
        >
        > blah blah blah $142 blah blah blah
        >
        >Why was the leading space *not* included in the highlighted text
        >as a result of the find process?


        Happy Clip'n!
        Jody

        http://www.notetab.net

        Subscribe, UnSubscribe, Options
        mailto:Ntb-Clips-Subscribe@yahoogroups.com
        mailto:Ntb-Clips-UnSubscribe@yahoogroups.com
        http://www.egroups.com/group/ntb-clips
      • dhayes@liveonthenet.com
        Here is a test clip I used to verify the odd behavior. It performs oddly in my NTP 4.85 as I indicated in my original message. ^!ToolBar New Document blah blah
        Message 3 of 14 , Apr 16, 2001
          Here is a test clip I used to verify the odd behavior. It performs
          oddly in my NTP 4.85 as I indicated in my original message.

          ^!ToolBar New Document
          blah blah blah $142 blah blah blah
          ^!Set %NAG%=" $142"
          ^!SetCursor 1:1
          ^!Find ^%NAG% IST
          ^!Goto EXIT

          Are you saying that the leading space is highlighted along with the
          remainder of the find text?

          My system does not highlight the leading text. Why?


          --- In ntb-clips@y..., Jody <av1611@e...> wrote:
          > Hi dhayes,
          >
          > Try it again. I was able to do it here. Perhaps you had an
          > option set that you did not realize or the space was not in your
          > search criteria.
          >
          > >I used the FIND ^%NAG% IST command in a clip to find text in a
          > >document.
          > >
          > >NAG was set to " $142" with a leading space as shown. However,
          > >the highlighted text found was "$142" without a leading space in
          > >the example document shown below.
          > >
          > > blah blah blah $142 blah blah blah
          > >
          > >Why was the leading space *not* included in the highlighted text
          > >as a result of the find process?
        • dhayes@liveonthenet.com
          I even tried it like this: ^!ToolBar New Document blah blah blah $142 blah blah blah ^!Set %NAG%= $142 ^!SetCursor 1:1 ^!Find ^%NAG% IST ^!Goto EXIT
          Message 4 of 14 , Apr 16, 2001
            I even tried it like this:

            ^!ToolBar New Document
            blah blah blah $142 blah blah blah
            ^!Set %NAG%=" $142"
            ^!SetCursor 1:1
            ^!Find ^%NAG% IST
            ^!Goto EXIT

            Where I put 5 leading spaces before $142 in the line of text, and
            then tried to find the NAG text with its 3 leading spaces. In all
            cases, none of the leading spaces were highlighted. Only the $142
            gets highlighted.

            Is this a bug?



            --- In ntb-clips@y..., Jody <av1611@e...> wrote:
            > Hi dhayes,
            >
            > Try it again. I was able to do it here. Perhaps you had an
            > option set that you did not realize or the space was not in your
            > search criteria.
            >
            > >I used the FIND ^%NAG% IST command in a clip to find text in a
            > >document.
            > >
            > >NAG was set to " $142" with a leading space as shown. However,
            > >the highlighted text found was "$142" without a leading space in
            > >the example document shown below.
            > >
            > > blah blah blah $142 blah blah blah
            > >
            > >Why was the leading space *not* included in the highlighted text
            > >as a result of the find process?
          • Lotta
            Hi, ... Verified - does not highlight space. This is funny. This doesn t work either: ^!Set %NAG%= ^%space%$142 ^!SetCursor 1:1 ^!Find ^%NAG% IST but this
            Message 5 of 14 , Apr 16, 2001
              Hi,

              >Are you saying that the leading space is highlighted along with the
              >remainder of the find text?
              >
              >My system does not highlight the leading text. Why?

              Verified - does not highlight space. This is funny. This doesn't work either:

              ^!Set %NAG%="^%space%$142"
              ^!SetCursor 1:1
              ^!Find ^%NAG% IST

              but this does:

              ^!Set %NAG%=$142
              ^!SetCursor 1:1
              ^!Find "^%space%^%NAG%" IST

              Figure that? Blah.

              Lotta
            • Jody
              Hi dhayes, ... It is one of the oddballs when dealing with quotes and spaces. It works certain ways, but not all ways. That is why it worked for me when I
              Message 6 of 14 , Apr 16, 2001
                Hi dhayes,

                >Are you saying that the leading space is highlighted along with
                >the remainder of the find text?
                >
                >My system does not highlight the leading text. Why?

                It is one of the oddballs when dealing with quotes and spaces.
                It works certain ways, but not all ways. That is why it worked
                for me when I tried it, but did not for Lotta and you.

                These work:
                ^!Set %nag%= $143
                ^!Find " ^%NAG%" IST

                ^!Set %nag%=" $143"
                ^!Find "^%NAG%" IST

                This fails:
                ^!Set %nag%= $143
                ^!Find ^%NAG% IST

                ...and I just saw Lotta's:

                Works:
                ^!Set %NAG%=$142
                ^!SetCursor 1:1
                ^!Find "^%space%^%NAG%" IST

                Happy Clip'n!
                Jody

                http://www.notetab.net

                Subscribe, UnSubscribe, Options
                mailto:Ntb-Clips-Subscribe@yahoogroups.com
                mailto:Ntb-Clips-UnSubscribe@yahoogroups.com
                http://www.egroups.com/group/ntb-clips
              • dhayes@liveonthenet.com
                ... The above suggests that the search criteria must always be placed between double quotes even if you specify search options. That statement contradicts the
                Message 7 of 14 , Apr 16, 2001
                  Jody said this works:

                  >
                  > ^!Set %nag%=" $143"
                  > ^!Find "^%NAG%" IST
                  >

                  The above suggests that the search criteria must always be placed
                  between double quotes even if you specify search options.

                  That statement contradicts the help file statement:

                  The search criteria must always be placed between double quotes if
                  you don't specify search options.

                  Not only were search options specified, but the search criteria was
                  neatly encapsulated in a variable.

                  Therefore, either the clip Find command is buggy, or the help file is
                  inaccurate.

                  Perhaps Mr. Fookes can fix.

                  Thanks again for your work-around.
                • Jody
                  Hi dhayes, ... If you mess around with it for awhile I think you will find it is because of the space that the quotes need to be used. ... That might have been
                  Message 8 of 14 , Apr 16, 2001
                    Hi dhayes,

                    >> ^!Set %nag%=" $143"
                    >> ^!Find "^%NAG%" IST
                    >>
                    >The above suggests that the search criteria must always be placed
                    >between double quotes even if you specify search options.

                    If you mess around with it for awhile I think you will find it is
                    because of the space that the quotes need to be used.

                    >That statement contradicts the help file statement:
                    >
                    >The search criteria must always be placed between double quotes
                    >if you don't specify search options.

                    That might have been accurate before and just never changed.
                    Wayne, myself and others spent a lot of time discussing this
                    before. There are a few places where the quotes have to be used.
                    If I remember correctly, the problems with the spaces and quotes
                    will not be looked at until version 5 when Eric is doing the
                    rewrite of NoteTab. I think if you use quotes all the time
                    around the variable and the command that will use the variable
                    that it will not fail for you. I don't use them for variables
                    only because I think they are ugly. If they have to be there
                    then I will use them in that case.

                    Happy Clip'n!
                    Jody

                    http://www.notetab.net

                    Subscribe, UnSubscribe, Options
                    mailto:Ntb-Clips-Subscribe@yahoogroups.com
                    mailto:Ntb-Clips-UnSubscribe@yahoogroups.com
                    http://www.egroups.com/group/ntb-clips
                  • Lotta
                    Jody, ... Boink! If the value of a variable contains a space NTB sees it in the same way as if I had used the value itself? Now, that figures... :) Lotta
                    Message 9 of 14 , Apr 16, 2001
                      Jody,

                      > >> ^!Set %nag%=" $143"
                      > >> ^!Find "^%NAG%" IST
                      >
                      >If you mess around with it for awhile I think you will find it is
                      >because of the space that the quotes need to be used.

                      Boink! If the value of a variable contains a space NTB "sees it" in the
                      same way as if I had used the value itself? Now, that figures... :)

                      Lotta
                    • Jody
                      Hi Lotta, ... I think the answer is yes. ;) It is the ^!Find command that needs the quotes if a space is in the search criteria. The variable is getting set
                      Message 10 of 14 , Apr 16, 2001
                        Hi Lotta,

                        >> If you mess around with it for awhile I think you will find it
                        >> is because of the space that the quotes need to be used.
                        >
                        >Boink! If the value of a variable contains a space NTB "sees it"
                        >in the same way as if I had used the value itself?

                        I think the answer is yes. ;) It is the ^!Find command that
                        needs the quotes if a space is in the search criteria. The
                        variable is getting set correctly which can be seen if
                        ^!InsertText is used.

                        Austin, TX 78701

                        ^!Set %v5%= TX^%Space%
                        ; ^!Set %v5%=TX^%Space%
                        ; ^!Set %v5%= TX^%Space%
                        : ^!Find "^%v5%"
                        ; ^!Find ^%v5%
                        ^!InsertText ^%v5%

                        Happy Clip'n!
                        Jody

                        http://www.notetab.net

                        Subscribe, UnSubscribe, Options
                        mailto:Ntb-Clips-Subscribe@yahoogroups.com
                        mailto:Ntb-Clips-UnSubscribe@yahoogroups.com
                        http://www.egroups.com/group/ntb-clips
                      • Eric G.V. Fookes
                        ... That doesn t say that quotes must never be used when there is a search option . ... The ^!Find command does not see the neatly encapsulated data. Once
                        Message 11 of 14 , Apr 17, 2001
                          At 18:10 16/04/01 +0000, dhayes wrote:
                          >Jody said this works:
                          >
                          > > ^!Set %nag%=" $143"
                          > > ^!Find "^%NAG%" IST
                          >
                          >The above suggests that the search criteria must always be placed
                          >between double quotes even if you specify search options.
                          >
                          >That statement contradicts the help file statement:
                          >
                          >The search criteria must always be placed between double quotes if
                          >you don't specify search options.

                          That doesn't say that quotes must never be used when there is a search
                          option <g>.

                          >Not only were search options specified, but the search criteria was
                          >neatly encapsulated in a variable.

                          The ^!Find command does not see the neatly encapsulated data. Once the
                          command is reached, the parser has already processed the variable. Here's
                          what the Find command sees in the following two examples:

                          1. ^!Find ^%NAG% IST
                          ^!Find $143 IST

                          2. ^!Find "^%NAG%" IST
                          ^!Find " $143" IST

                          In the first example, the parser ignores extra spaces since it does not
                          find the quotes.

                          Hope this helps.


                          Regards,
                          Eric G.V. Fookes
                          Author of NoteTab, Mailbag Assistant, and Album Express
                          http://www.fookes.com/ and http://www.notetab.com/







                          ...
                        • dhayes@liveonthenet.com
                          ... search ... You are correct. However, the help file seems to imply that quotes are not necessary if options are specified. ... not ... I understand now
                          Message 12 of 14 , Apr 17, 2001
                            > >The search criteria must always be placed between double quotes if
                            > >you don't specify search options.
                            >
                            > That doesn't say that quotes must never be used when there is a
                            search
                            > option <g>.

                            You are correct. However, the help file seems to imply that quotes
                            are not necessary if options are specified.

                            > 1. ^!Find ^%NAG% IST
                            > ^!Find $143 IST
                            >
                            > 2. ^!Find "^%NAG%" IST
                            > ^!Find " $143" IST
                            >
                            > In the first example, the parser ignores extra spaces since it does
                            not
                            > find the quotes.

                            I understand now that you explain it. Still, your explaination is
                            counter intuitive. I (and probably most others) expect text enclosed
                            by quotes to be taken literally. Consider the example:

                            ^!Find "^%anyname%" IST

                            Intuitively, I expect the find function to find the string ^%anyname%
                            and *not* the contents of the variable ^%anyname%. If I wanted to
                            find the contents of the variable, then I would expect to write it as:

                            ^!Find ^%anyname% IST

                            The fact that this last example works as expected for all cases
                            except for leading (and possibly trailing) spaces only serves to
                            confuse the matter.

                            Again, I encourage Mr. Fookes to make the last example work for *all*
                            cases.

                            As it stands now, how do I find the string ^%anyname% (not the
                            contents of the variable) in text?
                          • David Paterson
                            Hello, I am looking to create a clip that will look at all of the open files and save them to a different root directory but following the same underlying
                            Message 13 of 14 , Apr 18, 2001
                              Hello, I am looking to create a clip that will look at all of the open
                              files and save them to a different root directory but following the same
                              underlying document tree. For instance I have a file open with this file
                              name C:\kit\es-doc\cw\user\index.jhtml and I want the script to save the
                              file to C:\ATG\Dyn4.5.1\webroot\doc\cw\user\index.jhtml. I see how to save
                              files to a specific directory but I am having trouble picking up the initial
                              path to the doc root and then the consequent relative directory tree.


                              Any advice?


                              Thanks,
                              David Paterson - Product Manager
                              Cleanwise Inc.
                              33 Boston Post Road West, Suite 400,
                              Marlborough, MA 01752
                              P: 1-887-790-2497<br>F: 508-481-7861
                              dpaterson@...
                            • dhayes@liveonthenet.com
                              ... open ... same ... I suggest posting your inquiry to a new thread. You will get more responses that way.
                              Message 14 of 14 , Apr 18, 2001
                                --- In ntb-clips@y..., David Paterson <dpaterson@c...> wrote:
                                > Hello, I am looking to create a clip that will look at all of the
                                open
                                > files and save them to a different root directory but following the
                                same
                                > underlying document tree...

                                I suggest posting your inquiry to a new thread. You will get more
                                responses that way.
                              Your message has been successfully submitted and would be delivered to recipients shortly.