Messaggio di errore

Access denied. You may need to login below or register to access this page.

Access Denied / User log in

Please let our ADS show!

This sites offers only FREE software and it's supported by a few advertisement boxes (no intrusive popups).
Please:

  • disable your AdBlocker by adding CoolSoft website to whitelist
  • give the proper cookie consent
  • enable JavaScript for this website

This seconds wait is to let you update your browser configuration...

Ok, I've done the required changes... now show me your content!
!!! Please enable JavaScript !!!

Login rapido

Usa il tuo social account esistente ed accedi senza bisogno di registrazione: nessuna conferma, nessuna nuova password da ricordare, veloce, facile e sicuro.

...oppure usa un account CoolSoft

Inserisci il tuo nome utente CoolSoft.
Inserisci la password associata al tuo nome utente.
Add reply | CoolSoft

Add reply

Please let our ADS show!

This sites offers only FREE software and it's supported by a few advertisement boxes (no intrusive popups).
Please:

  • disable your AdBlocker by adding CoolSoft website to whitelist
  • give the proper cookie consent
  • enable JavaScript for this website

This seconds wait is to let you update your browser configuration...

Ok, I've done the required changes... now show me your content!
!!! Please enable JavaScript !!!
(If you're a human, don't change the following field)
Your first name.
(If you're a human, don't change the following field)
Your first name.

Warning!

You're posting your message as anonymous user.

By registering you'll be allowed to receive notifications of post replies and new threads.
Registration is really quick and only requires you to choose an username and provide a valid email address.

Click here to to register.

A confirmation mail will be sent to this address.
Your email address won't be published.

Altre informazioni sui formati del testo

Filtered HTML

  • Elementi HTML permessi: <a> <blockquote> <br> <cite> <code> <dd> <del> <dl> <dt> <em> <img> <li> <ol> <p> <pre> <s> <span> <strike> <strong> <ul>
    Allowed Style properties: background-color, color, font-size, font-style, height, text-align, text-decoration, text-transform, width
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <pre>, <c>, <cpp>, <csharp>, <drupal5>, <drupal6>, <javascript>, <php>. The supported tag styles are: <foo>, [foo].
  • Indirizzi web o e-mail vengono trasformati in link automaticamente
  • Linee e paragrafi vanno a capo automaticamente.

Plain text

  • Nessun tag HTML consentito.
  • Indirizzi web o e-mail vengono trasformati in link automaticamente
  • Linee e paragrafi vanno a capo automaticamente.
CAPTCHA
Questa domanda serve a prevenire lo spam e gli accessi non autorizzati.
Annulla
Posts: 1972
Joined: 25 Mar 2012 - 01:19
You're breaking the natural

You're breaking the natural script workflow, mixing xxxPage and xxxLeave functions.

Here's a working script, based on yours:

; MUI Symbol Definitions
!include Sections.nsh
!include MUI2.nsh
!insertmacro MUI_LANGUAGE English
 
OutFile test.exe
Var action
 
!insertmacro MUI_PAGE_WELCOME
Page custom PrePage PreLeave
!insertmacro MUI_PAGE_FINISH
 
Section main
SectionEnd
 
Function PrePage   
    Call fnc_already_installed_Show
FunctionEnd
 
Function reinstall_click
    StrCpy $action 1
    Call GotoNextPage
FunctionEnd
 
Function uninstall_click
    StrCpy $action 2
    Call GotoNextPage
FunctionEnd
 
Function cancel_click
    StrCpy $action 3
    Call GotoNextPage
FunctionEnd
 
Function PreLeave
    StrCmp $action 0 cancel
    StrCmp $action 1 reinstall
    StrCmp $action 2 unistall
    StrCmp $action 3 cancel
unistall:
    MessageBox MB_OK "uninstall"
    Quit
cancel:
    MessageBox MB_OK "cancel"
    Quit
reinstall:
    MessageBox MB_OK "reinstall"
    Quit
FunctionEnd
 
Function GotoNextPage
  SendMessage $HWNDPARENT "0x408" "1" ""
FunctionEnd
 
; handle variables
Var hCtl_already_installed    
Var hCtl_already_installed_Label1    
Var hCtl_already_installed_Label3    
Var hCtl_already_installed_Button1    
Var hCtl_already_installed_Button3    
Var hCtl_already_installed_Label2    
Var hCtl_already_installed_Button2
 
; dialog create function
Function fnc_already_installed_Create
 
  ; === already_installed (type: Dialog) ===
  nsDialogs::Create 1018
 
  Pop $hCtl_already_installed
 
  ${If} $hCtl_already_installed == error
    Abort
  ${EndIf}
 
  !insertmacro MUI_HEADER_TEXT "ALREADY_INSTALLED_HEADER" "ALREADY_INSTALLED_TEXT"
 
  ; === Label1 (type: Label) ===
  ${NSD_CreateLabel} 127u 7u 143u 32u "REINSTALL_TEXT"
  Pop $hCtl_already_installed_Label1
 
  ; === Label3 (type: Label) ===
  ${NSD_CreateLabel} 127u 47u 143u 32u "UNINSTALL_TEXT"
  Pop $hCtl_already_installed_Label3
 
  ; === Button1 (type: Button) ===
  ${NSD_CreateButton} 18u 7u 97u 32u "REINSTALL_BTN"
  Pop $hCtl_already_installed_Button1
  ${NSD_OnClick} $hCtl_already_installed_Button1 reinstall_click
 
  ; === Button3 (type: Button) ===
  ${NSD_CreateButton} 18u 47u 97u 32u "UNINSTALL_BTN"
  Pop $hCtl_already_installed_Button3
  ${NSD_OnClick} $hCtl_already_installed_Button3 uninstall_click
 
  ; === Label2 (type: Label) ===
  ${NSD_CreateLabel} 127u 89u 143u 32u "CANCEL_TEXT"
  Pop $hCtl_already_installed_Label2
 
  ; === Button2 (type: Button) ===
  ${NSD_CreateButton} 18u 89u 97u 32u "CANCEL_BTN"
  Pop $hCtl_already_installed_Button2
  ${NSD_OnClick} $hCtl_already_installed_Button2 cancel_click
 
