Archive: Version Checking..


Version Checking..
Hi!
SuperPiMP rules!! :D
How can i "remove" dot's (.) from a uservariable

eg
$7 = 1.3.1
$8 = 1.4.0

IntCmp $7 $8 lbl_eq lbl_less lbl_more
(this won't work)
------- the Function -------
Function .onInit
StrCpy $0 "SOFTWARE\JavaSoft\Java Runtime Environment"
ReadRegStr $2 HKLM $0 "CurrentVersion"
StrCmp $2 "" SDKCheck
ReadRegStr $6 HKLM "$0\$2" "JavaHome"
ReadRegStr $7 HKLM "$0\$2" "MicroVersion"
StrCmp $6 "" SDKCheck
Goto GetJRE
SDKCheck:
StrCpy $0 "Software\JavaSoft\Java Development Kit"
ReadRegStr $2 HKLM $0 "CurrentVersion"
StrCmp $2 "" NoJava
ReadRegStr $6 HKLM "$0\$2" "JavaHome"
ReadRegStr $7 HKLM "$0\$2" "MicroVersion"
StrCmp $6 "" NoJava
GetJRE:
StrCpy $3 "$6\bin\java.exe"
StrCpy $4 "$6\bin\javaw.exe"
IfFileExists $3 0 NoJava
IfFileExists $4 0 NoJava
Goto Java
NoJava:
MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION "Sun's Java Runtime Environment which is needed for OM-Online ${VERSION} was not found.$\r$\nHit 'Yes' to install Sun Java JRE 1.4.0$\r$\nHit 'No' to cancel the installation and continue to install OM-Online.$\r$\nHit 'Cancel' to cancel the installation." IDYES InstJava IDNO NoInstJava
Abort
InstJava:
SetOutPath $TEMP\java
File FILES\JAVA\j2re-1_4_0-win-i.exe
ExecWait $TEMP\java\j2re-1_4_0-win-i.exe
Goto End
NoInstJava:
Goto End
Java:
StrCpy $8 "$2.$7"
StrCpy $9 "1.4.0"
IntCmp $8 $9 equal less

MessageBox MB_OK|MB_ICONEXCLAMATION "MORE $8 $9"
Goto End
equal:
MessageBox MB_OK|MB_ICONEXCLAMATION "EQUAL $8 $9"
Goto End
less:
MessageBox MB_OK|MB_ICONEXCLAMATION "LESS $8 $9"
Goto End
End:
-------- END ----------------
(sorry for my bad english):igor:


If I can give an advise:

It's better not to remove the dots, but check the stringparts between the dots separately.
Eg.: how to compare 2401 (2.4.01) and 35 (3.5)
It would give inconsistent results when removing dots when comparing version info (in this case 2401 > 35 while 3.5 is newer than 2.4.01!!!)

So write a function that first checks 2 > 3 (yes or no) then (if still necessary) 4 > 5 (yes or no) etc...

Get the point? Maybe the easiest way is to write a small dll, because there are a lot of conditions (if) and it would become a mess in NSIS using a lot of StrCmp and even more labels...

But just an advise, good luck, take care,
greetz, Hendri.


Thanks Smile2Me!
Of course!! Thanks Smile2Me!
Hmmm...DLL ey..
I'am not "into" DLL's (I'am just a Java freak)
But I will try! :eek:

/ Saufplatzl


Well, it's possible in NSIS but then you need to know the exact structure of the version numbers (1, 2 or 3 dots, so 4.3.2.1 or just 3.2) Otherwise it becomes really messy if you have to check all strings if they exist and so on. Moreover you will need a conditional loop conditional on the fact that one of the two version numbers might already have ended and things like that. Maybe I will think about a solution in NSIS, cant promise it yet...

Good luck,
greetz, Hendri.


Well here's a function that compares 2 version numbers no matter what their structure is (eg.: 3.5 and 2.4.6.1). As I promised, the source is a bit messy, but anyway, it works (I tested it a few times and I think it's OK, just test it yourself...)

Good luck with the installer, greetz,
-Hendri.


BTW, if you still want to remove the dots from the strings, take a look at this thread (I created a StrReplace function...)

http://forums.winamp.com/showthread....threadid=83283

Greetz,
-Hendri.


WOW!!
Thanks Hendri!!
Your the "Guru"! :D

I Will test the "VersionChecking-thingi" and will report asap back to you!:D


Thanks Hendri!!
Your the "Guru"!

I Will test the "VersionChecking-thingi" and will report asap back to you!
OK let me know if it works like you wanted.
And thx for the nice words :D:D:D

-Greetz, Hendri.