Sign in to follow this  
Followers 0
CrazyMick

read ini-File

10 posts in this topic

Hello everybody,

I tried the following......but without success.

I´d like to read the values of special sections and keys inside an ini-file that is not on the local computer. This ini (for example a php.ini) is on a webserver.

Is it the only solution to download this file first with InetGet to the local harddrive to get these values ?

I need some of these values as global variables in my script and not every user likes it when other files were downloaded on their machines.

Thank you for your help.

Mick

Share this post


Link to post
Share on other sites



Is it the only solution to download this file first with InetGet to the local harddrive to get these values ?

Correct, you will have to download the content with InetGet or _InetGetSource() .

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Correct, you will have to download the content with InetGet or _InetGetSource() .

Okay, thank you for your quick answer.

Maybe than it´s necessary for me to find an other solution.

Mick

Share this post


Link to post
Share on other sites

Okay, thank you for your quick answer.

Maybe than it´s necessary for me to find an other solution.

Mick

Jos may have miscommunicated a bit; from the help file:

_INetGetSource

Gets the source from an URL without writing a temp file

#include <Inet.au3>
$Ini = _InetGetSource("http://www.autoitscript.com/autoit3/files/beta/update.dat")
MsgBox(0,"",$Ini)

Of course, you'll probably have to StringSplit the results to put it into an array and make it easier to handle/simulate the results of the IniRead() functions

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Jos may have miscommunicated a bit;

I believe I was pretty exact in my statement but maybe the OP misinterpreted it, anyways, you will have to download the whole content of the INI file and cannot get just one keyword value from the remote INI file. :)

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

I believe I was pretty exact in my statement but maybe the OP misinterpreted it, anyways, you will have to download the whole content of the INI file and cannot get just one keyword value from the remote INI file. :)

Jos

I agree, you were exact and the OP did misinterpret and I stuck myself in the middle :)

Anyway, I was just trying to point out that the OP seemed more concerned about

not every user likes it when other files were downloaded on their machines.

And when the OP asked

Is it the only solution to download this file first with InetGet to the local harddrive to get these values

and you replied with

Correct, you will have to download the content with InetGet or _InetGetSource()

I was afraid that the OP would interpret that to mean a download explicitly implied "to a file on the local hard drive", which of course it doesn't.

I just thought the subtle clue you left for him with _InetGetSource() was a little too subtle.

I never for a moment though you didn't know what you were talking about Jos.

Whew, I wouldn't want to be a diplomat... :)

Share this post


Link to post
Share on other sites

I never for a moment though you didn't know what you were talking about Jos.

Whew, I wouldn't want to be a diplomat... :)

Hey, was just "playing" here, no worries, and I will be the first one to admit to make mistakes too.

There is no need to be diplomatic about it. I can also handle the "Valik" approach without any problem. :)


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

#include <Inet.au3>
$Ini = _InetGetSource("http://www.autoitscript.com/autoit3/files/beta/update.dat")
MsgBox(0,"",$Ini)

Of course, you'll probably have to StringSplit the results to put it into an array and make it easier to handle/simulate the results of the IniRead() functions

Hello again,

a good way to read all of the values in one variable, but I´m sorry, I´m a noob with AutoIt and don´t understand enough to make the next steps.

When reading all values into the $ini, is it possible to split each value into another variable to get it declared as global in my script?

For example a test.ini:

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

[sECTION DAYS]

firstkey=Monday

secondkey=Tuesday

thirdkey=Wednesday

[sECTION MONTHS]

firstkey=May

secondkey=October

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

Is it possible?

Thanks

Mick

Edited by CrazyMick

Share this post


Link to post
Share on other sites

#include <Inet.au3>
$Ini = _InetGetSource("http://www.autoitscript.com/autoit3/files/beta/update.dat")
MsgBox(0,"",$Ini)

Hello again,

a good way to read all of the values in one variable, but I´m sorry, I´m a noob with AutoIt and don´t understand enough to make the next steps.

When reading all values into the $ini, is it possible to split each value into another variable to get it declared as global in my script?

For example a test.ini:

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

[sECTION DAYS]

firstkey=Monday

secondkey=Tuesday

thirdkey=Wednesday

[sECTION MONTHS]

firstkey=May

secondkey=October

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

Maybe it´s possible to read the ini-file with _InetGetSource, declare it as $ini, read the first value and set it as first variable into the script.

Then read the ini-file again, declare it as $ini again (or $ini2) and get the second value and so on and so on......until all values that are needed are inside the script.

The size of the ini is really small (about 1 kB) so that there´s not much traffic.

Is it possible at this way ?

Thanks

Mick

Share this post


Link to post
Share on other sites

#include <Inet.au3>
$Ini = _InetGetSource("http://www.autoitscript.com/autoit3/files/beta/update.dat")
MsgBox(0,"",$Ini)

Hello again,

a good way to read all of the values in one variable, but I´m sorry, I´m a noob with AutoIt and don´t understand enough to make the next steps.

When reading all values into the $ini, is it possible to split each value into another variable to get it declared as global in my script?

see solution here: http://www.autoitscript.com/forum/index.ph...st&p=530284

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  
Followers 0