在NSIS中使用部分索引前的部分索引或安装上一部分

时间:2013-02-10 05:01:35

标签: nsis

我正在编写NSIS安装程序脚本来安装某些网络打印机。我希望每个打印机都安装为可选Section,但我不想多次重启打印后台处理程序。因此,我创建了一个隐藏部分,用于检查是否选中了每个打印机部分,如果是,则包含注册表设置以创建该打印机的端口。然后它重新启动打印假脱机程序。问题是我需要首先完成这个隐藏部分,但我还需要使用打印机部分的部分索引。

有没有人知道如何在定义部分之前引用部分索引?我想到的另一种方法是将隐藏部分移动到最后,但是我需要一种方法来确保它首先安装。任何帮助或想法将不胜感激。

Section "-"
    ${IfThen} ${SectionIsSelected} ${Sec01} ${|} !include "10.0.0.8.nsh" ${|}
    ${IfThen} ${SectionIsSelected} ${Sec02} ${|} !include "10.0.0.11.nsh" ${|}
    nsExec::Exec 'net stop spooler'
    nsExec::Exec 'net start spooler'
SectionEnd

Section "My Printer" Sec01
    ExecWait 'rundll32 printui.dll,PrintUIEntry /if /b "My Printer" /f "$EXEDIR\oj8000\hpoj800z.inf" /r "10.0.0.8" /m "HP Officejet Pro 8000 A809 Series" /z'
SectionEnd

Section "Copier" Sec02
    ExecWait 'rundll32 printui.dll,PrintUIEntry /if /b "Copier" /f "$EXEDIR\copier\oemsetup.inf" /r "10.0.0.11" /m "RICOH Aficio MP C4000 PCL 6" /z'        
SectionEnd

1 个答案:

答案 0 :(得分:1)

Section -
...
call doSectionChecks
SectionEnd


Section "My Printer" Sec01
...
SectionEnd


Function doSectionChecks
... ${Sec01}
FunctionEnd
相关问题