PDA

View Full Version : Checking an Installed Program



tez
09-12-2014, 03:15 PM
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

linder
09-13-2014, 10:13 AM
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

tez
09-13-2014, 10:50 AM
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?

linder
09-13-2014, 10:58 AM
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

linder
09-13-2014, 11:09 AM
BTW, if you need help with this, just let us know.

Friedrich

tez
09-13-2014, 12:36 PM
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.

linder
09-14-2014, 02:04 AM
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

tez
09-14-2014, 06:18 AM
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?

linder
09-14-2014, 07:07 AM
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

tez
09-14-2014, 07:47 AM
This time I found GUID of the game in registry but it still doesn't accept that code. What am I doing wrong?

linder
09-14-2014, 08:25 AM
The problem is that you do not have it under the correct location:

You have:

HKEY_LOCAL_MACHINE\Software\WOW6432node\Microsoft\ DirectPlay\Applications\Age of Empires

The correct location for the registration would be under:

HKEY_LOCAL_MACHINE\Software\WOW6432node\Microsoft\ Windows\CurrentVersion\Uninstall

Don't you have your product registered under the correct and, as per Windows development guidelines, recommended location?

If this is not the case, you can use a simple workaround:

You can use the "Get Registry Key Value..." script function to retrieve your Path value.

Does this help?

If you need help with the "Get Registry Key Value..." function, please let me know.

Friedrich

linder
09-14-2014, 08:35 AM
Similar to this:

Friedrich

tez
09-14-2014, 09:40 AM
Great! "Get Registry Key Value..." script solved the proglem, thanks a lot. But unlike you did, I didn't change 36th line since old code also works with no problem currently. I performed a couple tests, and it seems ok. Thanks to you, I completed my first two goals :)

I wonder, is it also possible to remove some files which is located in destination folder? In other words, is SB able to delete some files from pc?

linder
09-14-2014, 10:48 AM
Great!

Yes, SB lets you do whatever you have to do on the target machine :) Just use the "Delete File(s)..." script function to remove files. You can even use wildcards. You can use it whenever you want and wherever you want.

Does this help?

Friedrich

tez
09-21-2014, 02:56 PM
Hi again,

Currently I'm trying to make my installer to install a font to target pc (via Files and Folders section). It installs the font, but it's like system is not aware of this. After installation completed, the programs that use this font can't see it really. I must go to fonts directory and click on installed font. With only this way, programs start seeing the font.

I don't want users who use my installer do this step. Font installation must be hidden, and the applications that use this font must see it automatically once the installation is completed.

I tested it in Win98, WinXP and Win7. Reason is all the same. Could you please help me?

linder
09-22-2014, 12:44 AM
Hello,

Perhaps you forgot to enable the "Register as True Type Font" option in the Advanced properties?

Friedrich

tez
09-22-2014, 03:44 AM
Exactly! Thank you very much Friedrich, you saved me again :) I didn't know that feature really.

linder
09-22-2014, 03:46 AM
You are very welcome :)

Friedrich

tez
09-22-2014, 05:53 AM
I hope I'm not asking too much. In SetupBuilder, is it possible to retrieve some files in uninstall, which were deleted while installing? I mean, the installer removes/overwrites some files during installation. But when I uninstall it, is it possible to reset everything just like patch was never installed? Or as easier and better way, is uninstaller also able to install some files?

linder
09-22-2014, 06:05 AM
Hello,

It depends on your deployment strategy.

Let us assume you have installed Version 1.0. Then you patch to Version 1.1. If you have "Backup Replaced Files" (General Information -> Advanced Settings) enabled (which is the default) and you log the install/patch actions (which is also the default) and you are using the same uninstall .log name then Smart Rollback (/UR command line switch when using uninstall) can rollback your patch back to V1.0. By the way, that's what we are using in SetupBuilder to let customers rollback to previously installed SetupBuilder releases.

Friedrich

linder
09-22-2014, 06:13 AM
And if you delete files during the update process, what you can do is to move or copy the files to the BACKUP folder and during the uninstall, simply restore the files (from the backup folder back to the install folder). Or ZIP them up before you delete the files and at uninstall, simply UNZIP the archive. You can use the "Zip File(s)..." and "Unzip File(s)..." script functions. Or "Copy File(s)...", "Move File(s)...", etc.

It all depends on your deployment strategy. Nearly everything is possible with SetupBuilder :)

Friedrich

tez
09-22-2014, 07:10 AM
I'm quite happy to see that I'm using the right software for my patch :)

Well, creating a backup.zip file sounds a better idea for the size of a patch i'm trying to make. Let me describe my preferred scenario for this subject to make it easier for both of us:

There are two files in installing target. First one is "main.exe" in root directory, second one is "app.exe" in datas directory.

..\main.exe
..\datas\app.exe

In my installer, main.exe will be replaced with another file with the same name. And app.exe will be removed and another file "app2.exe" will be copied to datas directory as a replacement.

How can I add first version of main.exe and app.exe in a single zip file into the root directory with the name backup.zip? And how can I unpack it when uninstalling?

