PDA

View Full Version : INI Conditionals Not Working & Causing Uninstall to not uninstall



Dereck
01-07-2003, 04:55 PM
I am trying to prevent the install of certain Features based on the existence of an INI keyword, the idea being to prevent the application being re-installed after it has been uninstalled.

When I set conditions for this, it installs the features regardless of the state of the INI, but when I uninstall, it does not remove the files. When no condition is used, the application installs and uninstalls perfectly.

Has anyone had experience of trying to use this new feature, and actually had it work ?. I'm happy to investigate other conditions, such as registry entries, if this one doesn't work, but I would rather use this one.

Chandima
01-07-2003, 04:59 PM
Is the Ini file the search is looking for in the Windows folder? It HAS to be in the Windows folder for this type of search to work. This is a limitation of the Windows Installer.

"The IniLocator table holds the information needed to search for a file or directory using an .ini file or to search for a particular .ini entry itself. The .ini file must be present in the default Microsoft Windows directory"

Dereck
01-08-2003, 06:46 AM
Chandima

Thanks for the response. Yes the INI file is in the Windows directory, in fact it is the WIN.INI file itself.

It would help if the use this new feature was properly documented. The Help file is not very specific and does not have any examples, and although it states that you can edit the message that gets issued when the install is stopped because of the condition, the dialog (Found/Not Found) does not have this facility.

Chandima
01-08-2003, 10:50 AM
First off I know this works because I have personally tested this. So it's probably something not being set correctly. As for the "Found/Not Found" dialog, it will have the message edit property ONLY when you launch the wizard from the Requirements View. You won't see it when you launch it from the Features or Custom Actions view (condition property).

Tell me exactly what you want to look for in win.ini and I'll post the solution here.

Dereck
01-08-2003, 12:46 PM
Chandima

You are a gem - thanks.

It's quite simple, I just want to look for an INI variable called Cinst in the intl section of WIN.INI, and then use this to determine whether or not to install certain features, with the features NOT being installed if the keyword is found.

Chandima
01-08-2003, 01:42 PM
If you already have a search for this, delete it. Now:

1. Go to Features View
2. Select the feature you want this condition on
3. Launch the "Condition Builder" dialog from the "Condition" property and select "Software" tab
4. Press Create a new "Create New Requirement"
5. Press Next and select "INI File Value, that contains ther data" from the combo and press Next
6. Configure as follows:

INI File Name: Win.ini
INI Section Name: intl
INI Key Name: Cinst
Read entire line: Checked

Press Next

7. Select "Found" and press Finish

Build and Install. This feature will install only if Win.ini has this Key in that section.

Dereck
01-08-2003, 04:28 PM
Chandima

Thanks again. Your last but one message pointed me in the right direction - by adding the condition in the Requirements view, I was able to halt the installation if the INI key already exists, which is exactly what I wanted. I even managed to edit the message that gets displayed.

BUT - if the INI key does not exist my application installs (which is what I want), and my application then creates the INI key to prevent the re-install. Unfortunately, as the key now exists it also stops my application being un-installed.

Should the uninstall also check, or is there something I can do to tell Express only to check during install and not uninstall ?.:confused:

Chandima
01-09-2003, 12:34 PM
What if you do the following:

1. Go to Requirements View
2. Change the status of this search to the "empty checkbox" state
3. Create a new VBScript custom action, sequence to launch after Install Welcome dialog, and in it's condition property set the search to the "Green Check" icon
4. Set the "Function name" property to "TestMsg"
5. Make the custom action point at the following VBScript:

Public Function TestMsg
MsgBox "This program cannot be re-installed. If you want to uninstall, please go to Add/Remove Programs and do so".
TestMsg=1602
End Function

5. Build and install

Dereck
01-09-2003, 06:59 PM
Chandima

You have solved my problem - I cannot thank you enough. But not only have you solved my problem, you have given me an insight into areas of Express that I would never have even thought about using.

Now I'm going to find out more about VB Script to see how I can better customise my installs.

Best Regards

Dereck "Not Quite As Confused" Cowsill.