This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: copying file only if particular application exists
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 24, 2010
01:33 AM
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
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
(11) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 24, 2010
12:41 PM
1. create a system search entry to look for a reg key to verify that acrobat is installed. let's say that you store the result of that search in a property called [ACROBAT_INSTALLED]
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.
🙂
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.
🙂
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 06, 2010
06:47 AM
Thanks for your reply,
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
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
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 06, 2010
08:50 AM
you're talking about copying a file that's already on the user's system, or one packaged with your product?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 07, 2010
01:07 AM
The file is packaged with installer. I only need to place it at particular location as explained but and this is conditional. In case destination folder doesn't exist we won't be copying that file anywhere else on that destination machine.
Regards
Regards
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 07, 2010
08:49 AM
Use a system search to find the Install path in the registry. On the last page of the System Search wizard, you will have the option of what to do with the value that you are reading from the registry. one of the options is to use it as the destination for a component. This makes things much easier as the wizard will make the necessary entries in the directory table as well as assigning the directory identifier as the destination of the component you select.
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!
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!
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 13, 2010
06:41 AM
Thanks Kelter,
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
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
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
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 13, 2010
09:26 AM
The property manager is a view into the property table. The property won't exist until runtime when the AppSearch action runs, and even then, it'll only exist if it finds that reg entry. If you're using a custom action to do the search, then the property gets created when you call MsiSetProperty.
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.
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.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 13, 2010
09:28 AM
Okay, correction: you might need to schedule that CA after the CostFinalize SA. I don't think you can do anything directory-related until after the directory manager has been initialized by the costing actions.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 13, 2010
10:21 AM
That clears the concept to great extent. as am a new in this installer subject kindly forgive me for overwhelming you with ques. Suppose i have to continue with C++, then in writing custom actions what method i find is to do edition of database tables. is this the correct approach?
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
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
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 13, 2010
10:49 AM
very interesting; i didn't think about the "multiple versions" issue. perhaps what you need is to-
- 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!
- 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_
- 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!
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 22, 2010
01:30 AM
Thanks Kelter,
All that really helped a lot... 🙂
All that really helped a lot... 🙂
![](/skins/images/3B39CE851FDD5528C393F146EB70A2D0/responsive_peak/images/icon_anonymous_message.png)