We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

Zeroeffect
Posts: 5
Joined: Wed Jul 08, 2015 3:56 pm

Create a folder search based on a previous search

Hello,

I’m trying to create an installer for a Microsoft Excel Add-In. The installer should also remove a file (if it exists) during the installation.
The file that I would like to remove is installed in Microsoft Excel’s folder “XLSTART” and the name of the file is: “Extension.xls”
My problem is that I can't seem to delete the file.

(I'm using AI 12.2.1 on a Win7 computer)

This is how I’m trying to do it.
  1. First I want to find out the installation path of Excel by reading from the registry.
    So I have created a couple of “Searches”, one for each version of Excel (Excel 2013, Excel 2010 etc.)
    I have named the searches: EXCEL_2013_PATH, EXCEL_2010_PATH etc.
    So if Excel 2013 is installed, I then will have the path to Excel 2013 installation path in the variable: EXCEL_2013_PATH
    EXCEL_2013_PATH = C:\Program Files (x86)\Microsoft Office\Office15\
  2. I then created another “Search”, based on the previous one.
    This is a folder search, and it uses the variable EXCEL_2013_PATH and then adds the folder XLSTART at the end, which will result in the complete path to where the add-in currently might be installed.
    I have named this “Search”: EXCEL_2013_XLSTART
    EXCEL_2013_XLSTART = C:\Program Files (x86)\Microsoft Office\Office15\XLSTART
    I think here is the first of my problems.
    How can I make sure that the search “EXCEL_2013_PATH” is evaluated before my second search “EXCEL_2013_XLSTART” is evaluated?
    When I run a “test” on all the “searches” it works, but looking in the logfile after I have ran the installation, it looks like the variables are evaluated in another order.
  3. Next I would like to remove the file “Extensions.xls” from the “EXCEL_2013_XLSTART” folder if (it the file and folder exists)
    I have created a “Property based” folder under “Files & Folders”, based on the property “EXCEL_2013_XLSTART” (which should contain the path to the folder)
    I then try to remove my file, but the file doesn't gets deleted when I run the installer
    Here I believe I might have a problem with rights. But I have tried creating the installer as a “Per User with administrator rights” but with no luck.
Thanks in advance!
Kalle
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Create a folder search based on a previous search

Hi Kalle and welcome to Advanced Installer forums,
How can I make sure that the search “EXCEL_2013_PATH” is evaluated before my second search “EXCEL_2013_XLSTART” is evaluated?
As you noticed, Windows Installer does not guarantee the searches order, so a new search should not use the result of another search.

In this case, you may need to create a custom action to delete the related file. You can use a custom action written in C# or a custom action written in C++. For details, please check the Options to integrate and debug custom actions article.

Also, please take a look on the How do I remove a file or a folder during installation? article which may be useful to you.

If you need any help, please let me know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”