Hello Angus,
I implemented the check for a PS viewer:
- When acrodist (Acrobat Distiller) is associated with the ".ps" file
extension it is checked for the next program in OpenWithList.
- If the next program exists, it is used as PS viewer
- If it don't exist, acrodist is used as PS viewer
- When acrodist is NOT associated with the ".ps" file extension, the
associated program is used
As I couldn't find the pdf viewer stuff in the latest CVS of the
lyx_installer.nsi, it comes here as code:
Macros in lyx_installer.nsi (note that I also had to change the pdf stuff!):
--------------------------
;test if a pdf-viewer is installed
StrCpy $PDFVPath ""
!insertmacro GetFileExtProg $PDFVPath $PDFProg ".pdf" "a"
${if} $PDFVPath != ""
StrCpy $PDFProg "$PDFProg" -4
StrCpy $PDFVYes "\r\n$PDFProg found in:\r\n"
${endif}
;test if a ps-viewer is installed
StrCpy $PSVPath ""
StrCpy $1 ""
!insertmacro GetFileExtProg $PSVPath $PSProg ".ps" "a"
${if} $PSVPath != ""
StrCpy $PSVPathb $PSVPath
StrCpy $PSVPathb $PSVPathb "" -8
${endif}
${if} $PSVPathb == "Distillr"
!insertmacro GetFileExtProg $PSVPathb $PSProgb ".ps" "b"
${if} $PSProgb != ""
StrCpy $PSVPath $PSVPathb
StrCpy $PSProg $PSProgb
${endif}
${endif}
${if} $PSVPath != ""
StrCpy $PSProg "$PSProg" -4 ;remove the ending ".exe"
StrCpy $1 $PSProg "" -2
${if} $1 == 32
StrCpy $PSProg "$PSProg" -2 ;remove the ending "32" of gsview
${endif}
StrCpy $PSVYes "\r\n$PSProg found in:\r\n"
${endif}
-------------------------
For the code above, the following macro is used in the file lyx_utils.nsh:
--------------
!macro GetFileExtProg ProgPath AppExe Extension Subentry
ReadRegStr ${AppExe} HKCU \
"Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\${Extension}\OpenWithList"
\
"${Subentry}"
${if} ${AppExe} != ""
ReadRegStr ${ProgPath} HKLM \
"Software\Microsoft\Windows\CurrentVersion\App
Paths\${AppExe}" "Path"
;remove the "\" at the end
StrCpy $0 ${ProgPath} "" -1
${if} $0 == "\"
StrCpy ${ProgPath} ${ProgPath} -1
${endif}
${endif}
!macroend
--------------
I tested it for the registry combinations
a=acrodist + b=gsview32
a=gsview32 + b=acrodist
a=acrodist + b=
a=gsview32 + a=
and it works perfectly. So please apply.
regards Uwe