aboutsummaryrefslogtreecommitdiff
path: root/Src/Plugins/SDK/gen_classicart/gen_classicart.nsi
blob: c1dc70c16cd7bbef49ce37e15e3b8f025ca98472 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
; waplugin.nsi
;
; This script will generate an installer that installs a Winamp 2 plug-in.
;
; This installer will automatically alert the user that installation was
; successful, and ask them whether or not they would like to make the 
; plug-in the default and run Winamp.

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

;Header Files

!include "Sections.nsh"
!include "WinMessages.nsh"

; common defines for a generic dro installer :o)
!define VERSION "0.6"
!define ALT_VER "0_6"
!define PLUG "Album Art Viewer"
!define PLUG_ALT "Album_Art_Viewer"
!define PLUG_FILE "gen_classicart"

; use leet compression
SetCompressor lzma

; adds xp style support
XPStyle on

; The name of the installer
Name "${PLUG} v${VERSION}"

; The file to write
OutFile "${PLUG_ALT}_v${ALT_VER}.exe"

InstType "Plugin only"
InstType "Plugin + language file"
InstType /NOCUSTOM
InstType /COMPONENTSONLYONCUSTOM

; The default installation directory
InstallDir $PROGRAMFILES\Winamp
InstProgressFlags smooth

; detect winamp path from uninstall string if available
InstallDirRegKey HKLM \
                 "Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp" \
                 "UninstallString"

; The text to prompt the user to enter a directory
DirText "Please select your Winamp path below (you will be able to proceed when Winamp is detected):"
# currently doesn't work - DirShow hide

; automatically close the installer when done.
AutoCloseWindow true

; hide the "show details" box
ShowInstDetails show

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

;Pages

PageEx directory
Caption " "
PageExEnd
Page components
Page instfiles

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


; The stuff to install
Section ""
  SetOverwrite on
  SetOutPath "$INSTDIR\Plugins"
  ; File to extract
  File "x86_Release\${PLUG_FILE}.dll"
  SetOverwrite off
SectionEnd

Section "Example language file"
;  SectionSetFlags 0  SF_BOLD
  SectionIn 2

  SetOverwrite on
  SetOutPath "$INSTDIR\Plugins\${PLUG_FILE}"
  ; File to extract
  File "x86_Release\LangFiles\${PLUG_FILE}.lng"
  SetOverwrite off
SectionEnd

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

Function .onInit
  ;Detect running Winamp instances and close them
  !define WINAMP_FILE_EXIT 40001

  FindWindow $R0 "Winamp v1.x"
  IntCmp $R0 0 ok
    MessageBox MB_YESNO|MB_ICONEXCLAMATION "Please close all instances of Winamp before installing$\n\
					    ${PLUG} v${VERSION}. Attempt to close Winamp now?" IDYES checkagain IDNO no
    checkagain:
      FindWindow $R0 "Winamp v1.x"
      IntCmp $R0 0 ok
      SendMessage $R0 ${WM_COMMAND} ${WINAMP_FILE_EXIT} 0
      Goto checkagain
    no:
       Abort
  ok:
FunctionEnd

Function .onInstSuccess
  MessageBox MB_YESNO \
             '${PLUG} was installed. Do you want to run Winamp now?' \
	 IDNO end
    ExecShell open "$INSTDIR\Winamp.exe"
  end:
FunctionEnd

Function .onVerifyInstDir
  ;Check for Winamp installation
  IfFileExists $INSTDIR\Winamp.exe Good
    Abort
  Good:
FunctionEnd