lundi 2 novembre 2020

How to copy a file into desktop when checkbox is selected in NSIS, by default the checkbox should be selected?

I want to build a custom page in installer. In this page if the checkbox is selected a file(manual) should be placed in desktop which is in another folder called nsis. But by default the checkbox should be selected and if unchecked by user it should not place the file in desktop

; === CheckBox1 

  ${NSD_CreateCheckbox} 61.87u 30.15u 161.92u 14.77u "Place the file in desktop"
  Pop $hCtl_mydialog1_CheckBox1

  ${NSD_Check} $hCtl_mydialog1_CheckBox1

  ${NSD_OnClick} $hCtl_mydialog1_CheckBox1 placePdf 

;function to place the pdf in desktop from nsis folder

Function placePdf
    
        CreateDirectory $DESKTOP\backup
        CopyFiles "C:\Users\User\nsis\Manual.pdf" $DESKTOP\backup
    
FunctionEnd

Here the file is copying correctly. But the problem is if it is not clicked (as it is by default checked) it does not place the file. How to i implemented it?




Aucun commentaire:

Enregistrer un commentaire