Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: NSIS Installer  (Read 4823 times)

0 Members and 1 Guest are viewing this topic.

youngbucks

    Topic Starter


    Rookie

    NSIS Installer
    « on: May 14, 2008, 05:29:22 PM »
    Im not how into using NSIS are the people here but im having a problem... Im creating a software for a newly developed application and i cant get the background of the software that was given to me to show throughtout the entire installation. It only shows when installing and i dont want that. The script for the Background image is highlighted.

    Name "Kurt's Game: Cryptonite: Dual Segas"
    Caption "Kurt's Game: Cryptonite: Dual Segas"
    Icon "${NSISDIR}\Contrib\Graphics\Icons\nsis1-install.ico"
    OutFile "Install.exe"
    InstallDir $DESKTOP\Cryptonite
    LicenseText "Read Before Continuing!"
    LicenseData "TOU.txt"

    Page license
    Page directory
    Page instfiles

    UninstPage uninstConfirm
    UninstPage instfiles

    #Background Image Script Starts Here
    XPStyle on

    # !define DEBUG
    !macro GetReturnValue
    !ifdef DEBUG
       Pop $R9
       StrCmp $R9 success +2
          DetailPrint "Error: $R9"
    !endif
    !macroend

    Function .onGUIInit
       # the plugins dir is automatically deleted when the installer exits
       InitPluginsDir
       # lets extract some bitmaps...
       File /oname=$PLUGINSDIR\1.bmp "${NSISDIR}\Contrib\Graphics\Wizard\B.bmp"

    !ifdef DEBUG
       # turn return values on if in debug mode
       BgImage::SetReturn /NOUNLOAD on
    !endif

       BgImage::SetBg /NOUNLOAD /GRADIENT 0
       !insertmacro GetReturnValue
       BgImage::AddImage /NOUNLOAD /FILLSCREEN $PLUGINSDIR\1.bmp
       !insertmacro GetReturnValue
       BgImage::Redraw /NOUNLOAD
       
    FunctionEnd

    ShowInstDetails show

    Section
       BgImage::AddImage /NOUNLOAD $PLUGINSDIR\1.bmp
       !insertmacro GetReturnValue
       BgImage::Redraw /NOUNLOAD
    SectionEnd


    ShowInstDetails show

    Section
       BgImage::AddImage /NOUNLOAD $PLUGINSDIR\1.bmp
       !insertmacro GetReturnValue
       BgImage::Redraw /NOUNLOAD
    SectionEnd

    Function .onGUIEnd
       # Destroy must not have /NOUNLOAD so NSIS will be able to unload
       # and delete BgImage before it exits
       BgImage::Destroy
       # Destroy doesn't return any value
    FunctionEnd



    #Splash Screen
    Function .onInit
      SetOutPath $TEMP
      File /oname=spltmp.bmp "my_splash.bmp"

    ; optional
    ; File /oname=spltmp.wav "my_splashshit.wav"

      advsplash::show 1000 2000 2000 -1 $TEMP\spltmp

      Pop $0 ; $0 has '1' if the user closed the splash screen early,
             ; '0' if everything closed normally, and '-1' if some error occurred.

      Delete $TEMP\spltmp.bmp
    ;  Delete $TEMP\spltmp.wav

    FunctionEnd

    RequestExecutionLevel admin

    ;--------------------------------

    #Installation Section Starts Here

    !define MUI_PRODUCT "Cryptonite: Dual Segas"
    !define MUI_FILE "savefile"
    !define MUI_VERSION "1.0.0"
    !define MUI_BRANDINGTEXT "Cryptonite: Dual Segas"
    CRCCheck On

    Section "Installation F (required)"

    SetOutPath $INSTDIR

    SectionIn RO

    File Install2.nsi

    WriteRegStr HKLM SOFTWARE\NSIS_Cryptonite "Install_Dir" "$INSTDIR"
    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cryptonite" "DisplayName" "Dual Segas"
    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cryptonite" "UninstallString" '"$INSTDIR\uninstall.exe"'
    WriteRegStr HKLM SOFTWARE\Cryptonite\Dual Segas "$INSTDIR"
    WriteUninstaller "uninstall.exe"

    SectionEnd

    ; Uninstaller

    UninstallText "This will uninstall Segas. Hit next to continue."
    UninstallIcon "${NSISDIR}\Contrib\Graphics\Icons\nsis1-uninstall.ico"

    Section "Uninstall"

      DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cryptonite"
      DeleteRegKey HKLM "SOFTWARE\SOFTWARE\Cryptonite\Dual Segas"
      Delete "$INSTDIR\install2.nsi"
      RMDir /r "$INSTDIR\*.*"
      RMDir "$INSTDIR\"

      IfFileExists "$INSTDIR" 0 NoErrorMsg
      MessageBox MB_OK "Note: $INSTDIR could not be removed!" IDOK 0 ; skipped if file doesn't exist
      NoErrorMsg:



    SectionEnd