Sign in to follow this  
Followers 0
KurogamineNox

Code Refuses to Work

4 posts in this topic

Okay, something is fishy. My code just refuses to work.

if Not $version = "1.1" Then
        MsgBox(4096, "Update", "Update Available, Must Download Update Version. Program Shutting Down")
        ShellExecute("http://halconknights.webs.com/")
        Exit
EndIf

When it gets the version number it is 1.2, yet the if Not statement just refuses to work. Since $version = 1.1 is not true, the not statement should work, or am I just mistaken?

Share this post


Link to post
Share on other sites



Try

$version='1.2'

if $version <> "1.1" Then
        MsgBox(4096, "Update", "Update Available, Must Download Update Version. Program Shutting Down")
        ShellExecute("http://halconknights.webs.com/")
        Exit
EndIf

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

You are using Not the wrong way. To do what you want you need:

$iVersion = "1.2"

If Not ($iVersion = "1.1") Then
    ConsoleWrite(Random() & @CRLF)
EndIf

Or even better, the "not equal" sign:

$iVersion = "1.2"

If $iVersion <> "1.1" Then
    ConsoleWrite(Random() & @CRLF)
EndIf

So why didn't your code work? Run this and you should get it:

ConsoleWrite((Not $iVersion) & @CRLF)
ConsoleWrite((False = "1.1") & @CRLF)

Share this post


Link to post
Share on other sites

Alright thanks. Ill have to look into more on the Not stuff then.

Changing the = into <> worked. So thanks again.

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