Search code examples
nsis

NSIS auto accept dialog in silent mode


I have an nsis installer with a custom dialog within that has an Accept button but when i run it in silent mode , it does not accept the dialog. How to make it auto clicking accept silently?


Solution

    • If your dialog was a standard MessageBox, simply add the /SD button_id_to_use parameter to the MessageBox instruction to tell NSIS what is the choice to use in silent mode:

      MessageBox MB_YESNO "Accept?" /SD IDNO IDNO Skipped
      
    • if your dialog is a custom page, the problem is that in silent mode, no pages are involved at all (even hidden), and no page callback are trigerred. You need to check IfSilent and call the logic that is triggered by the Accept button separately from either the .onInit or a section.