SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 3 of 3
  1. #1
    Junior Member
    Join Date
    Mar 2008
    Location
    Germany
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Storages.ini GetOption - Problem reading ini iile

    Hello,

    this is my first time using TestComplete and VBScript, so may the solution is very simple, also i have no previous experience writing VBscripts with TestComplete. At the moment i'm using the TestComplete 6.

    I want to read data from a ini File. First i write some informations in the ini file and save it.

    <font class="small">Code:</font><hr /><pre>
    Set iniFile = Storages.Ini("C:\imp1.ini")
    Set SectionSub = iniFile.GetSubSection("BasicInformation")
    SectionSub.SetOption "Tester", "xyz"
    SectionSub.SetOption "Date", "05.03.08"

    Set SectionSub = iniFile.GetSubSection("Product")
    SectionSub.SetOption "Name", "xyz"
    SectionSub.SetOption "Version", "xyz1"

    iniFile.Save
    </pre><hr />

    The strcuture of the created file looks like this:

    <font class="small">Code:</font><hr /><pre>
    [BasicInformation]
    Tester=xyz
    Date=05.03.08

    [Product]
    Name=<font color="red">xyz123</font>
    Version=xyz1
    </pre><hr />

    The script creating and writing the ini file with the informations above. And now my problem, i want to read a value (red underlined) from that ini file. (Product -&gt; Name)

    <font class="small">Code:</font><hr /><pre>
    Result = SectionSub.GetOption("Name",1)
    MsgBox(Result)
    </pre><hr />

    The Value of result is the default value "1", but i need the value of name (it must be "xyz123").

    best regards
    Daniel

  2. #2
    Senior Member
    Join Date
    Aug 2006
    Posts
    1,920
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Storages.ini GetOption - Problem reading ini iile

    Hi Daniel,

    There's a type mismatch in the second parameter of the GetOption method. Try using the following code (it works fine for me):
    <font class="small">Code:</font><hr /><pre>...
    Result = SectionSub.GetOption("Name","1")
    ...</pre><hr />
    Jared - AQA Support

  3. #3
    Junior Member
    Join Date
    Mar 2008
    Location
    Germany
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Storages.ini GetOption - Problem reading ini iile

    Thats it, thank you for your fast answer [img]/images/graemlins/smile.gif[/img]

 

 

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 11.54%
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 12:29 AM.

Copyright BetaSoft Inc.