+ Reply to Thread
Results 1 to 4 of 4

Thread: write_ini command

  1. #1
    Senior Member
    Join Date
    Aug 2011
    Location
    British Columbia, Canada
    Posts
    383

    write_ini command

    Hi,

    The write_ini command has according to the help system, the format:

    Write_Ini(r,"section","parameter","filename")

    Currently if t-reg r is empty, the write_ini command does nothing. Am I correct in this?

    It would seem to me to be better that if t-reg r is empty, in the ini file, you would see:

    parameter=

    or, perhaps the parameter= line should be deleted.

    So if you had:

    Write_Ini(30,"filenames","file3","config.ini")

    if t-reg 30 holds mynotes.txt then the command put in the config.ini under section [filenames]

    file3=mynotes.txt

    However if t-reg 30 is empty, and the write_ini command executed again, no change is made.

    So I am saying, instead of nothing, either the ini file should show:

    file3=

    or the line:

    file3=mynotes.txt

    is deleted.

    Comments?

    Scott
    Using Vedit 6.21.3, (32 bit), dated 9/12/11 running on Windows 7 (64 bit).

  2. #2
    Senior Member
    Join Date
    Nov 2014
    Location
    Minneapolis, MN
    Posts
    278
    Quote Originally Posted by Scott Lambert View Post
    Hi,

    The write_ini command has according to the help system, the format:

    Write_Ini(r,"section","parameter","filename")

    Currently if t-reg r is empty, the write_ini command does nothing. Am I correct in this?

    It would seem to me to be better that if t-reg r is empty, in the ini file, you would see:

    parameter=

    or, perhaps the parameter= line should be deleted.

    So if you had:

    Write_Ini(30,"filenames","file3","config.ini")

    if t-reg 30 holds mynotes.txt then the command put in the config.ini under section [filenames]

    file3=mynotes.txt

    However if t-reg 30 is empty, and the write_ini command executed again, no change is made.

    So I am saying, instead of nothing, either the ini file should show:

    file3=

    or the line:

    file3=mynotes.txt

    is deleted.

    Comments?

    Scott

    Hi Scott,

    1: My preference is the option, file3= .

    I general, I like to invoke general principles and here it is: I would like to display in the .ini file all the parameters that the macro takes. I just learned the importance of the wildfilew.ini file. Apparently, I hit a "highly unusual" situation. I gave a detailed report on it in the "Possible conflict between Wildew.vdm and Win 7 thread. In short, editing the wildfilew.ini file solved my problem.

    2: Now the other option: file3=mynotes.txt is deleted.

    It is also a general principle that I like to keep track of the changes that a macro does to my files. Actually, this is alimiting case since I instructed the macro to make the change.
    How about having a new section [RECENT-FILES], or something like that. I would take the exaact name from VEDIT.INI.

    I studied the Online Help for the write.ini command. It says that if a section does not exist, the command creates it. I would not be able to write a code to maintain such a section. At the same time, I am hoping that the built in Vedit command which does this task can be imported. Specifically, I hope that your subroutine macro from the old BBS has a code that could be adapted.

    -peter
    Last edited by rejto12; December 17th, 2015 at 02:03 PM.

  3. #3
    Senior Member
    Join Date
    Aug 2011
    Location
    British Columbia, Canada
    Posts
    383
    Hi Peter,

    In doing some testing in order to reply, I discovered that one can blank a parameter by setting the register in write_ini to a space.

    So first we need to create a test file:

    reg_set(40,"|(user_home)\peter.ini") // set path of ini file
    reg_set(41,"notes.txt") // what is to be written to ini file
    write_ini(41,"files","file1",@40) // write it


    After executing the above, you will find peter.ini in your user_home and having the line: file1=notes.txt

    now instead of notes.txt, we set t-reg 41 to a space:

    reg_set(40,"|(user_home)\peter.ini") // set path of ini file
    reg_set(41," ") // what is to be written to ini file
    write_ini(41,"files","file1",@40) // write it

    You will see the line reads file1=

    I still think if t-reg 41 is empty, it should blank the parameter instead of doing nothing. Any ways wish I had discovered this much earlier.

    Scott
    Using Vedit 6.21.3, (32 bit), dated 9/12/11 running on Windows 7 (64 bit).

  4. #4
    Senior Member
    Join Date
    Nov 2014
    Location
    Minneapolis, MN
    Posts
    278

    I think that this is eally cool.

    Quote Originally Posted by Scott Lambert View Post
    Hi,

    The write_ini command has according to the help system, the format:

    Write_Ini(r,"section","parameter","filename")

    Currently if t-reg r is empty, the write_ini command does nothing. Am I correct in this?

    It would seem to me to be better that if t-reg r is empty, in the ini file, you would see:

    parameter=

    or, perhaps the parameter= line should be deleted.

    So if you had:

    Write_Ini(30,"filenames","file3","config.ini")

    if t-reg 30 holds mynotes.txt then the command put in the config.ini under section [filenames]

    file3=mynotes.txt

    However if t-reg 30 is empty, and the write_ini command executed again, no change is made.

    So I am saying, instead of nothing, either the ini file should show:

    file3=

    or the line:

    file3=mynotes.txt

    is deleted.

    Comments?

    Scott

    Hi Scott,

    Thanks as always.

    -peter

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts