[go: up one dir, main page]

Menu

[r116]: / in_vgm / trunk / in_vgm.nsi  Maximize  Restore  History

Download this file

142 lines (112 with data), 3.8 kB

  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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
; This script generates an installer for a Winamp 2.x / 5.x plug-in.
;
; The installer will automatically close Winamp if it's running and then if
; successful, ask the user whether or not they would like to run Winamp with
; the newly installed plug-in.
;
; This is a single section installer but is easily altered for multiple
; sections and is based of the original Winamp installer script but tweaked
; to be easier to use i think :o)
;--------------------------------
; Header Files
; not used in this case but handy when scaling up to multiple sections
; !include "Sections.nsh"
; common defines for a generic DrO installer :o)
!define VERSION "0.35"
!define ALT_VER "035"
!define PLUG "in_vgm"
!define PLUG_ALT "in_vgm"
!define PLUG_FILE "in_vgm"
!define DEMO_FILE_1 "VGM - Streets of Rage - The Street of Rage.vgz"
!define DEMO_FILE_2 "VGM - Space Harrier Main Theme demo.vgz"
; use lzma compression
SetCompressor lzma
; The name of the installer based on the filename and version
Name "${PLUG} v${VERSION}"
; The file to write based on the filename and version
OutFile "${PLUG_ALT}_${ALT_VER}.exe"
; you could alter it to output you plugin installers into a common location
; to make it easier to maintain them
; OutFile "../_Installers/${PLUG_ALT}_v${ALT_VER}.exe"
; 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):"
; automatically close the installer when done.
AutoCloseWindow true
; adds xp style support
XPStyle on
; hide the "show details" box
ShowInstDetails nevershow
;--------------------------------
;Pages
PageEx directory
Caption " "
PageExEnd
; enable this line if you have extra sections and want to choose what's
; installed
Page components
Page instfiles
;--------------------------------
; CloseWinamp: this will in a loop send the Winamp window the WM_CLOSE
; message until it does not find a valid Winamp window
; (should really protect against Winamp failing to exit!)
;
Function CloseWinamp
Push $5
loop:
FindWindow $5 "Winamp v1.x"
IntCmp $5 0 done
SendMessage $5 16 0 0
Sleep 100
Goto loop
done:
Pop $5
FunctionEnd
; The stuff to install
Section "!in_vgm plugin"
; attempt to close Winamp if it's running
Call CloseWinamp
; add a small delay to allow any file operations to happen once Winamp
; is closed
Sleep 100
SetOverwrite on
SetOutPath "$INSTDIR\Plugins"
; File to extract
File "${PLUG_FILE}.dll"
File "${PLUG_FILE}.html"
SetOverwrite off
SectionEnd
Section "Example VGM files"
SetOutPath "$INSTDIR"
; File to extract
File "${DEMO_FILE_1}"
File "${DEMO_FILE_2}"
SectionEnd
;--------------------------------
; Success, now prompt the user if they want to run Winamp again
Function .onInstSuccess
MessageBox MB_YESNO \
'${PLUG} was installed. Do you want to run Winamp now?' \
IDNO end
IfFileExists "$INSTDIR\${DEMO_FILE_1}" demo nodemo
demo:
ExecShell open "$INSTDIR\Winamp.exe" "$\"$INSTDIR\${DEMO_FILE_1}$\" $\"$INSTDIR\${DEMO_FILE_2}$\""
goto end
nodemo:
ExecShell open "$INSTDIR\Winamp.exe"
end:
FunctionEnd
; here we check to see if this a valid location ie is there a Winamp.exe
; in the directory?
Function .onVerifyInstDir
;Check for Winamp installation
IfFileExists $INSTDIR\Winamp.exe Good
Abort
Good:
FunctionEnd