SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 9 of 9
  1. #1
    Member
    Join Date
    Feb 2006
    Location
    pune
    Posts
    33
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    How silk test can read INI file

    hi
    i am tring to read a ini file this having information in folowing format

    [Bulid]
    myProduct121.0.11

    [File Location]
    \\my-pc\software\

    [UserName]

    [Password]

  2. #2
    Senior Member
    Join Date
    Apr 2006
    Posts
    285
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How silk test can read INI file

    Your ini-file structure doesn't match to rrequired by SilkTest. Ini-file which can be read by silktest has a set of sections in the following format:

    [<section name>]
    <parameter>=<value>

    <parameter>=<value> pairs must be placed just undersection node.

    Example of ini-file:

    [Test]
    name=Test
    count=5
    date=10/15/06

    [AnotherSection]
    Id=Example
    code={342,56456}

  3. #3
    Junior Member
    Join Date
    Oct 2001
    Location
    MD, USA
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How silk test can read INI file

    In the above example, the SilKTest code would be:

    HINIFILE hIni
    STRING sValue
    INTEGER iValue

    hIni = IniFileOpen ("yourIniFileAbove.ini")
    sValue = IniFileGetValue (hIni, "Test", "name")
    iValue = IniFileGetValue(hIni, "Test", "count")

    Print(sValue)
    Print(iValue)

    >Test
    >5

  4. #4
    Super Member
    Join Date
    Jul 2001
    Location
    Earth
    Posts
    1,882
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How silk test can read INI file

    Or if you have a good framework you can do something like:

    <font class="small">Code:</font><hr /><pre>

    INIFile.sFileName = "c:\myfile.ini"
    INIFile.GetValue ("Test", "name")
    INIFile.SetValue ("Test", "name", "New Value")
    </pre><hr />

  5. #5
    Junior Member
    Join Date
    Nov 2007
    Location
    Denver, CO
    Posts
    5
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How silk test can read INI file

    cliffo uses an int with IniFileGetValue. Is that possible? I keep getting an error and the help says that it expects a string.

  6. #6
    Advanced Member
    Join Date
    May 2005
    Location
    Fremont, CA
    Posts
    832
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How silk test can read INI file

    What kind of an error are you getting?

    dimaj

  7. #7
    Senior Member
    Join Date
    Feb 2004
    Location
    Canada
    Posts
    291
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How silk test can read INI file

    jparagon, you are correct. IniFileGetValue() returns a string so you would get an error trying to use an integer. If the value is a number you can convert it with Val().

  8. #8
    Member
    Join Date
    Sep 2007
    Location
    Overland Park, KS
    Posts
    90
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How silk test can read INI file

    Be aware there is a bug with SilkTest's INI routines. You can write a long string fine, but when reading it back, it gets truncated at 256 characters. So, if you need to read longer strings, you may want to try a different method.
    Dana Cline

  9. #9
    Junior Member
    Join Date
    Nov 2007
    Location
    Denver, CO
    Posts
    5
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How silk test can read INI file

    Good info.. Thanks all

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 7.89%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin 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 04:27 AM.

Copyright BetaSoft Inc.