Sign in to follow this  
Followers 0
J0ker

Ini Read error

5 posts in this topic

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



#3 ·  Posted (edited)

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

Yep it work, I did not know that the OR statement existed :) my bad

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