updated format, small changes

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2282 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
joostverburg 2003-03-11 20:44:48 +00:00
parent 39a9897cd8
commit 92acc0dd32
8 changed files with 394 additions and 233 deletions

View file

@ -1,12 +1,16 @@
; waplugin.nsi
;
; This script will generate an installer that installs a Winamp plug-in.
; This script will generate an installer that installs a Winamp 2 plug-in.
; It also puts a license page on, for shits and giggles.
;
; 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.
;
;--------------------------------
; Uncomment the next line to enable auto Winamp download
; !define WINAMP_AUTOINSTALL
; The name of the installer
Name "TinyVis Plug-in"
@ -14,13 +18,9 @@ Name "TinyVis Plug-in"
; The file to write
OutFile "waplugin.exe"
; License page
; LicenseText "This installer will install the Nullsoft Tiny Visualization 2000 Plug-in for Winamp. Please read the license below."
; use the default makensis license :)
; LicenseData license.txt
; The default installation directory
InstallDir $PROGRAMFILES\Winamp
; detect winamp path from uninstall string if available
InstallDirRegKey HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp" \
@ -32,30 +32,69 @@ DirShow hide
; automatically close the installer when done.
AutoCloseWindow true
; hide the "show details" box
ShowInstDetails nevershow
;--------------------------------
; The stuff to install
Section ""
!ifdef WINAMP_AUTOINSTALL
Call MakeSureIGotWinamp
!endif
Call QueryWinampVisPath
SetOutPath $1
; File to extract
File "C:\program files\winamp\plugins\vis_nsfs.dll"
; prompt user, and if they select no, go to NoWinamp
MessageBox MB_YESNO|MB_ICONQUESTION \
"The plug-in was installed. Would you like to run Winamp now with TinyVis as the default plug-in?" \
IDNO NoWinamp
WriteINIStr "$INSTDIR\Winamp.ini" "Winamp" "visplugin_name" "vis_nsfs.dll"
WriteINIStr "$INSTDIR\Winamp.ini" "Winamp" "visplugin_num" "0"
Exec '"$INSTDIR\Winamp.exe"'
NoWinamp:
SectionEnd
;--------------------------------
Function .onVerifyInstDir
!ifndef WINAMP_AUTOINSTALL
;Check for Winamp installation
IfFileExists $INSTDIR\Winamp.exe Good
Abort
Good:
!endif ; WINAMP_AUTOINSTALL
FunctionEnd
Function QueryWinampVisPath ; sets $1 with vis path
StrCpy $1 $INSTDIR\Plugins
; use DSPDir instead of VISDir to get DSP plugins directory
ReadINIStr $9 $INSTDIR\winamp.ini Winamp VisDir
StrCmp $9 "" End
IfFileExists $9 0 End
StrCpy $1 $9 ; update dir
End:
End:
FunctionEnd
!ifdef WINAMP_AUTOINSTALL
Function GetWinampInstPath
Push $0
Push $1
Push $2
@ -96,16 +135,21 @@ Function GetWinampInstPath
Pop $2
Pop $1
Exch $0
FunctionEnd
Function MakeSureIGotWinamp
Call GetWinampInstPath
Pop $0
StrCmp $0 "" getwinamp
Return
getwinamp:
Call ConnectInternet ;Make an internet connection (if no connection available)
StrCpy $2 "$TEMP\Winamp Installer.exe"
NSISdl::download http://download.nullsoft.com/winamp/client/winamp281_lite.exe $2
Pop $0
@ -121,29 +165,27 @@ Function MakeSureIGotWinamp
StrCmp $0 "" skip
StrCpy $INSTDIR $0
skip:
FunctionEnd
!endif ; WINAMP_AUTOINSTALL
; The stuff to install
Section "ThisNameIsIgnoredSoWhyBother?"
!ifdef WINAMP_AUTOINSTALL
Call MakeSureIGotWinamp
!endif
Function ConnectInternet
ClearErrors
Dialer::AttemptConnect
IfErrors noie3
Pop $R0
StrCmp $R0 "online" connected
MessageBox MB_OK|MB_ICONSTOP "Cannot connect to the internet."
Quit
noie3:
; IE3 not installed
MessageBox MB_OK|MB_ICONINFORMATION "Please connect to the internet now."
connected:
FunctionEnd
Call QueryWinampVisPath
SetOutPath $1
; File to extract
File "C:\program files\winamp\plugins\vis_nsfs.dll"
; prompt user, and if they select no, skip the following 3 instructions.
MessageBox MB_YESNO|MB_ICONQUESTION \
"The plug-in was installed. Would you like to run Winamp now with TinyVis as the default plug-in?" \
IDNO NoWinamp
WriteINIStr "$INSTDIR\Winamp.ini" "Winamp" "visplugin_name" "vis_nsfs.dll"
WriteINIStr "$INSTDIR\Winamp.ini" "Winamp" "visplugin_num" "0"
Exec '"$INSTDIR\Winamp.exe"'
NoWinamp:
SectionEnd
; eof
!endif ; WINAMP_AUTOINSTALL