All pastes #902410 Raw Edit

Meins

public text v1 · immutable
·published 2008-02-13 13:48 UTC
rendered paste body
# Auto-generated by EclipseNSIS Script Wizard
# 01.02.2008 13:45:33

SetCompressor /SOLID bzip2

# Defines
!define REGKEY "SOFTWARE\$(^Name)"
!define PRODUCT_NAME "xx"
!define VERSION 1
!define COMPANY xx
!define URL http://www.x.de
!define LANG_DE "deutsch"
!define LANG_EN "english"

# MUI defines
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
!define MUI_STARTMENUPAGE_REGISTRY_KEY ${REGKEY}
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME StartMenuGroup
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "${PRODUCT_NAME}"
!define MUI_UNFINISHPAGE_NOAUTOCLOSE
!define MUI_LANGDLL_REGISTRY_ROOT HKLM
!define MUI_LANGDLL_REGISTRY_KEY ${REGKEY}
!define MUI_LANGDLL_REGISTRY_VALUENAME InstallerLanguage

# Included files, plugins, directories
!include Sections.nsh
!include MUI.nsh
!include LogicLib.nsh
!include nsDialogs.nsh
!addplugindir .\plugins
!addincludedir .\plugins
!include defines.nsh
!include macros.nsh

#Custom page variables
Var Dialog
Var BrowseButton
Var ClearButton
Var File
Var ListBox
Var Path

# Reserved Files
!insertmacro MUI_RESERVEFILE_LANGDLL

# Variables
Var StartMenuGroup

# Installer pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
Page custom DriverPage
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

# Installer languages
!insertmacro MUI_LANGUAGE English
!insertmacro MUI_LANGUAGE German

# Installer attributes
OutFile reportal-designer-210-setup.exe
InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
CRCCheck on
XPStyle on
ShowInstDetails show
VIProductVersion 2.1.0.0
VIAddVersionKey /LANG=${LANG_ENGLISH} ProductName "${PRODUCT_NAME}"
VIAddVersionKey /LANG=${LANG_ENGLISH} ProductVersion "${VERSION}"
VIAddVersionKey /LANG=${LANG_ENGLISH} CompanyName "${COMPANY}"
VIAddVersionKey /LANG=${LANG_ENGLISH} CompanyWebsite "${URL}"
VIAddVersionKey /LANG=${LANG_ENGLISH} FileVersion "${VERSION}"
VIAddVersionKey /LANG=${LANG_ENGLISH} FileDescription ""
VIAddVersionKey /LANG=${LANG_ENGLISH} LegalCopyright ""
InstallDirRegKey HKLM "${REGKEY}" Path
ShowUninstDetails show

# Installer sections
Section -Main SEC0000    
    SetOutPath $INSTDIR
    SetOverwrite on
    # Designer and Docs
    #File /r "exportedProject\eclipse\*"
    #File /r "exportedProject\docs\*.pdf"
    
    # Driver
    !insertmacro MakeDirBase "$INSTDIR\driver"
    #CopyFiles $File "$INSTDIR\driver"
    
    Sendmessage $ListBox ${LB_GETCOUNT} 0 0 $0   
    StrCpy $1 0
    MessageBox mb_ok $1
    #loop:
    #MessageBox mb_ok "$1 of $0"
    #System::Call user32::SendMessage(i$ListBox,i${LB_GETTEXT},i$1,t.r3)
    #IntOp $1 $1 + 1
    #${ifthen} $1 < $0 ${|} goto loop ${|}
    
    WriteRegStr HKLM "${REGKEY}\Components" Main 1
SectionEnd

