Jump to content

Iniread problem


Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...