Archive: StrCmp not working for me??


StrCmp not working for me??
My code below displays the message box whether $R1 is empty or not. Any ideas on what my problem is? Thanks in advance!!!

Function UninstallOldVersion
push $R1
ReadRegStr $R1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT}" "UninstallString"
StrCmp $R1 "" UninstallOldVersion_noold
MessageBox MB_OK $R1
ExecWait '"$INSTDIR\uninstall.exe upgrade" _?=$INSTDIR'
UninstallOldVersion_noold:
pop $R1
FunctionEnd


Works for me, which version of nsis are you using?

Vytautas


I created a function that shows me the contents of the $0-$9 and $R0 - $R9. I have found it usefull when coming to debug the code.

I have included it in the attached script. Tryit and let us know if you have managed to solve the problem.


Oops. Forgot the attachment.:D


If you want a program to show the status of nsis script, i.e. variables, stack, etc. you should use the dumpstate plugin available on the NSIS Archive.

Vytautas


The more I work with this product and find these jewels and pearls that people have written to improve and enhance the more I LOOOVE the product. Guys I have to say this. Keep it up. You Rock.
:D


Vytautas, I am using version 2.0 beta 3. So, you're saying that if $R1 is filled, your version skips the MessageBox? I don't get that at all???


Yes I have tried your code with the latest CSV version and it worked fine, i.e. if the registry key did not exist it skipped the MessageBox and if it did it showed it.

You might have to download the newest NSIS version, however you should note that you most likely have to modify your existing scripts to compile with the CSV version.

Vytautas


I'm glad you brought that up...CSV that is. What exactly is that (I'm pretty new to NSIS, if you couldn't tell)? And, what is different with the CSV version from the version I have?


CVS (Concurrent Versions System) is a tool used by many software developers to manage changes within their source code tree. CVS provides the means to store not only the current version of a piece of source code, but a record of all changes (and who made those changes) that have occurred to that source code. Use of CVS is particularly common on projects with multiple developers, since CVS ensures changes made by one developer are not accidentally removed when another developer posts their changes to the source tree.

http://sourceforge.net/cvs/?group_id=22049

If this helps.


In other words CSV is the newest version of the software available, it quite often contains bugs and always contains new features. The most recent version of nsis can be found here.

Vytautas


CVS (not CSV) is Concurrent Versioning System and is a sytem used by SourceForge and others to store source code. The NSIS source code is stored on cvs.sourceforge.net and a tool like TortoiseCVS or NSIS Update (which uses TortoiseCVS for you) can "sync" to the latest copy of the source code and executables stored in CVS, i.e. copy them to your computer. NSIS Update goes one step further, it compiles the makensis.nsi file with makensis and then runs the created installer so that you get a properly installed latest copy of NSIS.

The NSIS developers make their changes to the source code in CVS and so when you get this code and the executables you get the most recent copy of NSIS that exists. This page shows what changes developers made and when (but bear in mind that due to current SourceForge problems the links on that page sometimes take a day or two after the date of the change to show you the correct information).

The only caveat is that when "syncing" you will get the most recent source code but the executables (makensis.exe, makensisw.exe and the plugins) aren't necessarily built from that source code, they might be slightly older. When this happens you just have to wait for an NSIS developer to "check in" a more recently compiled version of the executables, or use the version you got.


Sorry about the mixup:igor: at midnight CVS can get spelled as CSV

Vytautas


Hehe it would be funny if the NSIS source code was stored as CSV (comma separated values) instead of in CVS :P


So, do I have to install some CVS software on my computer? If so, where do I get that?


Well I have CVS on my system and your code appears to work OK, so my guess is that if you did install CVS your problem should be fixed, however you should note that there are quite a few changes to the script syntax in the CVS version and you will need to modify your script especially if using ModernUI. I posted the link to the newest CVS version of NSIS a couple of posts back.

Vytautas


Sorry did not read your question properly. You only need to have CVS software if you are a developer and want to upload modified code to the server.

It has been a very long day :p !!!

Vytautas


No problem...it's been a long day for me, too.

So, once I've installed the NSIS version that you linked me to, it should "link" to CVS so that I can keep up-to-date on the newest versions of NSIS (I'm talking about the "Update" button in the NSIS menu)? I supposed I click on one of the CVS radial buttons on the NSIS menu to get the latest version????


Originally posted by jcagle
So, do I have to install some CVS software on my computer? If so, where do I get that?
NSIS Update will get the latest CVS copy of NSIS for you automatically, you don't need anything else unless you are an NSIS developer and want to submit code (like Vytautas said). NSIS Update can be run from the NSIS.exe menu program in your NSIS directory.

Yep, you can use NSIS Update, however I have found that the update sometimes reports unusual errors, this I believe is due to some work being done on the SourceForge CVS Servers so the link above can be used if the Update program fails. The link has a nightly build, a zipped version of NSIS which can be up to 24 hours out of date, but thats better than nothing.

Vytautas


When you talk about the "CVS" version...how is that different from the "regular" version? For example, I told you that I had version 2.0 beta 3. Is that the CVS version? If not, how did I get that version and not the CVS version?

Finally, I'm assuming that if there is syntax differences between my "regular" version and the "CVS" version, I will see errors when I compile the script and will just have to fix them one-by-one?

Thanks again!


2.0 beta 3 is probably a version you downloaded from sourceforge.net. If you type makensis at the command prompt you'll see some blurb including a line link "MakeNSIS v2.0b4 (CVS) - Copyright 1999-2003 Nullsoft, Inc.". As you can see mine says (CVS) in brackets to indicate it is a CVS version, yours won't have this if it is a proper release.

A CVS version is NOT a proper release, it's just a version that developers created to include their latest changes. New CVS versions are compiled all the time as developers improve NSIS, every now and again a version is considered to be stable enough and to contain enough new features to warrant it being provided for download on sf.net as a PROPER release, then the (CVS) bit will vanish.

Anytime you use NSIS Update and choose "Download the latest development files from CVS" (either "merge your changes" or "clean copy") or you use a CVS client (like TortoiseCVS) to grab the latest files you will be getting a CVS version.

If you want a PROPER release look here instead: http://sourceforge.net/project/showf...group_id=22049

Edits are in blue


As for syntax errors, well if the CVS version has had changes made to it by developers that change existing syntax then yes your script will need modifying. On the plus side you'll also be able to use any new features that have been added but not "released" yet (ie. a PROPER release version of NSIS doesn't exist yet that contains that new feature or features, but the CVS code will contain them).