Fluffy_Penguin2
14th January 2009 17:05 UTC
Checkbox's / if command
Ive been trying to figure this out for a while and ive looked at the examples and documents and i cant work out how to do this so sorry :p.
Im trying to make it so that when checkbox's are ticked it downloads a file using the "NSISdl::download" command.
I cant for the life of me figure out how to do this. Ive looked at the IniRead thing but i cant work out how to do this at all.
The checkbox info is in the .ini and the commands are in the nsis file.
If anyone could give me an example of how to make a checkbox and then link it to a command when its checked. Thanks.
Fluffy_Penguin2
apparition
14th January 2009 17:45 UTC
The way I know:
!include LogicLib.nsh
Var CB_QUICKSET
${NSD_CreateCheckBox} 15u 58u 120u 12u "I'm a checkbox"
Pop $CB_QUICKSET
SendMessage $CB_QUICKSET ${BM_GETCHECK} 0 0 $0
${If} $0 == 1
Messagebox MB_OK "I'm checked!"
${Else}
Messagebox MB_OK "I'm unchecked!"
${EndIf}
Fluffy_Penguin2
14th January 2009 19:39 UTC
Do you know how to do this by using fields? Then making it check the state of the checkbox e.g. 0 or 1.
Then run a macro to do the download or move on to the next checkbox to check.
Ive got macros done to do the downloads but i just need to know how to check for the state of the checkbox and how to tell it to do a command and then move on.
Ive been looking at trying to do it by this way.
ReadIniStr $PLUGINSDIR\test.ini "Field 5" "State" "NSISdl::download file.com/1.txt"
But im kinda failing
Red Wine
14th January 2009 21:21 UTC
If you insist to run with InstallOptions you should read the documentation about the notify flag and checkout the included examples.
Fluffy_Penguin2
14th January 2009 23:27 UTC
Thanks you Red Wine :)