FunctionEnd
 
; dialog show function
Function fnc_already_installed_Show
  Call fnc_already_installed_Create
  nsDialogs::Show $hCtl_already_installed
FunctionEnd

What I changed:

  1. Custom page now defines both pre and leave function:
    Page custom PrePage PreLeave
  2. PrePage function, and button callbacks, will only set $action variable value, then ask installer to proceed to the next page calling then new GotoNextPage function (see here for details).
    PrePage function and its subfunctions now won't change script workflow.
  3. PreLeave function is called by NSIS when leaving the page (asyncronously after GotoNextPage call), so its content can be executed (and also Quit works).
Anonymous user
Extra buttons, go Next

Hi,
first, thanks for developing this great app.

I cannot find the way to read which button was pressed, based on that make an action, and then continue with the next page.

Var action
 
!include "resources\already_installed.nsdinc"
 
Page Custom PrePage
 
Function PrePage   
    ReadRegStr $R0 HKLM "${PRODUCT_UNINST_KEY}" "UninstallString"
    StrCmp $R0 "" NotInstalled
        Call fnc_already_installed_Show
NotInstalled:
 
FunctionEnd
 
Function reinstall_click
    StrCpy $action 1
    Call PreLeave
FunctionEnd
 
Function uninstall_click
    StrCpy $action 2
    Call PreLeave
FunctionEnd
 
Function cancel_1_click
    StrCpy $action 3
    Call PreLeave
FunctionEnd
 
Function PreLeave
    StrCmp $action 0 cancel
    StrCmp $action 1 reinstall
    StrCmp $action 2 unistall
    StrCmp $action 3 cancel
unistall:
    Exec $INSTDIR\uninst.exe
cancel:
    Quit
reinstall:
FunctionEnd
 
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "License.rtf"
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_RUN "$INSTDIR\Program123.exe"
!insertmacro MUI_PAGE_FINISH

And the code from NSISDialogDesigner is:

; handle variables
Var hCtl_already_installed    
Var hCtl_already_installed_Label1    
Var hCtl_already_installed_Label3    
Var hCtl_already_installed_Button1    
Var hCtl_already_installed_Button3    
Var hCtl_already_installed_Label2    
Var hCtl_already_installed_Button2
 
; dialog create function
Function fnc_already_installed_Create
 
  ; === already_installed (type: Dialog) ===
  nsDialogs::Create 1018
 
  Pop $hCtl_already_installed
 
  ${If} $hCtl_already_installed == error
    Abort
  ${EndIf}
 
  !insertmacro MUI_HEADER_TEXT "$(ALREADY_INSTALLED_HEADER)" "$(ALREADY_INSTALLED_TEXT)"
 
  ; === Label1 (type: Label) ===
  ${NSD_CreateLabel} 127u 7u 143u 32u "$(REINSTALL_TEXT)"
  Pop $hCtl_already_installed_Label1
 
  ; === Label3 (type: Label) ===
  ${NSD_CreateLabel} 127u 47u 143u 32u "$(UNINSTALL_TEXT)"
  Pop $hCtl_already_installed_Label3
 
  ; === Button1 (type: Button) ===
  ${NSD_CreateButton} 18u 7u 97u 32u "$(REINSTALL_BTN)"
  Pop $hCtl_already_installed_Button1
  ${NSD_OnClick} $hCtl_already_installed_Button1 reinstall_click
 
  ; === Button3 (type: Button) ===
  ${NSD_CreateButton} 18u 47u 97u 32u "$(UNINSTALL_BTN)"
  Pop $hCtl_already_installed_Button3
  ${NSD_OnClick} $hCtl_already_installed_Button3 uninstall_click
 
  ; === Label2 (type: Label) ===
  ${NSD_CreateLabel} 127u 89u 143u 32u "$(CANCEL_TEXT)"
  Pop $hCtl_already_installed_Label2
 
  ; === Button2 (type: Button) ===
  ${NSD_CreateButton} 18u 89u 97u 32u "$(CANCEL_BTN)"
  Pop $hCtl_already_installed_Button2
  ${NSD_OnClick} $hCtl_already_installed_Button2 cancel_click
 
FunctionEnd
 
; dialog show function
Function fnc_already_installed_Show
  Call fnc_already_installed_Create
  nsDialogs::Show $hCtl_already_installed
FunctionEnd

But the problem is that the buttons do not respond.
They do the function, but then it doesn’t continue.

Can you help me with that?

Thanks a lot
Maria