Sign in to follow this  
Followers 0
LapidusCreatorium

Remote Config File

5 posts in this topic

Hello,

I have this issue:

I have an application that needs to download or if possible get the data from a remote file located on a webserver.

The config file is basically an ini file which contains some instructions.

Look like that:

[config]
updated=1
[link]
key=5
[words]
words="Word1, Word2, Word3, Word4, etc"

The problem is that I need to extract the number and the actual "words" into an array and than get the values randomly.

Something like this:

Local $avArray[4]

$avArray[0] = "Word1"
$avArray[1] = "Word2"
$avArray[2] = "Word3"
$avArray[3] = "Word4"

Func RWords()
Word = Random ( 0,3,1 )
MsgBox(0,"Result",$avArray[$Word])
EndFunc

I am still a beginner in autoit:) and I have no idea how to do this.

Could you give me some help?

Thank you.

Share this post


Link to post
Share on other sites



Ok,

I got it to split the words by comma delimiter by using stringsplit.

But how to add them in an array and how to get the number of entries?

Share this post


Link to post
Share on other sites

Hi there m8

something like this?

Local $avArray[4]

$avArray[0] = "Word1"
$avArray[1] = "Word2"
$avArray[2] = "Word3"
$avArray[3] = "Word4"

$lim = UBound($avArray)

RWords()

Func RWords()
    for $x = 0 to $lim -1
        $Word = Random ( 0,3,1 )
        $avArray[$x] = $word
        ConsoleWrite("Result : " & $avArray[$x] & @crlf)
    next
EndFunc

Cheers


Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Share this post


Link to post
Share on other sites

Ok,

I got it to split the words by comma delimiter by using stringsplit.

But how to add them in an array and how to get the number of entries?

Hi again :)

StringSplit in Helpfile :

Returns an array, the first element ($array[0]) contains the number of strings returned, the remaining elements ($array[1], $array[2], etc.) contain the delimited strings.

So : StringSplit does all the work for you.

Ubound would be useful :)

Cheers


Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Share this post


Link to post
Share on other sites

Hi again :)

StringSplit in Helpfile :

Returns an array, the first element ($array[0]) contains the number of strings returned, the remaining elements ($array[1], $array[2], etc.) contain the delimited strings.

So : StringSplit does all the work for you.

Ubound would be useful :)

Cheers

Oh. stupid me.. didn't read all of that o:)

Thank you for your help.

Very appreciated.

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