Jump to content
Sign in to follow this  
rabothole

IniReadSectionNames HELP

Recommended Posts

rabothole

Hi All,

I've got a cool new script that i want to finish but cannot do so until I've got the solution to this:

I could not upload the ini file it looks like this:

[rabothole]
server=192.168.1.101
username=username
password=password
remotedir=newdir

and the normal IniReadSectionNames() from the help file (modified a bit to test the results):

#include<array.au3>
Dim $avArray[1]

$var = IniReadSectionNames("c:\test\ini\control.ini")
If @error Then 
    MsgBox(4096, "", "Error occurred, probably no INI file.")
Else
    For $i = 1 To $var[0]
;~      MsgBox(4096, "", $var[$i])
        _ArrayAdd($avArray, $var[$i])
    Next
    
EndIf
_ArrayDisplay($avArray,"")

and i'm getting the following:

Posted Image

can anyone advise please?

thanx

Share this post


Link to post
Share on other sites
weaponx

You didn't say what the problem is...

Share this post


Link to post
Share on other sites
rabothole

You didn't say what the problem is...

Sorry my ini file only has one entry the ini displayed is the only text in my ini but the array returns lots of other things - also tested on one of my XP machines and returned more screensaver.3dflowerbox etc.

Share this post


Link to post
Share on other sites
rabothole

Sorry my ini file only has one entry the ini displayed is the only text in my ini but the array returns lots of other things - also tested on one of my XP machines and returned more screensaver.3dflowerbox etc.

Share this post


Link to post
Share on other sites
weaponx

Well whatever is shown in your picture HAS to be in "c:\test\ini\control.ini", AutoIt isn't pulling these values out of a magic hat.

Share this post


Link to post
Share on other sites
rabothole

Well whatever is shown in your picture HAS to be in "c:\test\ini\control.ini", AutoIt isn't pulling these values out of a magic hat.

if i could upload the ini file i could show you that it comes from somewhere but not the ini. i could not explain it myself when i ran it.

Share this post


Link to post
Share on other sites
weaponx

if i could upload the ini file i could show you that it comes from somewhere but not the ini. i could not explain it myself when i ran it.

Well you can post it as an attachment or you can open the file and copy and paste the contents here.

Edited by weaponx

Share this post


Link to post
Share on other sites
rabothole

thanks for the help anyway i renamed the file to ctrl_file.ini and not getting the same any more, duno what could be wrong! the strange thing was even if i just called the control.ini and it was not there then the array would give me results.

Share this post


Link to post
Share on other sites
DarkMatter

The only problem I could see with it being named control.ini is because Windows 95, 98, ME, 2000, and XP has a control.ini. This file is used to customize and change how the Control Panel operates and what is seen in the Control Panel.

Don't see how, but maybe AutoIT was defaulting to that because its in the %SYSTEMROOT% I know it sounds like a stretch but I have seen this happen before in C++ and .NET.

Maybe an explanation for why it started to work AFTER you renamed the file.

Edited by DarkMatter

[sub]Quantum mechanics: The dreams stuff is made of[/sub]

Share this post


Link to post
Share on other sites
rabothole

Thanks Again, like I said I renamed the file and changed my script to see the different file name and all worked 100%, I tested the script without the control.ini and still gave me an answer on XP and Vista.

All i can say is the basic of the script is done, AND I KNOW NOT TO USE AN INI FILE WITH THE NAME CONTROL.INI, weird but true.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×