Section -post SEC0001
    WriteRegStr HKLM "${REGKEY}" Path $INSTDIR
    SetOutPath $INSTDIR
    WriteUninstaller $INSTDIR\uninstall.exe
    !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
    SetOutPath $SMPROGRAMS\$StartMenuGroup
    CreateShortcut "$SMPROGRAMS\$StartMenuGroup\$(^UninstallLink).lnk" $INSTDIR\uninstall.exe
    CreateShortcut "$SMPROGRAMS\$StartMenuGroup\${PRODUCT_NAME} (${LANG_DE}).lnk" "$INSTDIR\${PRODUCT_NAME}.exe" "-nl de"
    CreateShortcut "$SMPROGRAMS\$StartMenuGroup\${PRODUCT_NAME} (${LANG_EN}).lnk" "$INSTDIR\${PRODUCT_NAME}" "-nl en"
    CreateShortcut "$SMPROGRAMS\$StartMenuGroup\${PRODUCT_NAME} Dokumentation (${LANG_DE}).lnk" "$INSTDIR\${PRODUCT_NAME} Benutzer Dokumentation.pdf"
    CreateShortcut "$SMPROGRAMS\$StartMenuGroup\${PRODUCT_NAME} Documentation (${LANG_EN}).lnk" "$INSTDIR\${PRODUCT_NAME} User Documentation.pdf"
    !insertmacro MUI_STARTMENU_WRITE_END
    WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)"
    WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "${VERSION}"
    WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}"
    WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}"
    WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\uninstall.exe
    WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString $INSTDIR\uninstall.exe
    WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoModify 1
    WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoRepair 1
SectionEnd

# Macro for selecting uninstaller sections
!macro SELECT_UNSECTION SECTION_NAME UNSECTION_ID
    Push $R0
    ReadRegStr $R0 HKLM "${REGKEY}\Components" "${SECTION_NAME}"
    StrCmp $R0 1 0 next${UNSECTION_ID}
    !insertmacro SelectSection "${UNSECTION_ID}"
    GoTo done${UNSECTION_ID}
next${UNSECTION_ID}:
    !insertmacro UnselectSection "${UNSECTION_ID}"
done${UNSECTION_ID}:
    Pop $R0
!macroend

# Uninstaller sections
Section /o -un.Main UNSEC0000
    DeleteRegValue HKLM "${REGKEY}\Components" Main
SectionEnd

Section -un.post UNSEC0001
    DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"
    Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\$(^UninstallLink).lnk"
    Delete /REBOOTOK $INSTDIR\uninstall.exe
    Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\${PRODUCT_NAME} (${LANG_DE}).lnk"
    Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\${PRODUCT_NAME} (${LANG_EN}).lnk"
    Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\${PRODUCT_NAME} Dokumentation (${LANG_DE}).lnk"
    Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\${PRODUCT_NAME} Documentation (${LANG_EN}).lnk"
    DeleteRegValue HKLM "${REGKEY}" StartMenuGroup
    DeleteRegValue HKLM "${REGKEY}" Path
    DeleteRegKey /IfEmpty HKLM "${REGKEY}\Components"
    DeleteRegKey /IfEmpty HKLM "${REGKEY}"
    RmDir /REBOOTOK $SMPROGRAMS\$StartMenuGroup
    RmDir /r /REBOOTOK $INSTDIR
    Push $R0
    StrCpy $R0 $StartMenuGroup 1
    StrCmp $R0 ">" no_smgroup
no_smgroup:
    Pop $R0
SectionEnd

# Installer functions
Function .onInit
    InitPluginsDir
    !insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd

