home *** CD-ROM | disk | FTP | other *** search
/ Hackers Magazine 57 / CdHackersMagazineNr57.iso / Software / Programming / nsis-2.46-setup.exe / Examples / gfx.nsi < prev    next >
Encoding:
Text File  |  2008-01-27  |  3.2 KB  |  124 lines

  1. ; gfx.nsi
  2. ;
  3. ; This script shows some examples of using all of the new
  4. ; graphic related additions introduced in NSIS 2
  5. ;
  6. ; Written by Amir Szkeley 22nd July 2002
  7.  
  8. ;--------------------------------
  9.  
  10. !macro BIMAGE IMAGE PARMS
  11.     Push $0
  12.     GetTempFileName $0
  13.     File /oname=$0 "${IMAGE}"
  14.     SetBrandingImage ${PARMS} $0
  15.     Delete $0
  16.     Pop $0
  17. !macroend
  18.  
  19. ;--------------------------------
  20.  
  21. Name "Graphical effects"
  22.  
  23. OutFile "gfx.exe"
  24.  
  25. ; Adds an XP manifest to the installer
  26. XPStyle on
  27.  
  28. ; Add branding image to the installer (an image placeholder on the side).
  29. ; It is not enough to just add the placeholder, we must set the image too...
  30. ; We will later set the image in every pre-page function.
  31. ; We can also set just one persistent image in .onGUIInit
  32. AddBrandingImage left 100
  33.  
  34. ; Sets the font of the installer
  35. SetFont "Comic Sans MS" 8
  36.  
  37. ; Just to make it three pages...
  38. SubCaption 0 ": Yet another page..."
  39. SubCaption 2 ": Yet another page..."
  40. LicenseText "License page"
  41. LicenseData "gfx.nsi"
  42. DirText "Lets make a third page!"
  43.  
  44. ; Install dir
  45. InstallDir "${NSISDIR}\Examples"
  46.  
  47. ; Request application privileges for Windows Vista
  48. RequestExecutionLevel user
  49.  
  50. ;--------------------------------
  51.  
  52. ; Pages
  53. Page license licenseImage
  54. Page custom customPage
  55. Page directory dirImage
  56. Page instfiles instImage
  57.  
  58. ;--------------------------------
  59.  
  60. Section ""
  61.     ; You can also use the BI_NEXT macro here...
  62.     MessageBox MB_YESNO "We can change the branding image from within a section too!$\nDo you want me to change it?" IDNO done
  63.         !insertmacro BIMAGE "${NSISDIR}\Contrib\Graphics\Wizard\nsis.bmp" ""
  64.     done:
  65.     WriteUninstaller uninst.exe
  66. SectionEnd
  67.  
  68. ;--------------------------------
  69.  
  70. Function licenseImage
  71.     !insertmacro BIMAGE "${NSISDIR}\Contrib\Graphics\Header\nsis.bmp" /RESIZETOFIT
  72.     MessageBox MB_YESNO 'Would you like to skip the license page?' IDNO no
  73.         Abort
  74.     no:
  75. FunctionEnd
  76.  
  77. Function customPage
  78.     !insertmacro BIMAGE "${NSISDIR}\Contrib\Graphics\Checks\modern.bmp" /RESIZETOFIT
  79.     MessageBox MB_OK 'This is a nice custom "page" with yet another image :P'
  80.     #insert install options/start menu/<insert plugin name here> here
  81. FunctionEnd
  82.  
  83. Function dirImage
  84.     !insertmacro BIMAGE "${NSISDIR}\Contrib\Graphics\Header\win.bmp" /RESIZETOFIT
  85. FunctionEnd
  86.  
  87. Function instImage
  88.     !insertmacro BIMAGE "${NSISDIR}\Contrib\Graphics\Wizard\llama.bmp" /RESIZETOFIT
  89. FunctionEnd
  90.  
  91. ;--------------------------------
  92.  
  93. ; Uninstall pages
  94.  
  95. UninstPage uninstConfirm un.uninstImage
  96. UninstPage custom un.customPage
  97. UninstPage instfiles un.instImage
  98.  
  99. Function un.uninstImage
  100.     !insertmacro BIMAGE "${NSISDIR}\Contrib\Graphics\Checks\modern.bmp" /RESIZETOFIT
  101. FunctionEnd
  102.  
  103. Function un.customPage
  104.     !insertmacro BIMAGE "${NSISDIR}\Contrib\Graphics\Header\win.bmp" /RESIZETOFIT
  105.     MessageBox MB_OK 'This is a nice uninstaller custom "page" with yet another image :P'
  106.     #insert install options/start menu/<insert plugin name here> here
  107. FunctionEnd
  108.  
  109. Function un.instImage
  110.     !insertmacro BIMAGE "${NSISDIR}\Contrib\Graphics\Wizard\llama.bmp" /RESIZETOFIT
  111. FunctionEnd
  112.  
  113. ;--------------------------------
  114.  
  115. ; Uninstaller
  116.  
  117. ; Another page for uninstaller
  118. UninstallText "Another page..."
  119.  
  120. Section uninstall
  121.     MessageBox MB_OK "Bla"
  122. SectionEnd
  123.  
  124.