[英]NSIS silent installer - /SD IDCANCEL flag
I have this NSIS script: 我有这个NSIS脚本:
Section "!${SECTION_MAIN}" sectionMainID
SetOutPath "$INSTDIR"
whileRuns:
LockedList::FindProcess "$INSTDIR\bin\${PRODUCT_NAME}.exe"
Pop $R0
${If} $R0 != ``
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "this is running. Please close it first." IDOK OK IDCANCEL CANCEL
OK:
Goto whileMLRuns
CANCEL:
Abort
${EndIf}
I would like to change it to silent mode. 我想将其更改为静音模式。 In silent mode, i would like that automatically messagebox is ended with a CANCEL. 在静默模式下,我希望该消息框自动以CANCEL结尾。 so, according to doc, i put a /SD
flag, with the command IDCANCEL
in the end of line with MessageBox
inside. 因此,根据doc,我在命令IDCANCEL
的末尾放了一个/SD
标志,并在其中放置了MessageBox
。 Like that : 像那样 :
Section "!${SECTION_MAIN}" sectionMainID
SetOutPath "$INSTDIR"
whileRuns:
LockedList::FindProcess "$INSTDIR\bin\${PRODUCT_NAME}.exe"
Pop $R0
${If} $R0 != ``
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "this is running. Please close it first." IDOK OK IDCANCEL CANCEL /SD IDCANCEL
OK:
Goto whileMLRuns
CANCEL:
Abort
${EndIf}
However, this is failing. 但是,这失败了。 So, I changed it to 因此,我将其更改为
Section "!${SECTION_MAIN}" sectionMainID
SetOutPath "$INSTDIR"
whileRuns:
LockedList::FindProcess "$INSTDIR\bin\${PRODUCT_NAME}.exe"
Pop $R0
${If} $R0 != ``
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "this is running. Please close it first." IDOK OK IDCANCEL CANCEL /SD CANCEL
OK:
Goto whileMLRuns
CANCEL:
Abort
${EndIf}
with now CANCEL
instead of IDCANCEL
in the same line. 与现在在同一行中CANCEL
而不是IDCANCEL
。 This is because with this syntax it is branched with the same syntax as in user interaction mode. 这是因为使用此语法时,它的分支与用户交互模式下的语法相同。 However, it seems not to be working either. 但是,它似乎也不起作用。
What is wrong with my flag, how can i fix that ? 我的标志有什么问题,我该如何解决? Should i use a syntax with a jump instead ? 我应该使用带有跳转的语法吗?
I think the parameter order does matter. 我认为参数顺序很重要。 Try to use IDCANCEL
with following order: 尝试按以下顺序使用IDCANCEL
:
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "a-message" /SD IDCANCEL IDOK OK IDCANCEL CANCEL
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.