[wix-users] Creating a single Shortcut that runs Excel (or other app) and opens multiple documents

Greg Oliver golive at microsoft.com
Fri Feb 26 12:13:36 PST 2016


You didn't ask, but I found this resource to be useful:

WiX cookbook : over 60 hands-on recipes packed with tips and tricks to boost your Windows installations

2015. Ebooks, Birmingham, England : Packt Publishing
by Ramirez, Nick.

-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Johnny del Toro
Sent: Friday, February 26, 2016 11:33 AM
To: wix-users at lists.wixtoolset.org
Subject: [wix-users] Creating a single Shortcut that runs Excel (or other app) and opens multiple documents

Hi All,

I am VERY new to WiX toolset.  Forgive me if this seems like a basic question, but I can't work it out myself nor find hints anywhere online about creating anything more than single file simple shortcuts with WiX.

During installation, I need to create a single shortcut that will load Excel and open a series of Excel spreadsheets.  i.e. the target needs to look something like:

     ".......\Office*??*\EXCEL.EXE" MyAddin.xll sheetA.xls sheetB.xls

I want to do it in a way that will ensure that the shortcut will be valid for any version of Excel installed and to any path.  So I wrote the following code to search the registry for the application associated with .XLL files:

    <!-- 1. Read the Default key value for HKCR/.xll -->
    <Property Id="EXCELXLLHKCRDEFAULT">
      <RegistrySearch Id="ExcelXllHKCRdefault"
                      Root="HKCR"
                      Key=".xll"
                      Type="raw" />
    </Property>


    <!-- 2. Read the Default key value for the Command to run the application -->
    <Property Id="EXCELEXEPATH">
      <RegistrySearch Id="ExcelEXEpath"
                      Root="HKCR"
                      Key="[EXCELXLLHKCRDEFAULT]\shell\Open\Command"
                      Type="raw" />
    </Property>


Then I created my Shortcut with this:

    <DirectoryRef Id="MYShortcutRoot">
      <Component Win64="$(var.Win64)" Id="CMP_MYShortcutRoot"
Guid="5A8BF142-xxxxxx">
    .
    .
           <Shortcut
           Id="Shortcut_MyFirstAddin.xll"
           Name="My Excel Add-in"
           Description="My Excel Add-in"
           Target="[EXCELEXEPATH] [DirMyInstallRoot]MyAddin.xll" />
    .
    .
      </Component>
    </DirectoryRef>

But this doesn't work.  During runtime, I get warning:

Warning 1909. Could not create shortcut My Excel Add-in.lnk Verify that the destination folder exists and that you can access it.

I tried changing the Target value to

           Target="[EXCELEXEPATH]"
           Arguements="/e /p [DirMyInstallRoot] MyAddin.xll" />

But I still get the same error.

If I take [EXCELEXEPATH]out of the Target and replace it with [DirMyInstallRoot]MyAddin.xll, the shortcut is created OK.


Any hints or pointers I could get to fix this would be greatly appreciated.



Thanks for taking the time to read this,

JDT

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fwww.firegiant.com%2f&data=01%7c01%7cgolive%40microsoft.com%7ce31fce6a99db4b8f2cf708d33ee3b5ae%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=PlFVKC%2bftL4U8OJ3mnpn%2fMBu2couDyYEMZcRDakUBfk%3d


More information about the wix-users mailing list