
varun.consit1.55249139161625E12 asked a question.
copying file only if particular application exists
Hi all,
Suppose i need to do installation in which all the components will be stored at a default value of [INSTALLDIR] and are self-registered. only one file which is a plug-in for adobe acrobat/reader needs to be copied at a specific location ONLY if these applications(acrobat/reader) exists. How to i move forward with this without writing any script?
Thanks
2. set the condition for the component that contains this plugin to ACROBAT_INSTALLED
3. There is no step 3. It's really just that simple.
:-)
But the question remains unanswered. How can I "cppy" a file to that location returned by value of that key? I actually have to copy .api file at that location.
Regards
Regards
If you "just store the value" in a property at the end of that wizard, you may need to do a little extra work to make the component use that value as the destination for the component. Let's say you are storing the value found at "HKLM\SOFTWARE\Adobe\Acrobat Reader\InstallPath" in a property called [ACRO_INST_PATH]. You may need to create a "Set A Directory" CA that will assign the property value to a directory identifier of the same name. You could then use the same thing as the condition and the destination of your component.
It seems that the installation path value is stored in the registry under a specific version of acrobat reader. You may need to ignore the System Search, and create a Custom Action to search under the "HKLM\SOFTWARE\Adobe\" key to find an "InstallPath" value, and then to use MsiSetProperty() to set that property. InstallScript makes writing simple things like that very easy.
Hope that helps!
That really helped. One thing I am unable to understand is where is this property (one generated on using system search) stored? I dont find it in property manager and in case the specified property is not set(may be because search failed) in that case what happens to this property.
I tried using the result of search to store the value in component and set the condition to be the property assuming on search failure NOT should evaluate to true but this doesnt come out to be the case.
Suppose i use c++ to write custom action to search the relevant folder path reading a specific value in registry. How can then I place the .api only at that location. Do msi provide us with any such functions?
Regards
Log the installation, and check the AppSearch part of the log. You'll see a line or two in there for each system search you've specified (although there probably won't be enough information in it to tell which log entries apply to which searches...unless they find something, in which case you'll see a line in the log for the property getting set.) You'll see the property setting during the CA if that's how you implement it.
Supposing you were to write the CA in C/C++ or InstallScript (which I like for its simplicity and because it's integrated with the installation build, it's quick to make a change, and rebuild in one step...), you may want to experiment with this function: MsiSetTargetPath();. That should enable you alter the path of a directory variable.
Let me explain with example, taking previous problem of putting my .api i check for both acrobat and reader and place it in both if both exists. what method i find is editing duplicate table(if that is possible?). is this the correct way of handling taking that whole of the custom action from finding the folder to placing copies of .api is to be coded?
Regards
- create a component for each version of Acrobat.
- Set the target path for each component so that it's based on a different property\directory identifier, such as ACROBAT__PATH
- Write a custom action that sets both a property and a directory for each found version of Acrobat.
- - The Property will be used in the condition for the component.
- - The directory will obviously be used to set the target for the component.
- Schedule the Custom action after the CostFinalize action.
You now have a custom action that runs every time the installation is launched (any system data that you gather during Install that is used in feature or component conditions MUST be read in every time you launch your installation!!! otherwise in maintenance mode, unpredictable stuff can happen.) You also have as many components as you have Supported Acrobat versions. This Custom action sets properties which will determine for which versions of Acrobat your file needs to be installed. It also sets the target directory for each of the installed versions of Acrobat. This should do it for ya!