Checking an Installed Program
Hi all, I'm a bit new with this great product and require your assistance in two little issues.
1* I'm trying to create a patch for a computer game by the help of SetupBuilder. All seems good for now but I don't want my installer runs, if this game is not installed in that pc. Before starting, it must check that is this game installed or not. How can I make it?
2* And I want to make the installer find where this game is installed. It must find the installed directory and patch it without question about where to install. Could you please help me about these subjects?
Thanks in advance
Re: Checking an Installed Program
Hello,
First of all, thank you for your kind words and welcome to SetupBuilder !!!
What you are trying to do is absolutely no problem with SetupBuilder. But before I can answer your question, I have one for you :)
Does your current application installation makes use of the standard method to register itself with Windows (using a Product GUID)? In other words, do you have registered an uninstall application with Windows? The standard location for this is in the following section of the Windows registry:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Curr entVersion\Uninstall
Or for 32-bit applications on a Windows x64 operating system:
HKEY_LOCAL_MACHINE\Software\WOW6432node\Microsoft\ Windows\CurrentVersion\Uninstall
If this is the case, then you only have to use one script function to handle it all (I'll then provide an example). If you do not use this standard method, do you write the installation folder to the Windows registry on your own?
Friedrich
Re: Checking an Installed Program
Thank you very much :)
I found the uninstall information of this game under your second address. But now I wonder, what if another user has 32bit? Is it possible to check both of these addresses when installer runs?
Re: Checking an Installed Program
The SB installer handles this x86 and x64 scenario automatically for you :)
So the solution is to use the "Detect Previous Version..." script function. It lets you detect the path of a previously distributed version of your product.
If the function succeeds, the %_SB_ERRORCODE% return value is nonzero. Variable contains the path to the previous version.
If the function succeeds, %_SB_TMP% contains the uninstall string (if available). You can use this to uninstall your previous version before doing a fresh install.
If the function succeeds, %_SB_RETURNEX% contains the installed version number (if available).
If the function fails, the return value is zero (means your product does not exist on this machine).
In other words, this functions gives you all you need. If your product is already available then you can retrieve the installation path. If the product is not available, you can terminate the install.
Does this help?
Friedrich
Re: Checking an Installed Program
BTW, if you need help with this, just let us know.
Friedrich
Re: Checking an Installed Program
Thank you for your kindness, I think I can make it with your help. But unfortunately I couldn't understand after "Detect Previous Version..." script function :( Could you please tell me step by step?
When I choose "Detect Previous Version...", it wants me to choose a variable and then a Product GUID.
1 Attachment(s)
Re: Checking an Installed Program
No problem :) Please see the attached screenshot.
Line 35 checks if the product does exist. If the product is installed (Line 36) then it retrieves the existing installation path and sets the default install path (Line 37).
If the product is not found (Line 38) then it displays a warning and terminates the "patch" (Line 40).
Does this help?
Friedrich
Re: Checking an Installed Program
Thank you, I understand now. But I noticed that my GUID isn't a GUID. I found the uninstall info of my game at this address:
HKEY_LOCAL_MACHINE\Software\WOW6432node\Microsoft\ Windows\CurrentVersion\Uninstall
But it has only its name there. There is no code. So whatever I type in SB as its guid, it doesnt accept. Do you know how can I handle this?
Re: Checking an Installed Program
The name (in this case the corresponding Registry "Key Name") is fine. As long as the previous installation software was using the required (as per Windows development guidelines) registration format. The "InstallLocation" value points to the installation folder.
Does this help?
Friedrich
1 Attachment(s)
Re: Checking an Installed Program
This time I found GUID of the game in registry but it still doesn't accept that code. What am I doing wrong?