Jump to content
Sign in to follow this  
gcue

comparing filegetversions

Recommended Posts

gcue

i am comparing software versioning but cannot seem to get a proper reading..

the script below doesnt show that the $local_version < $remote_version

$local_version = "10.20.0.0"
;~ $remote = "9.0.0.0"
$remote_version = "10.20.0.1"

if Number($local_version) < Number($remote_version) Then
    ConsoleWrite("exiting" & @lf)
EndIf

the help file says Number("3.14") ;returns 3.14

any ideas?

Edited by gcue

Share this post


Link to post
Share on other sites
JoseS

i am comparing software versioning but cannot seem to get a proper reading..

the script below doesnt show that the $local_version < $remote_version

$local_version = "10.20.0.0"
;~ $remote = "9.0.0.0"
$remote_version = "10.20.0.1"

if Number($local_version) < Number($remote_version) Then
    ConsoleWrite("exiting" & @lf)
EndIf

the help file says Number("3.14") ;returns 3.14

any ideas?

The way I would do it (and some of the experts can correct me if I'm wrong...) would be to use StringCompare:

$local_version = "10.20.0.0"
;~ $remote = "9.0.0.0"
$remote_version = "10.20.0.1"

$test = StringCompare($local_version,$remote_version)

If $test = 0 Then
    ConsoleWrite("Strings are the same..." & @CRLF)
ElseIf $test > 0 Then
    ConsoleWrite("Local is greater than remote" & @CRLF)
Else
    ConsoleWrite("Remote is greater than local" & @CRLF)
EndIf

J

Share this post


Link to post
Share on other sites
gcue

works well!

thanks =)

Share this post


Link to post
Share on other sites
gcue

actually it doesnt work... as shown here:

$local_version = "10.20.0.0"
$remote_version = "9.0.0.0"

$test = StringCompare($local_version,$remote_version)

If $test = 0 Then
    ConsoleWrite("Strings are the same..." & @CRLF)
ElseIf $test > 0 Then
    ConsoleWrite("Local is greater than remote" & @CRLF)
Else
    ConsoleWrite("Remote is greater than local" & @CRLF)
EndIf

Share this post


Link to post
Share on other sites
gcue

hah didnt know it was there!

was looking in all the wrong places..

number, stringcompare, etc =)

thanks =)

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  

×