Jump to content
Sign in to follow this  
AzKay

Updater, If $Current = $Newest Then MsgBox()

Recommended Posts

AzKay

$CurrentVersion = IniRead("Setting.ini", "Version", "Current", "")

$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("GET", "http://h1.ripway.com/ROToolbox/CurrentVersion.txt")
$oHTTP.Send()
$NewestVersion = $oHTTP.Responsetext

If $CurrentVersion = $NewestVersion Then
    MsgBox(0, "Info", "Your have the latest version.")
Else
    If $CurrentVersion < $NewestVersion Then
        $Update = MsgBox(4, "Info", "Update Available. Update Now?")
        If $Update = 6 Then Update()
    EndIf
EndIf

Func Update()
    IniWrite("Setting.ini", "Version", "Current", $NewestVersion)
EndFunc

Here the ini

[Version]
Current=1

Heres my problem, It always says It needs to update, even if its the same "Version" as the newest.

The ini says 1, then NewestVersion.txt says 1, I checked in a msgbox, they are both 1, yet, it still says its less.


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites
MHz

Try converting the strings stored in the variables with Int() before testing the condition.

:P

Share this post


Link to post
Share on other sites
AzKay

Works now, Thanks ^^

Edited by AzKay

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites
Xenobiologist

Hi,

$CurrentVersion = IniRead("Setting.ini", "Version", "Current", "")

$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open ("GET", "http://h1.ripway.com/ROToolbox/CurrentVersion.txt")
$oHTTP.Send ()
$NewestVersion = $oHTTP.Responsetext

Select
    Case Int($CurrentVersion) = Int($NewestVersion)
        MsgBox(0, "Info", "Your have the latest version.")
    Case Int($CurrentVersion) < Int($NewestVersion)
        If MsgBox(4, "Info", "Update Available. Update Now?") = 6 Then Update()
EndSelect

Func Update()
    IniWrite("Setting.ini", "Version", "Current", $NewestVersion)
EndFunc  ;==>Update

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

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.