Sign in to follow this  
Followers 0
Klexen

Have program read ini files value if value was written on launch

2 posts in this topic

#1 ·  Posted (edited)

Okay, I have a program ask a question, then depending on answer write a 1 or a 0 to an ini file. Well I want my program to recognize the change instead of having to relaunch the program.

Any ideas?

Here is the function.

Func OutlookLaunch()
    $AskOutlook = MsgBox(4,"Webmail or Outlook?","Would you like to use Webmail instead of Outlook?")
    If $AskOutlook = 6 Then 
    IniWrite($File_Location,"OutlookOption","Webmail","1")
    OutlookWeb()
    Else
    IniWrite($File_Location,"OutlookOption","Webmail","0")
    LaunchOutlook()
    EndIf
EndFunc

Oops.... I just realized I posted this in the wrong forum... Sorry.

Edited by Klexen

Share this post


Link to post
Share on other sites



Seems to work alright here man. Maybe your problem is when you read those values?

Also, keep in mind that IniRead will return a string. So, if you do something like this:

OutlookLaunch()
$Value=IniRead("myini.ini","OutlookOption","Webmail","1")
MsgBox(0,"",$Value)

If $value Then
    MsgBox(0,"","Activated")
Else
    MsgBox(0,"","Deactivated")
EndIf

Func OutlookLaunch()
    $AskOutlook = MsgBox(4,"Webmail or Outlook?","Would you like to use Webmail instead of Outlook?")
    If $AskOutlook = 6 Then 
    IniWrite("myini.ini","OutlookOption","Webmail","1")
    Else
    IniWrite("myini.ini","OutlookOption","Webmail","0")
    EndIf
EndFunc

You'll always get the messagebox saying "activated", because $Value is always true. But if you do it this way:

If $value="1" Then
    MsgBox(0,"","Activated")
Else
    MsgBox(0,"","Deactivated")
EndIf

should work just fine.

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