Jump to content
Sign in to follow this  
FreeSiker

Iniread problem

Recommended Posts

FreeSiker

Hi,

When i read the ini file, i receive the string but i'm not able to use it in my script (I think the problems come from the quotes)

Thank you

#include <Date.au3>

$config_ini = @ScriptDir & "\config.ini"

$heure_debut = IniRead($config_ini, "heures", "heure_debut", "NotFound")
MsgBox(4096, "Result", $heure_debut)

$heure_fin = IniRead($config_ini, "heures", "heure_fin", "NotFound")
MsgBox(4096, "Result", $heure_fin)

While 1

    If @HOUR > $heure_debut And @HOUR < $heure_fin Then
        exit
    EndIf

WEnd

config.ini file

[heures]
heure_debut=9
heure_fin=22
Edited by FreeSiker

Share this post


Link to post
Share on other sites
PsaltyDS

Hi,

When i read the ini file, i receive the string but i'm not able to use it in my script (I think the problems come from the quotes)

Numeric compares using string variables are a problem. In some cases AutoIt does an implied Number(), but you should do it explicitly:

$heure_debut = Number(IniRead($config_ini, "heures", "heure_debut", "NotFound"))
MsgBox(4096, "Result", "$heure_debut = " & $heure_debut)

$heure_fin = Number(IniRead($config_ini, "heures", "heure_fin", "NotFound"))
MsgBox(4096, "Result", "$heure_fin = " & $heure_fin)oÝ÷ Ø(ºWZÊ ®©¶§ºg«Ç(«zȧ¥ªÞÇè®Ø^n%y©À46®¶­sdbõU"fwC²b33c¶WW&UöFV'WBæBõU"fÇC²b33c¶WW&UöfâFVࢲââà¤VæD`

With those changes, it tests correctly for me.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.