Hi I have an annoying problem with NSIS.
I'm trying to write script to install the SaveAsPdfAndXps.exe plugin/addin for Office 2007.
Here is my script:
Section "SaveAsPdf"
DetailPrint "Installing SaveAsPdfAndXps Extension"
File 'Prereq\SaveAsPDFandXPS.exe'
ExecWait '$TEMP\SaveAsPDFandXPS.exe' $0
DetailPrint "SaveAsPDFandXPS exit code = $0"
; Delete '$TEMP\SaveAsPDFandXPS.exe'
SectionEnd
So I'm running Windows 7 x64, I already have Office 07 with this extension installed. However, if I run the exe on my own by clicking it and installing it manually it doesn't abort it just installs nicely.
Now the above script, prints out exit code 6!? And the if I comment the Delete bit, I don't see the file in my temp directory? How do I find out whats going on?
The SaveAsPDFandXPS extension outputs a log file in the temp dir. if executed manually, but it doesn't happen with the script.
When the compiled setup executes, it does ask for elevation btw.
Regards,
The code you posted is incomplete, the File instruction extracts files to $outdir unless you use the /oname switch, $outdir is set by InstallDir or SetOutPath and neither appear in your code so there is no way to tell where you are extracting to...
Try changing it to:
Section "SaveAsPdf"
DetailPrint "Installing SaveAsPdfAndXps Extension"
InitPluginsDir
File '/oname=$PluginsDir\SaveAsPDFandXPS.exe' 'Prereq\SaveAsPDFandXPS.exe'
ExecWait '"$PluginsDir\SaveAsPDFandXPS.exe"' $0 ;Note the quotes here, if we needed to pass parameters it would be '"c:\path\app.exe" /param'
DetailPrint "SaveAsPDFandXPS exit code = $0"
Delete "$PluginsDir\SaveAsPDFandXPS.exe"
SectionEnd
$PluginsDir will never conflict with other apps, $Temp is shared with other apps, so it is usually better to put things in $PluginsDir.
To run without elevation, add RequestExecutionLevel User