Creating a shortcut with two file names, one of which is a variable?

I want to create a shortcut that calls two files, firstly, calls Excel.exe, then it calls my add-in.

I tested it by doing the following:

Target:
"C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE" "C:\MyAddin.xll"

And it works great. Now I want to implement it in inno-setup.

I need to get the location of Excel.exe through some automation in inno-setup, which I store in a global variable.

Here is what I tried:

Name: {commondesktop}\{#MyAppName}; Filename: ExcelExecutablePath; 
Parameters: {app}\{#MyAppExeName}; Tasks: desktopicon; 
Flags: CreateOnlyIfFileExists; IconFilename: {app}\Icons\TimeCard64.ico;

I also tried other things, but I lost this a bit.

Thanks in advance. Let me know if I’d better clarify something!

+3
source share
1 answer

"excel", " ", "excel.exe" . :

 
[Icons]
Name: "{commondesktop}\My Excel File"; Filename: "{code:GetExcelPath}"; Parameters: """C:\MyAddin.xll"""

..

[Code]
function GetExcelPath(dummy: string): string;
begin
  RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\excel.exe', '', Result);
  if Result = '' then
    Result := 'excel.exe';
end;
+5

All Articles