Archive: Change order of the message ?


Change order of the message ?
Hi all i got a little problem getting some message to display after another ?

here is what i got:

; Script generated by the HM NIS Edit Script Wizard.
; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "Bobs Mappack 1.3"
!define PRODUCT_VERSION "1.3"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
SetCompressor /SOLID lzma
SetCompressorDictSize 64
; MUI 1.67 compatible ------
!include "MUI.nsh"
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!insertmacro MUI_PAGE_FINISH
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
; Language files
!insertmacro MUI_LANGUAGE "English"
; Reserve files
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
; MUI end ------
Name "${PRODUCT_NAME}"
OutFile "C:\Bobs Mappack 1.3.exe"
ShowInstDetails show
ShowUnInstDetails show
Function .onInit
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\GhostRecon.exe" "path"
StrCmp $R0 "" NotPresent Present
notpresent:
StrCpy $INSTDIR "$programfiles\Red Storm Entertainment\Ghost Recon\Mods"
MessageBox MB_OK "Path to ghost recon was not found, plz verify this path, or browse to ghost recon\mods\ and install"
goto done
present:
strcpy $instdir $R0\Mods
done:
functionend
Section "MainSection" SEC01
SetOutPath "$INSTDIR\Bobs Mappack 1_3"
SetOverwrite on
File /r "G:\Ghost Recon\mods\Bobs Mappack 1_3\*.*"
sectionend
Section -AdditionalIcons
CreateDirectory "$SMPROGRAMS\Bobs Mappack 1.3"
CreateShortCut "$SMPROGRAMS\Bobs Mappack 1.3\Uninstall Bobs Mappack 1.3.lnk" "$INSTDIR\Remove_Bobs Mappack 1.3.exe"
SectionEnd
Section -Post
WriteUninstaller "$INSTDIR\Remove_Bobs Mappack 1.3.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\Remove_Bobs Mappack 1.3.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
SectionEnd
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
FunctionEnd
Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
Abort
FunctionEnd
Section Uninstall
Delete "$SMPROGRAMS\Bobs Mappack 1.3\Bobs Mappack 1.3.lnk"
rmdir "$SMPROGRAMS\Bobs Mappack 1.3"
RMDIR /r "$INSTDIR\Bobs Mappack 1_3"
Delete "$INSTDIR\Remove_Bobs Mappack 1.3.exe"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
SetAutoClose true
SectionEnd

Problem is when i start the installer i get an error window saying "Path to ghost recon was not found, plz verify this path, or browse to ghost recon\mods\ and install" before all else in the installer.

Now error message is what i wanted, but can i have that error message saying it in the install path window?
so ppl just dident forget what they clicked ok to? ;)
so i want install path window to come first, then the error message ? can it be done ?


you should place the message in the leave function of the directory-page

Page directory "" "" "DirectoryLeave"

...

Function DirectoryLeave
MessageBox MB_YESNO "Continue?" IDYES +2
Abort
FunctionEnd

please attach your script in future, rather than pasting it

ok im a noob here, i dont know much of the stuff here
you said place something in the page directory ? i dont see that?

Page directory "" "" "DirectoryLeave"

...

Function DirectoryLeave
MessageBox MB_YESNO "Continue?" IDYES +2
Abort
FunctionEnd

i guess i should place above some where?
and ... should be the message?


Ok i found out how above should be put in, thx.
Now its almost as i want it, but can the message be displayed right away the directory page open up?(now it waits for me to click install before message pops up), and also if the registry key was found it make that the new directory path, but then i have to click next, and install while the directory page is the same? hope that can be fixed too.


ok i found out how to avoid the 2 same install windows, i only had to remove:

!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page

hehe, dunno why it acted up, just because i add an message in the directory dialog.


Well since i had to add almost 2 identical script lines, which i saw was not leading anywhere to my goal, i replaced it with an search option, to look for the right place to install, i guess this is better?

Edit: i was having problems uploading the changed file, in here it was not changed ???, gonna try again


another try
this works almost like i want it to, but i still need to fix the massagebox, (path was not found ect..) it only appear when you press install, i want that box showing when directory window shows up? , so ppl know allready to browse to another location.


ok, since no one has an answer :-), i figured out to try something else, and this works ok i guess

Function .onVerifyInstDir
IfFileExists $INSTDIR\ghostrecon.exe PathGood
Abort
PathGood:
FunctionEnd

well it somehow fullfill my wishes to pick the right directory. Though i can not use messageboxes with above, since that message box would show like 20 times before you get to the right location hehe, but your not able to install to any another directory than where ghostrecon.exe is located, so thats good enough for me, since there is no other alternative i guess.

Edit: What i really want is, directory page show up, then the error message, that the path is wrong, then user select another path, right/wrong , if right no message, proceed with installation, if wrong, display same message, can that be made ?