linder
09-22-2014, 07:58 AM
Please allow me to make a suggestion. Because your file "replacement" process is very simple, I would suggest to avoid the ZIP option. The ZIP would add an extra layer of complexity to your deployment strategy.

If I were you, I would do the following:

1. Backup the files into the BACKUP folder. Mark the "Remove on Uninstall" checkbox.
2. Delete the APP.EXE (and MAIN.EXE if you want).
3. Install main.exe and app2.exe

The uninstaller will automatically "restore" the MAIN.EXE and APP.EXE.

What do you think?

BTW, I noticed that the rollback action puts a READ-ONLY flag to the files. I think this is a bug and I have opened a ticket. To work around this, please reset the read-only flag from within your custom uninstall script. Item is in review.

Friedrich

linder
09-22-2014, 08:24 AM
BTW, I noticed that the rollback action puts a READ-ONLY flag to the files. I think this is a bug and I have opened a ticket. To work around this, please reset the read-only flag from within your custom uninstall script. Item is in review.

This is a bug in the uninstaller :( Fixed now and the fix will be available in the soon coming maintenance release.

FIX : Installer: The uninstall action for a "Create Unique Backup File..." script command always set the Read-only attribute.

Friedrich

tez
09-22-2014, 11:45 AM
It's very little bug and doesn't effect my project, but I'm glad if it's going to be fixed. By the way, thank you very much, your idea was really better and more suited for my work. I completed this step too, and added a couple of more features into my installer after that. It's all going good for now.

I think, currently all major features are done and only some extras left. For example, It would be so nice, If I can put a countdown on "Next" button in Licence Agreement screen. Can I make it?

linder
09-23-2014, 12:32 AM
We'll make the SB maintenance build available later today so you don't need the code in your uninstall script.

What do you mean with 'countdown on "Next" button'? Some kind of a timer that counts to 0?

Friedrich

linder
09-23-2014, 03:04 AM
The new build #4550 is available now.

Friedrich

tez
09-23-2014, 03:21 AM
Yes, it's exactly a timer that counts to 0.

linder
09-23-2014, 03:27 AM
Absolutely no problem. You can use this "timer" method in custom dialogs:

http://www.lindersoft.com/forums/showthread.php?p=72903#post72903

The latest source code demo can be found in the Examples Package.

Friedrich

tez
09-23-2014, 07:33 AM
Thanks but actually I meant a simpler counter to here:

linder
09-23-2014, 07:38 AM
Hmmm, and what should the "counter" do?

Friedrich

tez
09-23-2014, 09:14 AM
I've seen this a couple of times. It just counts down from 10sc (usually). You can't push "Next" button until it comes to zero. It's just a way to make sure that user has read the agreement before pushing "Next" button.

My patch is just a patch. That's why, I do not add my personal readme file into target directory. This screen in installer is my only way to tell some notes to the user. It's not actually a very important detail, but it would be a nice feature.

I've also seen another similar way in another installer: "Next" button stays unclickable, until you page down. But I think counter method is better.

linder
09-23-2014, 09:31 AM
From the legal point of view, the "Require EULA Reading" is better ;) The scrolling EULA is a very useful feature to satisfy corporate legal and product management requirements. If this checkbox is marked (Advanced License Agreement Properties), you can require that end users scroll through the complete End-User License Agreement (EULA) before installation can proceed. SetupBuilder includes support for disabling the Next button on the License Agreement dialog until the end user reaches the end of the EULA text in the scrollable EULA control through mouse or keyboard scrolling. The end user must also select the "I accept the terms in the license agreement" option before the Next button is enabled.

If you still prefer the "counter" solution, let me know and I'll send you a License Agreement / Counter demo project. Absolutely no problem.

Friedrich

linder
09-23-2014, 09:45 AM
I have developed a demo project for you. Just to demonstrate the power of SetupBuilder.

http://www.lindersoft.com/projects/CustomLicenseTimerDemo.zip

The radio buttons (and "Next") are disabled for 10 seconds. After that, the user can make a choice.

What do you think?

Friedrich

tez
09-23-2014, 09:56 AM
I think you're right. But I did it and it didn't change anything. This option is clicked but even when I don't scroll down, if "agreed" is selected, "Next" button is clickable. My EULA is long enough, I'm not sure what is wrong :confused:

linder
09-23-2014, 10:11 AM
See attached screenshots. License agreement in RTF format. "I accept" the terms radio button is disabled. You have to scroll down to enable the "I accept" radio button; you can mark it to enable the "Next" button.

Friedrich

tez
09-23-2014, 10:52 AM
Yes, I'm doing the same thing, but it doesn't work. Now I created a quick new installer project. This time, only thing I do was choosing that option. Still no. Very interesting.

tez
09-10-2015, 05:04 AM
Hello again Friedrich,

I must say that SetupBuilder really amazes me everytime when I use it. Since my last message here, I achieved everything I wanted from an Installation, thanks to SB and Lindersoft one more time...

After a long time, I require your assistance again for just a little option about :

1* As I configured, at first my current installation project backs-up a file with this line:
Create Unique Backup File from "%_SB_INSTALLDIR%\data\launch.exe" to "%_SB_INSTALLDIR%\data\backup

