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

Parsing INI operations

Expand Messages
  • John Zeman
    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
    Message 1 of 6 , May 10, 2005
    • 0 Attachment
      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
    • hsavage
      ... Hey John, Frankly, after writing the short test clip, included below, I m less sure where ^!ProgIniLoad and ^!ProgIniSave fit into the scheme of things.
      Message 2 of 6 , May 10, 2005
      • 0 Attachment
        John Zeman wrote:

        > I need to correct something I said last time about the ini file.
        >
        > 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

        Hey John,

        Frankly, after writing the short test clip, included below, I'm less
        sure where ^!ProgIniLoad and ^!ProgIniSave fit into the scheme of things.

        Judging from the results of this clip ^!SaveValue writes to disk and,
        maybe, dynamic memory.

        At least, after using ^!SaveValue, the data written is available using
        ^$GetValue(":")$ before the file or, changes to the ini file appear on disk.

        The ^!SaveValue writes the value, the ^$GetValue(":")$ accesses that
        value within nano-seconds in the command that follows, which is pretty
        quick.

        The loop prevents the clip from ending until you press the ctrlkey or
        the abort sequence, Ctrl+Alt.

        —————————————————————————————————————————————
        h=savevalue test
        ; creates or accesses ini in Ntb Libraries folder
        ^!SetIniFile Ntb-TEST
        ; saves value to disk file and dynamic memory
        ^!SaveValue SAVEVALUE TEST:SAVEVALUE TEST 1=SAVEVALUE TEST 2
        ; gets value written by test
        ^!StatusShow ^$GetValue("SAVEVALUE TEST:SAVEVALUE TEST 1")$
        :LOOP
        ^!Delay 1
        ^!IfFalse ^$IsCtrlKeyDown$ LOOP
        —————————————————————————————————————————————

        Help file excerpts.
        —————————————————————————————————————————————
        ^!SaveValue [Section:]Key=Value
        Saves the key and its value in NoteTab's INI file, or in the INI file
        defined by the ^!SetIniFile command.
        —————————————————————————————————————————————
        ^$GetValue("[Section:]Key")$
        Reads the specified key in NoteTab's INI file, or in the INI file
        defined by the ^!SetIniFile command.
        —————————————————————————————————————————————
        ^!ProgIniSave [IniName] (added in v4.6)
        Saves the current program settings into the NoteTab ini file or registry.
        —————————————————————————————————————————————
        ^!ProgIniLoad [IniName] (added in v4.6)
        Loads options from the NoteTab ini file or registry.
        —————————————————————————————————————————————

        ºvº
        05.05.10
        hrs > hsavage@...
      • John Zeman
        ... 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
        Message 3 of 6 , May 10, 2005
        • 0 Attachment
          --- In ntb-clips@yahoogroups.com, hsavage <hsavage@p...> wrote:
          > Hey John,
          >
          > Frankly, after writing the short test clip, included below, I'm less
          > sure where ^!ProgIniLoad and ^!ProgIniSave fit into the scheme of things.
          >
          > Judging from the results of this clip ^!SaveValue writes to disk and,
          > maybe, dynamic memory.
          >
          > At least, after using ^!SaveValue, the data written is available using
          > ^$GetValue(":")$ before the file or, changes to the ini file appear on disk.
          >
          > The ^!SaveValue writes the value, the ^$GetValue(":")$ accesses that
          > value within nano-seconds in the command that follows, which is pretty
          > quick.
          >
          > The loop prevents the clip from ending until you press the ctrlkey or
          > the abort sequence, Ctrl+Alt.
          >
          > —————————————————————————————————————————————
          > h=savevalue test
          > ; creates or accesses ini in Ntb Libraries folder
          > ^!SetIniFile Ntb-TEST
          > ; saves value to disk file and dynamic memory
          > ^!SaveValue SAVEVALUE TEST:SAVEVALUE TEST 1=SAVEVALUE TEST 2
          > ; gets value written by test
          > ^!StatusShow ^$GetValue("SAVEVALUE TEST:SAVEVALUE TEST 1")$
          > :LOOP
          > ^!Delay 1
          > ^!IfFalse ^$IsCtrlKeyDown$ LOOP




          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
        • Larry Hamilton
          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
          Message 4 of 6 , May 10, 2005
          • 0 Attachment
            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
          • John Zeman
            That makes sense Larry, I appreciate the input. Believe it or not that s the conclusion I was slowly coming to as our recent conversations about ini files
            Message 5 of 6 , May 10, 2005
            • 0 Attachment
              That makes sense Larry, I appreciate the input. Believe it or not that's the conclusion I was slowly coming to as our recent conversations about ini files evolved.

              John

              --- In ntb-clips@yahoogroups.com, Larry Hamilton <lmh@h...> wrote:
              > 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
            • abairheart
              PMFBI, but ... or BOTH! -- using the configuration INI file as data file as well. I.e. without changing to a special INI file for the clip. I also want to
              Message 6 of 6 , May 10, 2005
              • 0 Attachment
                PMFBI, but

                --- In ntb-clips@yahoogroups.com, Larry Hamilton <lmh@h...> wrote:

                > ... 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.

                or BOTH! -- using the configuration INI file as data file as well.
                I.e. without changing to a special INI file for the clip.


                I also want to point out the "^!Refresh" command, which supposedly
                fixes any changes to disk.

                I too have encountered strange behaviour, when changing values in INI
                variables (those that I define), and in configuration variables (that
                NoteTab defines). These seem to update erratically.

                Sofar I have not been able to pin this erratic behaviour down to any
                specific condition.

                There is one specific problem I can reproduce at will:
                Change configuration of the toolbar and the icons in the toolbar
                change size. I restore the icon size by making nonsensical changes to
                the icons in the toolbar configuration. Or I reload NoteTab --

                ergo: INI file problems.

                Just adding fuel to the fire <grin>

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