Function DriverPage
    nsDialogs::Create /NOUNLOAD 1018
    Pop $Dialog
    ${If} $Dialog == error
        Abort
    ${EndIf}
    
    #Create header with description,the  title, the Label and the Buttons with event-handling
    ${If} $LANGUAGE == 1033
    
        #Title
        !insertmacro MUI_HEADER_TEXT "Driver-Selection" "Please select the driver the designer should be installed with."
        
        #Label
        ${NSD_CreateLabel} 0 0 100% 28 "The driver are available after the Installation. You can also add additional driver after the Installation."
        
        #ClearButton
        ${NSD_CreateButton} 230 31 69u 15u "Clear List"
        Pop $ClearButton
        GetFunctionAddress $0 ClearPressed
        nsDialogs::OnClick /NOUNLOAD $ClearButton $0
        
        #BrowseButton
        ${NSD_CreateButton} 345 31 69u 15u "Browse..."
        Pop $BrowseButton
        GetFunctionAddress $0 BrowsePressed
        nsDialogs::OnClick /NOUNLOAD $BrowseButton $0   
        
    ${Else}
        #Title
        !insertmacro MUI_HEADER_TEXT "Treiber-Auswahl" "Bitte wählen Sie die Treiber die mit dem Designer installiert werden sollen."
        
        #Label
        ${NSD_CreateLabel} 0 0 100% 28 "Die ausgewählten Treiber stehen nach der Installation im Designer zur Verfügung. Es können auch nachträglich weitere Treiber installiert werden."
        
        #ClearButton
        ${NSD_CreateButton} 230 31 69u 15u "Liste Löschen"
        Pop $ClearButton
        GetFunctionAddress $0 ClearPressed
        nsDialogs::OnClick /NOUNLOAD $ClearButton $0
        
        #BrowseButton
        ${NSD_CreateButton} 345 31 69u 15u "Durchsuchen..."
        Pop $BrowseButton
        GetFunctionAddress $0 BrowsePressed
        nsDialogs::OnClick /NOUNLOAD $BrowseButton $0   
    ${EndIf}

    ${NSD_CreateListBox} 0 62 100% 70% ""
    Pop $ListBox
    
    # Disable next button or enable and fill list if one file has been selected
    ${If} $File == ""
        !insertmacro NEXTBUTTONACTIVE 0
    ${Else}
        SendMessage $ListBox ${LB_ADDSTRING} 0 "STR:$File"
    ${EndIf}
    
    nsDialogs::Show
FunctionEND

Function ClearPressed
    SendMessage $ListBox ${LB_RESETCONTENT} 0 0
    !insertmacro NEXTBUTTONACTIVE 0
FunctionEND

Function BrowsePressed
    # Get File From User and initialize the dialog whereever the user had choosen a previous file
    ${If} $LANGUAGE == 1033
        ${If} $Path == ""
            Dialogs::Open "Jar Files (*.jar)|*.jar|" "1" "Choose a driver to be installed" $EXEDIR ${VAR_6}
        ${Else}
            Dialogs::Open "Jar Files (*.jar)|*.jar|" "1" "Choose a driver to be installed" $path ${VAR_6}    
        ${EndIf}
    ${Else}
        ${If} $Path == ""
            Dialogs::Open "Jar Files (*.jar)|*.jar|" "1" "Bitte einen Treiber wählen der mit installiert werden soll" $EXEDIR ${VAR_6}
        ${Else}
            Dialogs::Open "Jar Files (*.jar)|*.jar|" "1" "Bitte einen Treiber wählen der mit installiert werden soll" $Path ${VAR_6}    
        ${EndIf}
    
    ${EndIf}
     
    StrCpy $File $6
    
    # Resolve directory
    !insertmacro GetCleanParentDir $File
    Pop $path
    
    # If OK pressed add to list    
    ${If} $File != 0
        !insertmacro NEXTBUTTONACTIVE 1
        SendMessage $ListBox ${LB_ADDSTRING} 0 "STR:$File"
    ${EndIf}
FunctionEND

# Uninstaller functions
Function un.onInit
    ReadRegStr $INSTDIR HKLM "${REGKEY}" Path
    !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuGroup
    !insertmacro MUI_UNGETLANGUAGE
    !insertmacro SELECT_UNSECTION Main ${UNSEC0000}
FunctionEnd

# Installer Language Strings
# TODO Update the Language Strings with the appropriate translations.

LangString ^UninstallLink ${LANG_ENGLISH} "Uninstall $(^Name)"
LangString ^UninstallLink ${LANG_GERMAN} "Uninstall $(^Name)"