Archive: using variable/define set at installation in unistaller?


using variable/define set at installation in unistaller?
  Hi there,

after experimenting a while and searching the forum I give up and just ask... ;)

I have an installer which will install a plugin for a 3rd party app. The installer contains multiple plugin versions for multiple base app versions, so I'd love to be able to uninstall those seperatly. I already set a variable in the installer, and, depending on which plugin version is choosen, i set this variable with a string.

In the uninstaller I'd like to use this string to delete this particular version with start menu shortcuts and everything, but without harming the other installations. But it seems dydamically set variables don't make it through to the installer - is there a way to do this?


To make things clear - here is what i try to do:

Install Version 1 of the Plugin:

Copy Files, make SM Entry - "Plugin 1.0\for program 1"

Install Version 2 of the Pluging:
Copy Files, make SM Entry - "Plugin 1.0\for program 2"

now when I start the uninstaller beeing placed in

"Plugin 1.0\for program 1\uninstall" - i don't want to kill the files in "Plugin 1.0\for program 2". But I haven't found a way to tell that to the uninstaller.

I also tried with a define and used a variable (set in the installer) as the value for the define - but no luck. Using a static string works.


save the string in the registry, or in a .ini file in the same location as the uninstaller, then read it back in the uninstaller


Hm, could slap myself for not thinking of that easy solution... :)

Well, but I still run into trouble.


FileOpen  $0 "$INSTDIR\plugins\${ProductName}\fileVersion" "r"

>FileRead $0 $2
FileClose$0

MessageBox MB_ICONEXCLAMATION
|MB_OK $2
>
This is the part that is supposed to read the file and give out the text in it - while this works perfectly in the install part of the script - it refuses to work in the uninstall section, the msgbox stays empty. The $INSTDIR and ${ProductName} values are known to the uninstaller, I checked that.


It works when the "fileVersion" file is in the same location as the uninstaller. Does the file really HAS to be in the same location as the uninstall.exe? I would like ot put it somewhere else, not to clutter the base app (and preventing the user to delete that file accidently).

$instdir=location of uninstaller exe (in the uninstaller)
for stuff like this I usually just name the file uninstaller.dat (or you can store it in the registry if you are already storing "add/remove programs" entries)

and you could use Write/ReadINIStr functions instead of File*, they are simple one liners


I'd prefer to put it in a file - I managed to read from the "fileVersion" file when I put it in
"$INSTDIR\plugins\"

but not when it is in
"$INSTDIR\plugins\${ProductName}\"

although the uninstaller knows the value of "${ProductName}" and gives that out correctly. Even if I give the full path for the file manually - no way, it won't read the file beyond "$INSTDIR\plugins\"


Unless the full path is longer than 255 chars, there should be no problem. Make sure the path is correct by "debugging" with messagebox or http://technet.microsoft.com/en-us/s.../bb896642.aspx


uh... okay.

That was some stupid mistake... sorry, for wasting your time. But usually when trying to read from a file, one shouln't delete it beforehand... :igor:

Okay, its friday, maybe that will count as an apology...