Page 1 of 1 1
Topic Options
#163342 - 2006-06-16 05:06 PM Really easy one...
Mstudinski Offline
Fresh Scripter

Registered: 2006-05-19
Posts: 25
Basically what I am trying to do is compare a file version from a local machine to a server. If the client version is different than the server version I want it to write to a file. The code below works as planned but I wanted to add the fileversion to the line it writes to the file. This should be easy answered. I know very little about Kix and am just learning.

Thanks!

Matt

Code:
Break On
Dim $SO
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')
$SO=SetOption('NoMacrosInStrings','On')

DIM $LFile, $SFile, $LVersion, $SVersion, $Msg, $FFile
$LFile = "C:\Program Files\Citrix\pn.exe"
$LVersion = GetFileVersion($LFile,'BinFileVersion')
$SFile = "\\ctmstxp\ctx$\pn.exe"
$SVersion = GetFileVersion($SFile,'BinFileVersion')

If @ERROR
'Error getting LOCAL file information: ' + @ERROR + ' - ' + @SERROR ?
EndIf

'Local file version is: ' + $LVersion ?
'Server file version is: ' + $SVersion ?

If $SVersion <> $LVersion
OPEN (1, "\\ctmstxp\ctx$\ica.txt", 5)
WRITELINE (1, @USERID + " has old ica client version" + @CRLF)
Close(1)
ENDIF




Top
#163343 - 2006-06-16 05:18 PM Re: Really easy one...
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Code:
WRITELINE (1, @USERID + " has old ica client version" + $LVersion + @CRLF)

_________________________
Today is the tomorrow you worried about yesterday.

Top
#163344 - 2006-06-16 05:46 PM Re: Really easy one...
Mstudinski Offline
Fresh Scripter

Registered: 2006-05-19
Posts: 25
Great. Works like a charm. Thanks a lot. I tried the same thing but forgot a +.

Matt

Top
#163345 - 2006-06-18 03:30 PM Re: Really easy one...
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
You should probably use the CompareVersions() UDF in order to suppress false-positives due to different version number formatting. For example, "1.01.01" and "1.1.1" should be the same version but your code will not account for this.
_________________________
There are two types of vessels, submarines and targets.

Top
#163346 - 2006-06-19 06:25 AM Re: Really easy one...
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
Quote:

1.01.01" and "1.1.1" should be the same version




Well not to nit pick but no they are not the same version. Deciding if you're going to show the 1st digit, 2nd digit, 3rd digit may change how is visually looks. Excel has that feature too where you can sort numbers by how they are show on screen or how they REALLY are.

.10 vs .01 are still not the same.

Top
#163347 - 2006-06-19 07:04 AM Re: Really easy one...
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
lol.
doc, yes, .10 and .01 are not the same but afaik, it's "well known" matematical rule that leading zeros are useless.
thus .1 and .01 are exaxctly the same.
_________________________
!

download KiXnet

Top
#163348 - 2006-06-19 07:09 AM Re: Really easy one...
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
btw, ruud does try to give the leading zero a meaning.
like it was the minor version number of kixtart. think in his mind the current upcoming release feels like 4.5.2 to us.
but that aside, the numbering schema, even though not standard, still does not excuse the leading zero of 4.00 (aka 4.0.0)
as it comes to updates, 4.01 or 4.1 are both as much newer versions than 4.00, no matter how many zero's one wishes to place there.
_________________________
!

download KiXnet

Top
#163349 - 2006-06-19 07:45 AM Re: Really easy one...
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
Oh I don't care to argue that one as you're right, very few software authors do proper versioning.

Yes in general for day to day numbers the leading 0 is ignored, but NOT when one places a decimal there and is attempting to do math on it. If you want .1 then make it .1 that is fine, but don't try to argue that you can do math on .1 and .01 and it will come out right, you're math teacher will give you a failing grade.

Top
#163350 - 2006-06-19 02:42 PM Re: Really easy one...
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
You guys are missing the point. It's not case of apples and oranges. Matt is comparing one file to another of the same purpose and the same author. One could reasonably expect that both files would have the same versioning scheme.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

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 1198 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.136 seconds in which 0.073 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