Page 1 of 1 1
Topic Options
#152565 - 2005-11-30 06:56 PM If statement fails with getfileversion result
pfarrelli Offline
Fresh Scripter

Registered: 2005-11-16
Posts: 46
After Getfileversion assings a value to my variable $Version
and I confirm using
at (9,1) $Version which yeilds: 8.0.0.825
The following statment does not hold true:

IF ($Version < 10)
do all this funky stuff
EndIf

Why?

Top
#152566 - 2005-11-30 08:39 PM Re: If statement fails with getfileversion result
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
You could do a substring of $version and compare on the outcome like this.

Code:

$version = "8.0.0.825"
$subversion = SubStr ($version, 1, 2)

If $subVersion <> "10"
?"Version is not 10"
?"Doing some funky stuff now."
EndIf

_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#152567 - 2005-11-30 08:50 PM Re: If statement fails with getfileversion result
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
also, changing to this does work:
Code:

IF 10 > $Version
; do all this funky stuff
EndIf



because, kixtart automatically translates the vartypes.
thus, in your code you test long string to "10"
the string is longer thus 10 is smaller.
when you place the number 10 first, the version string is translated to number and becomes 8.
_________________________
!

download KiXnet

Top
#152568 - 2005-12-03 06:52 PM Re: If statement fails with getfileversion result
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
A) You're comparing strings with numbers
B) There are multiple UDF in the UDF Forum that perfomr version compares, search the UDF Froum for 'version'.
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 581 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.072 seconds in which 0.048 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org