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

RE: [Clip] Parsing INI operations

Expand Messages
  • Jamal Mazrui
    Thanks for your analysis, John. I wonder if the unexpected NTB behavior you encountered was also behind some of the problems I have experienced with .ini
    Message 1 of 21 , May 10, 2005
    • 0 Attachment
      Thanks for your analysis, John. I wonder if the unexpected NTB behavior
      you encountered was also behind some of the problems I have experienced
      with .ini files.

      At one point, I was trying to save the current values of the NTB Find
      dialog so that I could restore them after a ^!Find command in a script
      (which has the unfortunate side affect of also changing the values in
      the Find dialog of the user interface). I could not figure out how to
      do this, and am still interested in a solution.

      Concerning the .ini file flushing-to-disk issue I raised, here is an
      excerpt from a Microsoft web page about the WritePrivateProfileString
      function of the Windows API:

      From the web page
      http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo
      /base/writeprivateprofilestring.asp
      "The system keeps a cached version of the most recent registry file
      mapping to improve performance. If all parameters are NULL, the function
      flushes the cache. While the system is editing the cached version of the
      file, processes that edit the file itself will use the original file
      until the cache has been cleared."

      That page is oriented to C programmers, and I am not one. My
      interpretation of it, however, is that one should call the
      WritePrivateProfileString function (the equivalent of the NTB SaveValue
      command) once with null values (besides the .ini file name parameter)
      after a series of calls to change values in the file, in order to ensure
      that the cached version of the file in memory is actually saved to disk.
      Perhaps NTB does this as part of its SaveValue command.

      Jamal



      -----Original Message-----
      From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On
      Behalf Of John Zeman
      Sent: Tuesday, May 10, 2005 8:47 AM
      To: ntb-clips@yahoogroups.com
      Subject: [Clip] Parsing INI operations


      I need to correct something I said last time about the ini file.
      After a good night's sleep and quite a bit of further testing this
      morning, I've discovered it's a bit different than I thought.

      Here are my revised conclusions:

      1. The only time the ini file is actually changed on disk is when the
      ^!ProgIniSave command is used (and of course when exiting the NoteTab
      program).

      2. The ^!SaveValue command does not write to the ini file on disk as
      I'd stated earlier, instead it changes the dynamic value of a setting
      in the ini memory.

      3. Here's another thing it seems I was wrong about. Once the dynamic
      value of the ini file is changed in memory, it's NOT used in the
      current NoteTab session UNLESS the ^!ProgIniLoad command is run.

      4. It seems that when you run the ^!ProgIniSave command, NoteTab does
      NOT save any recently made changes that were made to the ini via the
      ^!SaveValue command. Rather it seems to save what NoteTab had last
      read from the ini when the program was launched or refreshed by using
      the ^!ProgIniLoad command.

      So to sum it up it appears the following might be a basic template to
      use when processing the NoteTab ini file.

      ; Update NoteTab to any recent changes
      ^!ProgIniLoad

      ; Save current ini config to disk
      ^!ProgIniSave

      ; Read or write new ini values
      ^!SaveValue [Section:]Key=Value

      ; Update NoteTab again
      ^!ProgIniLoad

      It's been an interesting exercise. Any thoughts out there?

      John




      Fookes Software: http://www.fookes.us, http://www.fookes.com
      Fookes Software Mailing Lists: http://www.fookes.us/maillist.htm

      Yahoo! Groups Links
    • Jamal Mazrui
      The .ini file test results reported in this discussion have left me even more confused about how NoteTab actually handles these commands! I hope someone can
      Message 2 of 21 , May 10, 2005
      • 0 Attachment
        The .ini file test results reported in this discussion have left me even
        more confused about how NoteTab actually handles these commands! I hope
        someone can get authoritative answers from the developer.

        Jamal
      • Jamal Mazrui
        Hi Larry, I appreciate your explanation, but am not yet satisfied that the mystery is solved. I am not remembering the specifics at the moment, but
        Message 3 of 21 , May 10, 2005
        • 0 Attachment
          Hi Larry,
          I appreciate your explanation, but am not yet satisfied that the mystery
          is solved. <smile> I am not remembering the specifics at the moment,
          but am fairly sure that John reported test results that are inconsistent
          with your description of what happens with the NTB .ini file.

          In addition, I have just tested some code that I thought would work, but
          does not. I regularly use a clip that navigates to the next form feed
          character in a document, which I separate into sections by means of this
          character. An adverse side effect has been that the default search
          string in the Find dialog then becomes a form feed character, instead of
          what I last searched for with Control+F or F3. I revised my clip as
          follows:


          ^!ProgIniSave
          ^!Find "^%page%" ist
          ^!ProgIniLoad

          The formfeed character still remains as the default search string,
          rather than the previous search string being restored. I have even
          tried with a temporary .ini file specified after the ProgIniSave and
          ProgIniLoad commands (c:\temp\temp.ini), but the result is the same.

          Regards,
          Jamal




          -----Original Message-----
          From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On
          Behalf Of Larry Hamilton
          Sent: Tuesday, May 10, 2005 1:24 PM
          To: ntb-clips@yahoogroups.com
          Subject: Re: [Clip] Parsing INI operations


          John, Harvey, Jamal, et. al.,

          If the NoteTab ini file is for an open instance of NoteTab, then it is
          not updated until NoteTab is closed or the ^!ProgIniSave command is
          used. Then one must use ^!ProgIniLoad to read the new results from the
          ini file.

          This will translate to other programs where the ini file is in use
          because the program is open.

          This is not the case if one uses a custom ini file, that is basically a
          text file for saving variables for later.

          This is not contrary behavior, or a big mystery that we need to consult
          Eric, but what one should expect from working with a file that is in
          use. This is why there is a special command to be able to edit a NoteTab

          ini file in NoteTab, one must prefix its name with an "!" when saving it

          to get the changes to store.

          There are two ways of interacting with ini files simply because in one
          way the file is in use and in the other it is like a data file. When the

          file is in use, it will match what MS says about it. When the program
          that uses the ini file is running, it will follow the rules from MS. If
          it is an ini file for a clip, think of a specially formed text file for
          holding values.

          I hope this clarifies the "mystery".

          Larry Hamilton
          Kairos Computer Solutions
          http://www.kairoscomputers.com/
          Sales Affiliate for Grisoft Anti-Virus

          John Zeman wrote:
          > That's interesting hrs, apparently if we use an ini file other than
          the default NotePro.ini file, NoteTab does just what you say here.
          However with the NotePro.ini, which is what I was testing with, NoteTab
          seems to behave the way I stated it last time.
          >
          > I'm starting to think Jamal is close to nailing it concerning the
          flushing-to-disk issue he's talking about. At least when the default
          NotePro.ini file is used as the ini file in a clip. Perhaps he could
          easily solve his problem by specifying a separate ini file as hrs does
          in his example?
          >
          > John


          Fookes Software: http://www.fookes.us, http://www.fookes.com
          Fookes Software Mailing Lists: http://www.fookes.us/maillist.htm

          Yahoo! Groups Links
        • Jamal Mazrui
          Just reporting another failed attempt .... From examining the notepro.ini file, I think the default search string is stored within the FindDialog section
          Message 4 of 21 , May 10, 2005
          • 0 Attachment
            Just reporting another failed attempt .... <gee>

            From examining the notepro.ini file, I think the default search string
            is stored within the FindDialog section under the SearchList_1 key name.
            Thus, I tried the following:

            ^!Set %s%=^$GetValue(FindDialog:SearchList_1)$
            ^!Find "^%page%" ist
            ^!SaveValue FindDialog:^%s%


            I hoped that this would save and restore the default search string in
            memory, but the formfeed character still becomes the default search
            string.

            Jamal
          • John Zeman
            ... Actually Jamal, what Larry said does mirror what I found out. And what hrs found out. I m not sure I follow what you re trying to do here, but if you re
            Message 5 of 21 , May 10, 2005
            • 0 Attachment
              --- In ntb-clips@yahoogroups.com, "Jamal Mazrui" <Jamal.Mazrui@f...> wrote:
              > Hi Larry,
              > I appreciate your explanation, but am not yet satisfied that the mystery
              > is solved. <smile> I am not remembering the specifics at the moment,
              > but am fairly sure that John reported test results that are inconsistent
              > with your description of what happens with the NTB .ini file.
              >
              > In addition, I have just tested some code that I thought would work, but
              > does not. I regularly use a clip that navigates to the next form feed
              > character in a document, which I separate into sections by means of this
              > character. An adverse side effect has been that the default search
              > string in the Find dialog then becomes a form feed character, instead of
              > what I last searched for with Control+F or F3. I revised my clip as
              > follows:
              >
              >
              > ^!ProgIniSave
              > ^!Find "^%page%" ist
              > ^!ProgIniLoad
              >
              > The formfeed character still remains as the default search string,
              > rather than the previous search string being restored. I have even
              > tried with a temporary .ini file specified after the ProgIniSave and
              > ProgIniLoad commands (c:\temp\temp.ini), but the result is the same.
              >
              > Regards,
              > Jamal



              Actually Jamal, what Larry said does mirror what I found out. And what hrs found out.

              I'm not sure I follow what you're trying to do here, but if you're looking to find repetitive page breaks in a document, and then to do something at each page break, why wouldn't the following simple clip be a start to the solution?

              :Loop
              ^!Find "^%PAGE%" TIS
              ^!IfError END
              ^!Continue Page break found, do something here
              ^!GoTo Loop

              It doesn't use the ini file at all.

              John
            • Jamal Mazrui
              Hi John, Previously, you said the following: ... 3. Here s another thing it seems I was wrong about. Once the dynamic value of the ini file is changed in
              Message 6 of 21 , May 10, 2005
              • 0 Attachment
                Hi John,
                Previously, you said the following:
                " ...
                3. Here's another thing it seems I was wrong about. Once the dynamic
                value of the ini file is changed in memory, it's NOT used in the
                current NoteTab session UNLESS the ^!ProgIniLoad command is run.

                4. It seems that when you run the ^!ProgIniSave command, NoteTab does
                NOT save any recently made changes that were made to the ini via the
                ^!SaveValue command. Rather it seems to save what NoteTab had last
                read from the ini when the program was launched or refreshed by using
                the ^!ProgIniLoad command.

                So to sum it up it appears the following might be a basic template to
                use when processing the NoteTab ini file.

                ; Update NoteTab to any recent changes
                ^!ProgIniLoad

                ; Save current ini config to disk
                ^!ProgIniSave

                ; Read or write new ini values
                ^!SaveValue [Section:]Key=Value

                ; Update NoteTab again
                ^!ProgIniLoad


                ... "


                My interpretation of those results is inconsistent with the simple model
                that Larry described. For example, his description would suggest that
                one can change NTB values in memory and make use of those changes. Your
                results suggest contortions being necessary with saving and loading from
                disk. Even so, my experience, unfortunately, does not support what you
                thought would work in your concluding remarks above.

                I am not having a problem searching for formfeed characters within a
                clip. The problem I am having is that I want to use the ^!Find command
                for this purpose, but not have it change the default search string when
                I invoke the Find dialog manually. I have made various code attempts to
                save and restore the default search string (the one that appears in the
                edit box when one presses Control+F), without success. If anyone can
                code a reliable solution, I would be grateful.



                Regards,
                Jamal
              • Hugo Paulissen
                Hi Guys, I m not sure, but I get the feeling these waters have been crossed before... http://groups.yahoo.com/group/ntb-clips/message/9776 If you do a search
                Message 7 of 21 , May 10, 2005
                • 0 Attachment
                  Hi Guys,

                  I'm not sure, but I get the feeling these waters have been crossed
                  before...

                  http://groups.yahoo.com/group/ntb-clips/message/9776

                  If you do a search in the archives I'm almost sure you can find more
                  info about the topics discussed here.

                  Hugo
                • Jamal Mazrui
                  Hi Hugo, I looked at that message, but it does not seem to suggest anything I haven t tried already. Let me give a specific example as follows: 1. I press
                  Message 8 of 21 , May 10, 2005
                  • 0 Attachment
                    Hi Hugo,
                    I looked at that message, but it does not seem to suggest anything I
                    haven't tried already. Let me give a specific example as follows:

                    1. I press Control+F and search for the word "NoteTab" in the current
                    document. If I do not find the paragraph I want, I press Control+F
                    again. The word "NoteTab" remains as the search string, so I can just
                    press Enter to search for the next occurrence of the string (I have the
                    blind-friendly mode set, so the Find dialog is dismissed after each
                    search).

                    2. I run a clip that searches for a formfeed character using the ^!Find
                    command. The purpose is to move to the next section of the document,
                    which I have subdivided by means of page break characters.

                    3. I press Control+F to resume my search for the "NoteTab" string.
                    Instead of this word being the default, it is now a formfeed character
                    (ANSI 12) because I had run a clip that used a ^!Find command with this
                    character as the search string.


                    Question: How can I modify the code in my clip so that it saves and
                    restores the default search string in the Find dialog?

                    Jamal


                    -----Original Message-----
                    From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On
                    Behalf Of Hugo Paulissen
                    Sent: Tuesday, May 10, 2005 4:56 PM
                    To: ntb-clips@yahoogroups.com
                    Subject: Re: [Clip] Parsing INI operations


                    Hi Guys,

                    I'm not sure, but I get the feeling these waters have been crossed
                    before...

                    http://groups.yahoo.com/group/ntb-clips/message/9776

                    If you do a search in the archives I'm almost sure you can find more
                    info about the topics discussed here.

                    Hugo




                    Fookes Software: http://www.fookes.us, http://www.fookes.com
                    Fookes Software Mailing Lists: http://www.fookes.us/maillist.htm

                    Yahoo! Groups Links
                  • Alec Burgess
                    ... If I understand Jamal s problem, the statement ^!Find ^%PAGE% TIS has the side effect of trashing the previously established find target in the
                    Message 9 of 21 , May 10, 2005
                    • 0 Attachment
                      John/Jamal:

                      > I'm not sure I follow what you're trying to do here, but
                      > if you're looking to find repetitive page breaks in a
                      > document, and then to do something at each page break,
                      > why wouldn't the following simple clip be a start to the
                      > solution?
                      >
                      >> Loop
                      > ^!Find "^%PAGE%" TIS
                      > ^!IfError END
                      > ^!Continue Page break found, do something here
                      > ^!GoTo Loop
                      >
                      > It doesn't use the ini file at all.

                      If I understand Jamal's problem, the statement ^!Find "^%PAGE%" TIS has the
                      side effect of trashing the previously established find target in the
                      find/dialog. I've noticed similar occurance in the past but it was never
                      important enough to me to worry about it, but it sounds like Jamal wants to
                      be able to use that previous find target for manual processing after the
                      clip finishes.

                      In a previous message Jamal's had clip-code which would load the current
                      Find target into a variable ^%s^ by grabbing it from the main and active
                      ini-file.

                      Kludgey (?)solution(?):

                      Why not do that, do what ever processing he want's finding page-breaks etc.,
                      then do a ^!Find ^%s% relying on having the same side-effect. If neccessary
                      it can do a jumpto a saved row:col established before the ^!Find ^%s%
                      executes.

                      Now he should be able to rely on the find target again being what it was
                      previously and use it to (forinstance) an F3 to search-next.

                      Regards ... Alec
                      --
                      ( ) { } [ ] \ | 9 0 + = () {} []


                      ---- Original Message ----
                      From: "John Zeman" <john041650@...>
                      To: <ntb-clips@yahoogroups.com>
                      Sent: Tuesday, May 10, 2005 15:51
                      Subject: [gla: Re: [Clip] Parsing INI operations

                      > --- In ntb-clips@yahoogroups.com, "Jamal Mazrui"
                      > <Jamal.Mazrui@f...> wrote:
                      >> Hi Larry,
                      >> I appreciate your explanation, but am not yet satisfied
                      >> that the mystery is solved. <smile> I am not
                      >> remembering the specifics at the moment, but am fairly
                      >> sure that John reported test results that are
                      >> inconsistent with your description of what happens with
                      >> the NTB .ini file.
                      >>
                      >> In addition, I have just tested some code that I thought
                      >> would work, but does not. I regularly use a clip that
                      >> navigates to the next form feed character in a document,
                      >> which I separate into sections by means of this
                      >> character. An adverse side effect has been that the
                      >> default search string in the Find dialog then becomes a
                      >> form feed character, instead of what I last searched for
                      >> with Control+F or F3. I revised my clip as follows:
                      >>
                      >>
                      >> ^!ProgIniSave
                      >> ^!Find "^%page%" ist
                      >> ^!ProgIniLoad
                      >>
                      >> The formfeed character still remains as the default
                      >> search string, rather than the previous search string
                      >> being restored. I have even tried with a temporary .ini
                      >> file specified after the ProgIniSave and ProgIniLoad
                      >> commands (c:\temp\temp.ini), but the result is the same.
                      >>
                      >> Regards,
                      >> Jamal
                      >
                      >
                      >
                      > Actually Jamal, what Larry said does mirror what I found
                      > out. And what hrs found out.
                      >
                      >
                      > John
                      >
                      >
                      >
                      >
                      >
                      > Fookes Software: http://www.fookes.us,
                      > http://www.fookes.com
                      > Fookes Software Mailing Lists:
                      > http://www.fookes.us/maillist.htm
                      >
                      > Yahoo! Groups Links
                      >
                      >
                      >
                    • Jamal Mazrui
                      I think that would work--thanks, Alec! My present conclusion is that the ProgIniLoad function does not work as advertized with NTB s own .ini file--at least
                      Message 10 of 21 , May 10, 2005
                      • 0 Attachment
                        I think that would work--thanks, Alec!

                        My present conclusion is that the ProgIniLoad function does not work as
                        advertized with NTB's own .ini file--at least not with certain sections
                        of settings.

                        Regards,
                        Jamal


                        -----Original Message-----
                        From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On
                        Behalf Of Alec Burgess
                        Sent: Tuesday, May 10, 2005 5:28 PM
                        To: ntb-clips@yahoogroups.com
                        Subject: Re: Re: [Clip] Parsing INI operations


                        John/Jamal:

                        > I'm not sure I follow what you're trying to do here, but
                        > if you're looking to find repetitive page breaks in a
                        > document, and then to do something at each page break,
                        > why wouldn't the following simple clip be a start to the
                        > solution?
                        >
                        >> Loop
                        > ^!Find "^%PAGE%" TIS
                        > ^!IfError END
                        > ^!Continue Page break found, do something here
                        > ^!GoTo Loop
                        >
                        > It doesn't use the ini file at all.

                        If I understand Jamal's problem, the statement ^!Find "^%PAGE%" TIS has
                        the
                        side effect of trashing the previously established find target in the
                        find/dialog. I've noticed similar occurance in the past but it was never
                        important enough to me to worry about it, but it sounds like Jamal wants
                        to
                        be able to use that previous find target for manual processing after the
                        clip finishes.

                        In a previous message Jamal's had clip-code which would load the current
                        Find target into a variable ^%s^ by grabbing it from the main and active
                        ini-file.

                        Kludgey (?)solution(?):

                        Why not do that, do what ever processing he want's finding page-breaks
                        etc.,
                        then do a ^!Find ^%s% relying on having the same side-effect. If
                        neccessary
                        it can do a jumpto a saved row:col established before the ^!Find ^%s%
                        executes.

                        Now he should be able to rely on the find target again being what it was
                        previously and use it to (forinstance) an F3 to search-next.

                        Regards ... Alec
                        --
                        ( ) { } [ ] \ | 9 0 + = () {} []


                        ---- Original Message ----
                        From: "John Zeman" <john041650@...>
                        To: <ntb-clips@yahoogroups.com>
                        Sent: Tuesday, May 10, 2005 15:51
                        Subject: [gla: Re: [Clip] Parsing INI operations

                        > --- In ntb-clips@yahoogroups.com, "Jamal Mazrui"
                        > <Jamal.Mazrui@f...> wrote:
                        >> Hi Larry,
                        >> I appreciate your explanation, but am not yet satisfied
                        >> that the mystery is solved. <smile> I am not
                        >> remembering the specifics at the moment, but am fairly
                        >> sure that John reported test results that are
                        >> inconsistent with your description of what happens with
                        >> the NTB .ini file.
                        >>
                        >> In addition, I have just tested some code that I thought
                        >> would work, but does not. I regularly use a clip that
                        >> navigates to the next form feed character in a document,
                        >> which I separate into sections by means of this
                        >> character. An adverse side effect has been that the
                        >> default search string in the Find dialog then becomes a
                        >> form feed character, instead of what I last searched for
                        >> with Control+F or F3. I revised my clip as follows:
                        >>
                        >>
                        >> ^!ProgIniSave
                        >> ^!Find "^%page%" ist
                        >> ^!ProgIniLoad
                        >>
                        >> The formfeed character still remains as the default
                        >> search string, rather than the previous search string
                        >> being restored. I have even tried with a temporary .ini
                        >> file specified after the ProgIniSave and ProgIniLoad
                        >> commands (c:\temp\temp.ini), but the result is the same.
                        >>
                        >> Regards,
                        >> Jamal
                        >
                        >
                        >
                        > Actually Jamal, what Larry said does mirror what I found
                        > out. And what hrs found out.
                        >
                        >
                        > John
                        >
                        >
                        >
                        >
                        >
                        > Fookes Software: http://www.fookes.us,
                        > http://www.fookes.com
                        > Fookes Software Mailing Lists:
                        > http://www.fookes.us/maillist.htm
                        >
                        > Yahoo! Groups Links
                        >
                        >
                        >



                        Fookes Software: http://www.fookes.us, http://www.fookes.com
                        Fookes Software Mailing Lists: http://www.fookes.us/maillist.htm

                        Yahoo! Groups Links
                      • Hugo Paulissen
                        ... work as ... sections ... Alec, Jamal, HRS, Larry, Jody, et al, I do not agree with you Jamal. If you scroll up in the find-dialog list you ll notice that
                        Message 11 of 21 , May 10, 2005
                        • 0 Attachment
                          >
                          > My present conclusion is that the ProgIniLoad function does not
                          work as
                          > advertized with NTB's own .ini file--at least not with certain
                          sections
                          > of settings.
                          >
                          > Regards,

                          Alec, Jamal, HRS, Larry, Jody, et al,

                          I do not agree with you Jamal.

                          If you scroll up in the find-dialog list you'll notice that the
                          previous search item is in the list.

                          ^!ProgIniSave
                          ^!SetIniFile
                          ^!INFO ^$GetValue(FindDialog:SearchList_1)$

                          The problem however seems to lie in the fact that NoteTab
                          automatically selects the n-th item in the list (^B already is in the
                          list and apparently, if you do search for a string that has been
                          searched before, the item is not inserted at the top of the list, but
                          it is selected from the other items in the FindDialog-list). If you
                          do a new search you have to scroll up to find the last searched
                          word...

                          Maybe you could limit the number of items in the FindDiaolog to just
                          one?

                          Hugo
                        • Alan C
                          ... As I understand it, wants *not* disturbed, the current record in the find dialog. Alec offered a solution. Here s another idea *(not tested)* It s easy to
                          Message 12 of 21 , May 10, 2005
                          • 0 Attachment
                            Jamal Mazrui wrote:

                            >[ . . ]
                            >Question: How can I modify the code in my clip so that it saves and
                            >restores the default search string in the Find dialog?
                            >
                            >
                            As I understand it, wants *not* disturbed, the current record in the
                            find dialog.

                            Alec offered a solution.

                            Here's another idea *(not tested)*

                            It's easy to switch from one ini to another and back again in a clip.
                            And I wonder if doing so would put stop to the issue at hand.

                            --
                            To try it, have another ini (if nothing else, close Notetab then make a
                            copy of the ini in the Notetab application folder. Rename this copy.
                            For example, two.ini as a file name would work. Then put two.ini into
                            the Notetabe clip libraries folder.

                            Look in clip programming help index for command syntax on the set ini
                            command.

                            At beginning of clip:

                            ^!Setini=two
                            ; clip tasks
                            ; near end of clip
                            ^!Setini
                            ; end

                            --
                            Alan.
                          • John Zeman
                            ... Alan I thought of that awhile back too but Jamal wanted to use the built in NoteTab Find tool instead of the ^!find clip command. That s what has made
                            Message 13 of 21 , May 10, 2005
                            • 0 Attachment
                              --- In ntb-clips@yahoogroups.com, "Alec Burgess" <buralex@g...> wrote:

                              >
                              > If I understand Jamal's problem, the statement ^!Find "^%PAGE%" TIS has the
                              > side effect of trashing the previously established find target in the
                              > find/dialog. I've noticed similar occurance in the past but it was never
                              > important enough to me to worry about it, but it sounds like Jamal wants to
                              > be able to use that previous find target for manual processing after the
                              > clip finishes.
                              >
                              > In a previous message Jamal's had clip-code which would load the current
                              > Find target into a variable ^%s^ by grabbing it from the main and active
                              > ini-file.
                              >
                              > Kludgey (?)solution(?):
                              >
                              > Why not do that, do what ever processing he want's finding page-breaks etc.,
                              > then do a ^!Find ^%s% relying on having the same side-effect. If neccessary
                              > it can do a jumpto a saved row:col established before the ^!Find ^%s%
                              > executes.
                              >
                              > Now he should be able to rely on the find target again being what it was
                              > previously and use it to (forinstance) an F3 to search-next.
                              >
                              > Regards ... Alec




                              Alan I thought of that awhile back too but Jamal wanted to use the built in NoteTab Find tool instead of the ^!find clip command. That's what has made this whole thing such a challenge.

                              But when you mentioned using a kludge, you jogged something in me. Instead of using the ^!find clip command (or the NoteTab internal Find tool) to search for page breaks (form feeds represented by ^B), why not use the ^!Replace clip command to locate and replace form feeds with identical form feeds one at a time instead? In other words use this clip to jump to the next form feed:

                              ^!Replace "^%page%" >> "^%page%" TIS
                              ^!Jump +1

                              Doing it this way would not alter the previous find results in any way yet it would still effectively jump to the page breaks.

                              Then he could use the standard Find tool to locate whatever else is needed. The ^!Jump +1 command following the ^!Replace command is needed so the NoteTab Find tool doesn't reselect the form feed character.

                              Sure it's a kludge, but it's the closest thing to an answer to Jamal's problem that I can come up with.

                              Jamal I have to respectfully disagree with your assessment of the ini file and how it works. Now that I have a better understanding of it, I realize it's doing just exactly what it should be doing.

                              John
                            • John Zeman
                              ... I thought of that too Hugo and tried it. NoteTab just starts rebuilding the list again until it reaches 15. John
                              Message 14 of 21 , May 10, 2005
                              • 0 Attachment
                                --- In ntb-clips@yahoogroups.com, "Hugo Paulissen" <hugopaulissen@s...> wrote:

                                >
                                > Maybe you could limit the number of items in the FindDiaolog to just
                                > one?
                                >
                                > Hugo


                                I thought of that too Hugo and tried it. NoteTab just starts rebuilding the list again until it reaches 15.

                                John
                              • Hugo Paulissen
                                ... And otherwise you can always go back to something like this... ^!Set %PREVIOUSSEARCH%=^$GetValue(FindDialog:SearchList_1)$ ^!FIND ^B S ^!Continue Continue
                                Message 15 of 21 , May 10, 2005
                                • 0 Attachment
                                  --- In ntb-clips@yahoogroups.com, "Jamal Mazrui" <Jamal.Mazrui@f...>
                                  wrote:
                                  > I think that would work--thanks, Alec!
                                  >

                                  And otherwise you can always go back to something like this...

                                  ^!Set %PREVIOUSSEARCH%=^$GetValue(FindDialog:SearchList_1)$
                                  ^!FIND ^B S
                                  ^!Continue Continue searching for: ^%PREVIOUSSEARCH%?
                                  ^!Keyboard Ctrl+F #^%PREVIOUSSEARCH%#

                                  Goodnight,

                                  Hugo
                                • Alec Burgess
                                  ... ^!ProgIniLoad ^!ProgIniSave have always been a pain for me. I still end up doing it on a do it till it works basis it seems, but the example in the
                                  Message 16 of 21 , May 10, 2005
                                  • 0 Attachment
                                    Jamal:
                                    > http://groups.yahoo.com/group/ntb-clips/message/9776

                                    > I looked at that message, but it does not seem to suggest
                                    > anything I haven't tried already.

                                    A little further down in that thread Jody said:
                                    >>
                                    ^!ProgIniLoad ^!ProgIniSave have always been a pain for me. I
                                    still end up doing it on a do it till it works basis it seems,
                                    but the example in the SampleCode Library helps me.
                                    <<

                                    I played around with the three ini mini clips - save, edit and load.
                                    AFAICT you can change the first search value and even set the
                                    SearchListCount= to just 1 with or without actually bothering to clear out 2
                                    thru 15, but as soon as you try an 'F3' to find-next it automatically
                                    selects the nearest word and uses that as the 'F3' target, with the one
                                    you've just edited in test.ini being 1 lower on the stack.

                                    Weird stuff going down there :-) perhaps associated with setting some stuff
                                    up internally after doing the ProgIniLoad to set the 'F3' target.

                                    Did you try my kludge suggestion to force something to the top by doing a
                                    ^!find to force your desired value to the top of the stack? If so with what
                                    results?

                                    Regards ... Alec
                                    --
                                    ( ) { } [ ] \ | 9 0 + = () {} []


                                    ---- Original Message ----
                                    From: "Jamal Mazrui" <Jamal.Mazrui@...>
                                    To: <ntb-clips@yahoogroups.com>
                                    Sent: Tuesday, May 10, 2005 17:20
                                    Subject: [gla: RE: [Clip] Parsing INI operations
                                  • John Zeman
                                    ... Nice touch Hugo. I must admit it had not occurred to me to try the ^!Keyboard Ctrl+F #Text to Search For# approach. All in all, it s been an enlightening
                                    Message 17 of 21 , May 10, 2005
                                    • 0 Attachment
                                      --- In ntb-clips@yahoogroups.com, "Hugo Paulissen" <hugopaulissen@s...> wrote:

                                      > And otherwise you can always go back to something like this...
                                      >
                                      > ^!Set %PREVIOUSSEARCH%=^$GetValue(FindDialog:SearchList_1)$
                                      > ^!FIND ^B S
                                      > ^!Continue Continue searching for: ^%PREVIOUSSEARCH%?
                                      > ^!Keyboard Ctrl+F #^%PREVIOUSSEARCH%#
                                      >
                                      > Goodnight,
                                      >
                                      > Hugo



                                      Nice touch Hugo.

                                      I must admit it had not occurred to me to try the

                                      ^!Keyboard Ctrl+F #Text to Search For#

                                      approach.

                                      All in all, it's been an enlightening day for me.

                                      John
                                    • Jamal Mazrui
                                      Folks, I tried Alec s suggestion of restoring the search target with an extra ^!Find command at the end of my clip (then returning to the page break position).
                                      Message 18 of 21 , May 11, 2005
                                      • 0 Attachment
                                        Folks,
                                        I tried Alec's suggestion of restoring the search target with an extra
                                        ^!Find command at the end of my clip (then returning to the page break
                                        position). It sometimes works. The problem seems to be that the
                                        following two lines do not necessarily return the default search string:

                                        ^!ProgIniSave
                                        ^!Set %s%=^$GetValue(FindDialog:SearchList_1)$

                                        As far as I can tell, if the last search string used in the Find dialog
                                        had already existed in its search list before other, intervening
                                        searches, then it will not be placed in the SearchList_1 slot. Thus,
                                        this slot may return a string other than the last search string used in
                                        the Find Dialog, and so the clip restores the wrong string.

                                        The same problem applies to Hugo's suggestion of stuffing the edit box
                                        of the Find dialog, since it also relies on the SearchList_1 key.

                                        Regarding John's suggestion of using the Replace rather than Find
                                        command to navigate to the page break character, I think this would
                                        work, but would have a couple of undesirable side effects. By replacing
                                        a page break character with another of the same, NTB thinks that the
                                        document has been modified, even though it is identical (I tested this).
                                        I would rather not get the prompt to save changes when closing a file I
                                        have been using for reading only. I considered the Edit/Reload command,
                                        but it prompts for confirmation, requiring stuffing of the keyboard
                                        buffer to dismiss the dialog--messy and a performance hit.

                                        As others have also speculated, it appears that NTB maintains a position
                                        on the search list that is not saved as a setting in its .ini file.
                                        There appears to be no way of controlling this pointer programmatically
                                        in a reliable fashion.

                                        My best work-around so far has been to define an alternative Find dialog
                                        by means of a clip wizard. It stores a key named "Find" in the
                                        "ClipValues" section of notepro.ini. It uses GetValue to place this as
                                        the default choice in the edit box of the wizard, and then uses
                                        SaveValue to put the latest value there after the OK button is
                                        activated. It uses the Find command to search for the text.

                                        Another work-around was to use string processing functions on the body
                                        of the document retrieved with GetText. I could identify the string
                                        position of a form feed following the current cursor position, do
                                        arithmetic calculations, then use SetCursor to get to that position.
                                        Although this worked, I noticed a performance hit compared to the Find
                                        command. Also, I did not want to have to do such a series of arithmetic
                                        calculations to avoid the Find command in every clip that might use it.

                                        Jamal
                                      • abairheart
                                        ... Perhaps the ^!Refresh command might help, immediately after saving the INI file. Abair
                                        Message 19 of 21 , May 15, 2005
                                        • 0 Attachment
                                          --- In ntb-clips@yahoogroups.com, "Jamal Mazrui" <Jamal.Mazrui@f...>
                                          wrote:
                                          >
                                          > ^!ProgIniSave
                                          > ^!Set %s%=^$GetValue(FindDialog:SearchList_1)$


                                          Perhaps the ^!Refresh command might help, immediately after saving the
                                          INI file.


                                          Abair
                                        • Jamal Mazrui
                                          Thanks for the suggestion--I ve tried the Refresh command, to no avail. Regards, Jamal ... From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com]
                                          Message 20 of 21 , May 16, 2005
                                          • 0 Attachment
                                            Thanks for the suggestion--I've tried the Refresh command, to no avail.

                                            Regards,
                                            Jamal



                                            -----Original Message-----
                                            From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On
                                            Behalf Of abairheart
                                            Sent: Sunday, May 15, 2005 3:05 PM
                                            To: ntb-clips@yahoogroups.com
                                            Subject: Re: [Clip] Parsing INI operations


                                            --- In ntb-clips@yahoogroups.com, "Jamal Mazrui" <Jamal.Mazrui@f...>
                                            wrote:
                                            >
                                            > ^!ProgIniSave
                                            > ^!Set %s%=^$GetValue(FindDialog:SearchList_1)$


                                            Perhaps the ^!Refresh command might help, immediately after saving the
                                            INI file.


                                            Abair




                                            Fookes Software: http://www.fookes.us, http://www.fookes.com
                                            Fookes Software Mailing Lists: http://www.fookes.us/maillist.htm

                                            Yahoo! Groups Links
                                          • Jody
                                            Hi Jamal and Others, ... To me, that is not a work-around, but a much better method to do searches with. The main reason is you can set your own defaults which
                                            Message 21 of 21 , May 20, 2005
                                            • 0 Attachment
                                              Hi Jamal and Others,

                                              >My best work-around so far has been to define an alternative Find dialog
                                              >by means of a clip wizard. It stores a key named "Find" in the
                                              >"ClipValues" section of notepro.ini. It uses GetValue to place this as
                                              >the default choice in the edit box of the wizard, and then uses
                                              >SaveValue to put the latest value there after the OK button is
                                              >activated. It uses the Find command to search for the text.

                                              To me, that is not a work-around, but a much better method to do
                                              searches with. The main reason is you can set your own defaults
                                              which is always a big issue with some people.

                                              Furthermore, you can do multiple find/replaces and also after the
                                              first use of the Clip you can use F3 since the ^!Find sets the
                                              fields in the regular Find dialog. The first Clip below is a
                                              replace dialog with full checkbox options. It is from my Replace
                                              Library which has a number of Replace working examples of
                                              different things you can do. The ^!Set %Find% is one very, very
                                              long line.

                                              <--- Copy below this line --->
                                              H=Replace... (Checkbox)
                                              ; eMailed on 05-20-2005, ntb-clips@yahoogroups.com, Jody
                                              ; http://www.fookes.us/ http://www.notetab.net/zip/replace.zip
                                              ; notetab.net, clean-funnies.com, fookes.us, sojourner.us

                                              ; Example of wizard with the full compliment of replace options.
                                              ; Checks for a selection and if not selected the word at the
                                              ; cursor is used. The defaults can be changed by removing and
                                              ; adding underscores before the options desired to be checked in
                                              ; the wizard boxes. Extra code was added to ensure the first
                                              ; occurrence of a word or phrase is replaced because of the way
                                              ; the selection might be made. Code was also added to replace
                                              ; line breaks and tabs with tokens so they display correctly in
                                              ; the wizard fields.
                                              ^!SetScreenUpdate Off
                                              ^!Set %Start%=^$GetRowStart$:^$GetColStart$
                                              ^!SetCursor ^$GetRowEnd$:^$GetColEnd$
                                              ^!SelectTo ^%Start%
                                              ^!IfFalse ^$IsEmpty("^$GetSelection$")$ Skip_2
                                              ^!Set %Data%=^$GetWord$
                                              ^!Goto Skip
                                              ^!Set %Data%=^$GetSelection$
                                              ^!Set %Data%=^$StrReplace("^p";"^^P";"^%Data%";0;0)$
                                              ^!Set %Data%=^$StrReplace("^t";"^^T";"^%Data%";0;0)$
                                              ^!SetWizardLabel Change the defaults with underscore in the Clip
                                              ^!Set %Find%=^?{&Find what=^%Data%}; %Replace%=^?{&Replace with what=^%Data%}; %Options%=^?{(T=A;H=10)&Search options=Do not search for whole words^=T|Search for whole words only^=C|_Ignore character case^=I|Search backwards^=B|Search through all the open documents^=G|_Search through the whole document^=W|_Replace all occuranaces^=A|Search within selection only^=H|Search using regular expressions^=R|_Do not display any error messages^=S}

                                              ^!Replace "^%Find%" >> "^%Replace%" ^%Options%

                                              <--- Copy above this line --->
                                              <--- Right click over a Library --->
                                              <--- Choose: Add from Clipboard --->


                                              Happy Clip'n!
                                              Jody

                                              All Lists: http://www.fookes.us/maillist.htm
                                              Subscribe: mailto:ntb-Clips-Subscribe@yahoogroups.com
                                              UnSubscribe: mailto:ntb-Clips-UnSubscribe@yahoogroups.com
                                              Options: http://groups.yahoo.com/group/ntb-clips
                                              http://www.clean-funnies.com, http://www.sojourner.us/software
                                            Your message has been successfully submitted and would be delivered to recipients shortly.