I'm using a 98 host to check whether the user already has a given OCX. If not, I'll just download and register it; If the file is already present, I'll compare its version number with the one given in an INI located on the server : If the OCX on the server is more recent, we download and register; If the one on the host is more recent, we leave it as is, and go to end.
Thing is... it doesn't work. Incidently, the version number of an OCX isn't formatted exactly the same on 98 and W2K, but I suspect the reason why this script doesn't work is that IntCmpU is unable to compare numbers like "1.2.3.4".
Here's the INI that my NSIS scripts downloads and reads to get the version number of the OCX on the server, before comparing it with the one already on the host:
Most likely, I'm not the first one who wants to update the OCX's on a host by first comparing their version numbers against what's on the web server. Anybody has some working code?
;VERSION.INI
[mscomctl]
;BAD? mscomctl.ocx=6.01.9545
mscomctl.ocx=6.1.95.45
========================
;SETUP.NSI
# Input: $1 = name of file, $2 = full destination path on host, $9 = version or size on www, $3 = URL to path on www
Function CheckFile
IfFileExists $2 checkversion
Call Download
Goto register
checkversion:
GetDllVersion "$2" $R0 $R1
IntOp $R2 $R0 / 0x00010000
IntOp $R3 $R0 & 0x0000FFFF
IntOp $R4 $R1 / 0x00010000
IntOp $R5 $R1 & 0x0000FFFF
StrCpy $R8 "$R2.$R3.$R4.$R5"
;If version on host the same or more recent than one on www, go to end; else, download
DetailPrint "www=$9 local=$R8"
IntCmpU $9 $R8 end end 0
Call Download
Goto register
register:
RegDLL "$2"
end:
DetailPrint "File $1 OK"
FunctionEnd
Thank you :-)
JD.