orecchionebruno
27th June 2010 11:42 UTC
how to deny "goto next page"?
Hi to everyone, I read the help on line and NSIS site but I didn't find a solution for this problem. Someone have a suggestion for don't allow that install process could start?
My target is to update a file and user should choose right folder.
I tried with this script, but the result is that the installer will be closed if doesn't find right file. What I would is that the installer doesn't "Goto next page" untill user choose right folder. (at the startup installer reads Install path in the registry)
Function .onVerifyInstDir
IfFileExists "$INSTDIR\MyApp.exe" +3 0
MessageBox MB_OK "MyApp doesn't exist. Please select MyApp directory."
Abort
MoreInfo::GetProductVersion "$INSTDIR\MyApp.exe" ;get exe version (MoreInfo plug-in)
Pop $1
StrCmp $1 "3.1 " +3 0
MessageBox MB_OK "Invalid version!$\rPlease select MyApp directory."
Abort
FunctionEnd
Afrow UK
27th June 2010 12:24 UTC
What is causing the installer to close? Is it the Abort calls?
Stu
Afrow UK
27th June 2010 12:34 UTC
This works fine for me (attached). Don't put any message boxes in there because it will spam the user multiple times.
Stu
orecchionebruno
27th June 2010 13:46 UTC
Hi Stu, thanksss for your help now I've found My mistake.
MY MISTAKE was in the "jump to line n.r X o Y" in the event "onInit" and I've leaved wrong and true strings:
Function .onInit
Processes::FindProcess "MyApp.exe"
StrCmp "$R0" "0" +3 0
Messagebox MB_OK "MyApp doesn't exist. Please select MyApp directory."
Abort
ReadRegStr $1 HKCR "MyApp\Path" ""
; IfFileExists "$1\MyApp.exe" 0 +3 ;!!!THIS STRING IS WRONG BEACAUSE NEXT IfFileExists SHOULD NOT BE PRESENTS TWO TIMES!!!!!!!!!!!
IfFileExists "$1\MyApp.exe" 0 +2 ;!!!THIS IS TRUE
StrCpy $INSTDIR "$1"
FunctionEnd
Ciao
Bruno
PS: in the orginal script I dint' wrote two IfFileExists commands so "+3" was wrong because goes directly to next event witout reading "FunctionEnd"
MSG
27th June 2010 15:10 UTC
orecchionebruno: I suggest you start using LogicLib to simplify your code. Instead of IfFileExists etcetc, you can do
${If} ${FileExists}
stuff here
${Else}
other stuff here
${EndIf}
And so on and so forth.
orecchionebruno
27th June 2010 15:21 UTC
Ok I'll do it, thankss