Old 27th March 2002, 11:41   #1
saufplatzl
Junior Member
 
Join Date: Mar 2002
Location: Sweden
Posts: 3
Talking Version Checking..

Hi!
SuperPiMP rules!!
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)
saufplatzl is offline   Reply With Quote
Old 27th March 2002, 18:45   #2
Smile2Me
Guest
 
Posts: n/a
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.
  Reply With Quote
Old 2nd April 2002, 12:43   #3
saufplatzl
Junior Member
 
Join Date: Mar 2002
Location: Sweden
Posts: 3
Talking 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!

/ Saufplatzl
saufplatzl is offline   Reply With Quote
Old 2nd April 2002, 13:34   #4
Smile2Me
Guest
 
Posts: n/a
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.
  Reply With Quote
Old 2nd April 2002, 14:26   #5
Smile2Me
Guest
 
Posts: n/a
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.
Attached Files
File Type: zip versioncheck.zip (20.3 KB, 405 views)
  Reply With Quote
Old 2nd April 2002, 14:29   #6
Smile2Me
Guest
 
Posts: n/a
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.
  Reply With Quote
Old 3rd April 2002, 07:40   #7
saufplatzl
Junior Member
 
Join Date: Mar 2002
Location: Sweden
Posts: 3
Talking WOW!!

Thanks Hendri!!
Your the "Guru"!

I Will test the "VersionChecking-thingi" and will report asap back to you!
saufplatzl is offline   Reply With Quote
Old 3rd April 2002, 11:58   #8
Smile2Me
Guest
 
Posts: n/a
Quote:
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

-Greetz, Hendri.
  Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump