SPONSORS:






User Tag List

Results 1 to 10 of 10
  1. #1
    Senior Member
    Join Date
    Oct 2001
    Location
    NC, United States
    Posts
    148
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Read .ini file values

    Is it possible to read an entire section in a .ini file both the variables and values stored in that section.(not knowing the variables in that section)

    ------------------
    -gram
    -gram

  2. #2
    Member
    Join Date
    Sep 2002
    Location
    Foster City, CA, USA
    Posts
    55
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Read .ini file values

    Yes, it's possible. It's a matter of string manipulation. Tell Silk to open the file and read each line. Between the unknown variable and it's value, there should be some sort of separation, such as an '=' sign. Example: myVar = Value1. It doesn't matter what the separation is. You could do a GetField() separating the 2 values.

    For example, to retrieve myVar, do a GetField (readinline, "=", 1). To retrive Value1, do GetField (readinline, "=", 2). Read more in help about GetField ().

  3. #3
    Senior Member
    Join Date
    Oct 2001
    Location
    NC, United States
    Posts
    148
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Read .ini file values

    to clarify what i'm looking for:

    take for example the domex.ini file. is there a easy way to get the entire [options] section, not knowing what is listed in it.

    ------------------
    -gram
    -gram

  4. #4
    Senior Member
    Join Date
    Nov 2001
    Location
    UK, Oxford
    Posts
    150
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Read .ini file values

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by gram:
    to clarify what i'm looking for:

    take for example the domex.ini file. is there a easy way to get the entire [options] section, not knowing what is listed in it.

    <HR></BLOCKQUOTE>

    This will print out something like:
    ShowBorderlessTables=.5
    ShowHtmlForm=FALSE
    UseDocumentEvents=FALSE

    depending on what is actually in your options section




    ------------------
    Tempus fugit, Carpe Diem, et al

  5. #5
    Senior Member
    Join Date
    Oct 2001
    Location
    NC, United States
    Posts
    148
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Read .ini file values

    thanks john
    thats a good solution . i get stuck only when there are blank lines within a section, but can work around knowing the next section name.

    ------------------
    -gram
    -gram

  6. #6
    Senior Member
    Join Date
    Jun 2000
    Location
    Sunyyvale CA USA
    Posts
    422
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Read .ini file values

    Friends,

    Silk offers function to read from ini file like INIFileOpen, GetValue, SetValue and Close functions. Assume the prefix of INIFile for all the above.


    ------------------
    Sree
    Sree

  7. #7
    Senior Member
    Join Date
    Nov 2001
    Location
    UK, Oxford
    Posts
    150
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Read .ini file values

    Did not know that, good call!

    ------------------
    Tempus fugit, Carpe Diem, et al

  8. #8
    KS
    KS is offline
    Senior Member
    Join Date
    May 2001
    Posts
    265
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Read .ini file values

    These ini file functions will work if you know the 'keys'/variables.
    To answer gram question there is no ST function that will read an entire section in a .ini file both the variables and values stored in that section.(not knowing the variables in that section)

    ------------------

  9. #9
    Senior Member
    Join Date
    Jun 2000
    Location
    Sunyyvale CA USA
    Posts
    422
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Read .ini file values

    What do you want to do if you do not know thekeys and variables. Then ini fileis not an option for you. May be select case.

    ------------------
    Sree
    Sree

  10. #10
    Junior Member
    Join Date
    Nov 2002
    Posts
    5
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Read .ini file values

    There is a function providing a reasonbly robust solution on the Segue forum:

    http://support.segue.com/forums/showflat.php?Cat=&B oard=silktest&Number=166&page=0&view=collapsed&sb= 5&o=93&fpart=1#Post177


    [This message has been edited by SecuriGuy (edited 11-04-2002).]

 

 

Posting Permissions

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

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 07:39 PM.

Copyright BetaSoft Inc.