Skip to content
⌘ NSIS Forum Archive

somewhat nonstandard help for newbie

3 posts

jameshcunningha#

somewhat nonstandard help for newbie

Hi. I hope that the question I'll be asking isn't too stupid: I've looked everywhere, but I can't find enough information to do what I want to do (especially in the time frame that's been given to me). Even a nudge in the right direction would be appreciated.

I'm trying to write an nsis procedure that installs a service pack to patch a large program. It'll have to extract archives, copy files, etc., and most of that's not hard to do.

Through use of some help docs I've thrown together a page that should ask the user where to find a certain directory, and that shouldn't let the user continue with the procedure if a particular file (tar.exe) does not exist on that directory.

The page's creator function looks like this:

Function FindingTarPage
!insertmacro MUI_HEADER_TEXT "$(FINDTAR_TITLE)" "$(FINDTAR_SUBTITLE)"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "FindTar"
!insertmacro MUI_INSTALLOPTIONS_READ $locOfTar "FindTar" "Field 2" "State"
FunctionEnd
Is there some way to make it so that the user can click back without choosing a correct directory, while being unable to click forward? I'm finding the MUI code pretty incomprehensible.

(Current solution: putting code like the following at the end of the creator function, which is - obviously - quite suboptimal.)

IfFileExists $locOfTar\tar.exe +3 0
MessageBox MB_OKCANCEL "tar.exe is not present in that directory. Try again, or press cancel to exit the installer." IDOK -4 IDCANCEL 0
Quit
MichaelFlya#
Try This.



Function .onVerifyInstDir
IfFileExists $locOfTar\tar.exe PathGood
Abort
PathGood:
FunctionEnd

-MichaelFlya-
jameshcunningha#
Cool - I wasn't aware of that particular callback. Thank you!

One thing I'd like to do is define a custom page where pressing "next", "back", and "cancel" each operate on different conditions. In my example above, "back" and "next" only work on the same conditions: if $locOfTar\tar.exe exists. Is there some way I can make it so that the user can press back no matter what's going on?