Archive: Detect clcik on NEXT button


Detect clcik on NEXT button
I've created a custom page.

Only if the user click on NEXT button (of custom page), my installer musts execute some operations:

.....
!insertmacro MUI_INSTALLOPTIONS_READ $SelectedDrive "SceltaFlash.ini" "Field 1" "State"
StrCpy $SelectedDrive $SelectedDrive 3
.....

otherwise no.

Thanks, best regards.


I've tried to use a LeaveFunction in my custom page.
The problem is:
if the user click on NEXT button, I must control a value. If this value is OK, I must go to the next page; if this value isn't OK, I Must return on my cutom page.

Thanks.


see InstallOptions help - file:///C:/Programme/NSIS/Docs/InstallOptions/Readme.html

you have to use Section Settings - Field State as shown in the Readme HTML file. Value 0 means next button was pressed. Use Abort function in a page callback function to return to a page.

Code:
!insertmacro MUI_INSTALLOPTIONS_READ $0 "passwordpage.ini" "Settings" "State"

StrCmp $0 0 next_button return_to_page ; Next button clicked
return_to_page:
abort
next_button:
do your stuff...


I have the same problem with lorenzop and I do these code which saschagottfried show but I run the other program.
My code here
ReadINIStr $0 $INI "Settings" "State"
StrCmp $0 0 ReadMe End
ReadMe:
ExecWait "nodpad.exe"
End:
Abort
It is run but if I want to run on button NEXT by a file read me.txt. It does not run
ReadINIStr $0 $INI "Settings" "State"
StrCmp $0 0 ReadMe End
ReadMe:
SetOutPath $PLUGINSDIR
File "c:\readme.txt"
ExecWait "$PLUGINSDIR\readme.txt"
End:
Abort
Also I use
ExeWait "readme.txt"
But I do not run!
Please help me!


Sorry, I can't understand anything, after reading your messages twice.

Please descibe what you try to do with words. Afterwards provide enough of your code, so I can recognize something. You really should read your own messages, before you expect someone to understand this.

If you take some time for that, I will take my time to give you an answer.


I am sorry for my word,
I mean I do the same way which you show lorenzop except lorenzop click NEXT to run application, I change NEXT button to become VIEW README.
But when I put it in my code, it does not work. I also want to test my code is wrong or true. So, I change file to become nodpad.exe to detect it.At that time, it run well.
The first code used for file ReadMe.TXT which I want to show.
ReadINIStr $0 $INI "Settings" "State"
StrCmp $0 0 ReadMe End
ReadMe:
SetOutPath $PLUGINSDIR
File "c:\readme.txt"
ExecWait "$PLUGINSDIR\readme.txt"
End:
Abort
Also I use
ExeWait "readme.txt"

The second code expressed file nodpad.exe which I want to test.
[COLOR]
ReadINIStr $0 $INI "Settings" "State"
StrCmp $0 0 ReadMe End
ReadMe:
ExecWait "nodpad.exe"
End:
Abort
[/COLOR]
In case I use nodpad.exe , I click VIEW README, nodpad is executed but I click CLOSE both main application and nodpad is closed.Although I use Abort to return page.
Once again sorry,
Thank alot for your help,


Your problem is that you want to add features to things that you have not understood in basic yet. "Abort" only returns to the page when used in a LEAVE function. Lorenzop did this. You did not even recognized this.

Do not misuse things like NEXT button. There are other features like MUI_FINISHPAGE_RUN to display a readme file after setup was successful.

My advice. Look in MUI help for page - chapter 3. This provides enough to customize some features during the install process.

And you have to understand the concept of callback functions for pages. Study examples in C:\Programme\NSIS\Examples\Modern UI
Here you can learn basic installer setup that use MUI and the use of Pre,Show,Leave Functions.

In the end you will even save time, because you do not have to visit the forum afterwards. Good luck!


Thank saschagottfried for your advice,
I put my code in Leave Function and I know Abort only return the page and used in Leave Function.
Perhaps, I post my question is wrong position. However, I see the problem which Lorenzop saw the same way which I want.I also know attribute NEXT,BACK,CANCEL but my purpose is different.
Instead of NEXT button is used by Lorenzop, I change it to become VIEW README button.Because my purpose want to create a menu which allow user run all application on this.
So, I change this to allow them to see information.
This is express my idea:
------------------
| Button 1 |
------------------
| Button 2 |
------------------
|ViewReadMe| Exit|
------------------
I think you can understandd my purpose and can you give me your help to solve this problem with Button "VIEW README" which I express on above.
Thank in advance,