Jump to content

comparing filegetversions


gcue
 Share

Recommended Posts

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...