2* And then it removes the backed-up old file:
Delete Files "%_SB_INSTALLDIR%\data\test.dll" [Remove read-only]

3* After that, it installs my replacement file called "Run.exe" into the same destination:
Install File "C:\Project\Run.exe" to "%_SB_INSTALLDIR%\data\Run.exe

Everything is alright in this process. It backs-up the file, deletes the old one and then installs my new file to the folder where the old file was in once. And when I uninstall the patch, it removes Run.exe and brings test.dll back. But the thing is, it doesn't keep the name format of the past file (Such as launch.exe/Launch.exe/LAUNCH.EXE). It brings it as the format that I've written in the first line (launch.exe). In some computers, this launch.exe is named as Launch.exe or LAUNCH.exe. I want my installation to remember how the name format of the older file was. Is there a simple command in the library or a simple option for this subject?

Thanks for your help in advance

tez
09-11-2015, 08:49 AM
Besides, can you please inform me, is it possible to prevent the uninstall "X" to be launched, if the program "Y" is also installed in the pc. I mean, is the uninstall of "X" able to give this eror message: "Before removing X, please uninstall Y first." (If Y is installed, of course).

linder
09-11-2015, 02:19 PM
Hello,

Thank you for your kind words!

Windows "caches" the format (files are case-insensitive in Windows) and then uses this same format when you "replace" the file. In most cases you do not have control over this process.

Friedrich

linder
09-11-2015, 02:26 PM
Absolutely no problem. You can very easily handle this with a custom uninstall. Just check from the custom uninstall for "X" if the Product GUID for Program "Y" is still there and then display a "Before removing X, please uninstall Y first." message -or- offer to automatically uninstall "Y" first from the "X" custom uninstall.

Friedrich

tez
09-14-2015, 01:10 PM
I'm glad to hear that it's a simple way to do this. Checking for the GUID is not a problem. But I'm not sure how can I add this "custom" uninstall. Can you please explain me how to add this custom uninstall into my existed script, step by step?

linder
09-15-2015, 03:15 AM
Just create a custom uninstall .sbi include script and you are done :)

Similar to this:

http://www.lindersoft.com/forums/showthread.php?42593-Uninstall-Include-Script&p=76302#post76302

In your case, check for the specific "Y" Product GUID and do not continue with the uninstall for Program "X" if the Product GUID for Program "Y" is still there.

Does this help?

Friedrich

tez
09-21-2015, 06:49 AM
Yes it helped a lot, thank you again Friedrich :)
Right after the first "If" line, I added my own "If/Else" function. Now it checks the other program, and doesn't perform uninstalling if other program is still installed. Just like I wanted.

Recently I decided to change something in my patch. At first it checks a GUID entry when it's launched, and automatically sets the setup destination according to this GUID. User is also able to change the destination if they want. Currently I want to disable this. Is it possible to set the setup destination "read-only"? Because my installation can find where to install, I think it's unnecessary to allow users to change it.

linder
09-22-2015, 02:03 AM
Perfect! Glad it's working fine now :)

To set the setup destination "read-only", you have again different options. The easiest way is to use the standard dialog and then "disable" the entry field and browse button (see attached screenshots).

Does this help?

Friedrich

tez
09-22-2015, 07:39 AM
Hmm I did the same commands, but unfortunately I couldn't do it this time.

Only difference is:
In 52nd line I couldn't change the variable name to "SELECTDESTINATION", and had to leave it as "#3".
So in 58th line I used the value name as "#3". It compiled properly but didn't change the result.

Can you please tell me the other option to make the address read-only? Additionally, am I able to remove "Change..." button completely?

linder
09-22-2015, 09:01 AM
Hello,

Don't change a variable! SELECTDESTINATION is a "Dialog Label" ;) To remove the button, just use the "Hide" operation (see attached screenshots).

I have created and uploaded a demo project for you:

http://www.lindersoft.com/projects/DestinationDialog.zip

Does this help?

Friedrich

tez
09-22-2015, 10:05 AM
You're definitely right! In 52nd line I just named it as "#3" in the Dialog Label, and all worked quite fine :)

Well, in order to make it seem a little more aesthetic, is it possible to extend the address bar a bit like in this photo?

3990

linder
10-08-2015, 04:52 AM
Argh! Please forgive my late comment, but I lost this long thread off the radar :(

No, you can't change the controls in standard dialogs. But you can simply create your own custom dialog and then do whatever you want :)

Friedrich

tez
10-09-2015, 12:35 PM
No problem, I just thought that there is no way to do such a thing. I'm glad that it's possible -- like all of my past questions :)

I have actually never tried to create a custom dialog. Only a custom uninstaller. Could you please show me the steps to create a custom "Destination Folder" dialog, which seems exactly the last screenshot I uploaded?

linder
10-10-2015, 03:19 AM
Sure, no problem. I have uploaded a quick-and-dirty demo project for you to:

http://www.lindersoft.com/projects/MyDestinationFolder.zip

BTW, you should modify the dialog text because there is no "Change" button :)

Friedrich