[wix-users] Creating a single Shortcut that runs Excel (or other app) and opens multiple documents
Johnny del Toro
jd.toro.991 at gmail.com
Fri Feb 26 11:33:27 PST 2016
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
More information about the wix-users
mailing list