Jump to content
Sign in to follow this  
J0ker

Ini Read error

Recommended Posts

Hi,

I have an ini file to store all infos used in my script. I want to check if all infos were right filled at beginning of my script.

Global $Statement = IniRead(@SCRIPTDIR & "\Config.ini", "This", "House", 0)

;Make sure that all settings are OK
    
    If $Statement <> "House" <> "Building" <> "Bungalow" Then
        MsgBox(0,"Error","Statement Error, Make sure to write the right infos in the Config.ini file")
        Sleep(50)
        Exit
    EndIf

It's only working for the word House because its the first after the If but for the other words, it's not working. What should I change to this code? The problem dont come from the Ini Read, but from the If statement.

Share this post


Link to post
Share on other sites

If $Statement <> "House" And $Statement <> "Building" And $Statement <> "Bungalow" Then

Share this post


Link to post
Share on other sites

If $Statement <> "House" And $Statement <> "Building" And $Statement <> "Bungalow" Then

Thanks! :)

Is this can be simplified?

Global $Level = IniRead(@SCRIPTDIR & "\Config.ini", "Level", "Level", 0)

If $Level > 29 then
        MsgBox(0,"Error","Level Error ")
        Sleep(50)
        Exit
    EndIf
    
    If $Level < 0 then
        MsgBox(0,"Error","Level Error ")
        Sleep(50)
        Exit
    EndIf
Edited by J0ker

Share this post


Link to post
Share on other sites

Global $Level = IniRead(@SCRIPTDIR & "\Config.ini", "Level", "Level", 0)

If ($Level > 29) OR ($Level < 0) then
    MsgBox(0,"Error","Level Error ")
    Exit
EndIf

Try this


Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

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  

×
×
  • Create New...