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:
parent
39a9897cd8
commit
92acc0dd32
8 changed files with 394 additions and 233 deletions
|
@ -1,7 +1,9 @@
|
|||
; bigtest.nsi
|
||||
;
|
||||
; This script attempts to test most of the functionality of NSIS.
|
||||
;
|
||||
; This script attempts to test most of the functionality of the NSIS exehead.
|
||||
|
||||
;--------------------------------
|
||||
|
||||
!ifdef HAVE_UPX
|
||||
!packhdr tmp.dat "upx\upx -9 tmp.dat"
|
||||
!endif
|
||||
|
@ -10,6 +12,13 @@
|
|||
SetCompress off
|
||||
!endif
|
||||
|
||||
;--------------------------------
|
||||
|
||||
Name "BigNSISTest"
|
||||
Caption "NSIS Big Test"
|
||||
Icon "..\contrib\Icons\normal-install.ico"
|
||||
OutFile "bigtest.exe"
|
||||
|
||||
SetDateSave on
|
||||
SetDatablockOptimize on
|
||||
CRCCheck on
|
||||
|
@ -18,56 +27,52 @@ BGGradient 000000 800000 FFFFFF
|
|||
InstallColors FF8080 000030
|
||||
XPStyle on
|
||||
|
||||
Name "BigNSISTest"
|
||||
Caption "NSIS Big Test"
|
||||
Icon "..\contrib\Icons\normal-install.ico"
|
||||
OutFile "bigtest.exe"
|
||||
|
||||
LicenseText "make sure this license text is all there (it's about 28k last I checked). The last line is a simple '}'."
|
||||
LicenseText "A license text, make sure it's all there"
|
||||
LicenseData "..\source\exehead\main.c"
|
||||
|
||||
InstallDir "$PROGRAMFILES\NSISCrap\BigNSISTest"
|
||||
InstallDirRegKey HKLM SOFTWARE\NSISCrap\BigNSISTest "Install_Dir"
|
||||
DirText "Choose a directory to install in to:"
|
||||
|
||||
; uninstall stuff
|
||||
UninstallText "This will uninstall example2. Hit next to continue."
|
||||
UninstallIcon "..\contrib\Icons\normal-uninstall.ico"
|
||||
|
||||
ComponentText "This will install the test on your computer. Select which optional things you want installed."
|
||||
CheckBitmap ..\contrib\Icons\checksX.bmp
|
||||
|
||||
!ifndef NOINSTTYPES ; only if not defined
|
||||
InstType "Most"
|
||||
InstType "Full"
|
||||
InstType "More"
|
||||
InstType "Base"
|
||||
;InstType /NOCUSTOM
|
||||
;InstType /COMPONENTSONLYONCUSTOM
|
||||
InstType "Most"
|
||||
InstType "Full"
|
||||
InstType "More"
|
||||
InstType "Base"
|
||||
;InstType /NOCUSTOM
|
||||
;InstType /COMPONENTSONLYONCUSTOM
|
||||
!endif
|
||||
|
||||
AutoCloseWindow false
|
||||
ShowInstDetails show
|
||||
|
||||
;--------------------------------
|
||||
|
||||
Section "" ; empty string makes it hidden, so would starting with -
|
||||
; write reg crap
|
||||
StrCpy $1 "POOOOOOOOOOOP"
|
||||
DetailPrint "I like to f*ck sheep $1"
|
||||
WriteRegStr HKLM SOFTWARE\NSISCrap\BigNSISTest "Install_Dir" "$INSTDIR"
|
||||
; write uninstall strings
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BigNSISTest" "DisplayName" "BigNSISTest (remove only)"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BigNSISTest" "UninstallString" '"$INSTDIR\bt-uninst.exe"'
|
||||
#File /oname=poop.exe makensisw.exe
|
||||
|
||||
SetOutPath $INSTDIR
|
||||
File /a "..\source\exehead\bin2h.exe"
|
||||
CreateDirectory "$INSTDIR\shiz\crap" ; 2 recursively create a directory for fun.
|
||||
WriteUninstaller "bt-uninst.exe"
|
||||
Nop ; for fun
|
||||
; write reg crap
|
||||
StrCpy $1 "POOOOOOOOOOOP"
|
||||
DetailPrint "I like to f*ck sheep $1"
|
||||
WriteRegStr HKLM SOFTWARE\NSISCrap\BigNSISTest "Install_Dir" "$INSTDIR"
|
||||
|
||||
; write uninstall strings
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BigNSISTest" "DisplayName" "BigNSISTest (remove only)"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BigNSISTest" "UninstallString" '"$INSTDIR\bt-uninst.exe"'
|
||||
|
||||
SetOutPath $INSTDIR
|
||||
File /a "..\source\exehead\bin2h.exe"
|
||||
CreateDirectory "$INSTDIR\shiz\crap" ; 2 recursively create a directory for fun.
|
||||
WriteUninstaller "bt-uninst.exe"
|
||||
|
||||
Nop ; for fun
|
||||
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section "TempTest"
|
||||
|
||||
SectionIn 1 2 3
|
||||
Start: MessageBox MB_OK "Start:"
|
||||
|
||||
|
@ -83,151 +88,170 @@ SectionIn 1 2 3
|
|||
|
||||
SectionEnd
|
||||
|
||||
|
||||
Function poopTest
|
||||
ReadINIStr $1 "$INSTDIR\test.ini" "MySectionShit" "Value1"
|
||||
StrCmp $1 $8 NoFailedMsg
|
||||
MessageBox MB_OK "WriteINIStr failed"
|
||||
NoFailedMsg: FunctionEnd
|
||||
|
||||
|
||||
SubSection /e SubSection1
|
||||
|
||||
Section "Test Registry/INI functions"
|
||||
|
||||
SectionIn 1 4 3
|
||||
WriteRegStr HKLM SOFTWARE\NSISCrap\BigNSISTest "StrTest_INSTDIR" "$INSTDIR"
|
||||
WriteRegDword HKLM SOFTWARE\NSISCrap\BigNSISTest "DwordTest_0xDEADBEEF" 0xdeadbeef
|
||||
WriteRegDword HKLM SOFTWARE\NSISCrap\BigNSISTest "DwordTest_123456" 123456
|
||||
WriteRegDword HKLM SOFTWARE\NSISCrap\BigNSISTest "DwordTest_0123" 0123
|
||||
WriteRegBin HKLM SOFTWARE\NSISCrap\BigNSISTest "BinTest_deadbeef01f00dbeef" "DEADBEEF01F00DBEEF"
|
||||
StrCpy $8 "$SYSDIR\Poop"
|
||||
WriteINIStr "$INSTDIR\test.ini" "MySection" "Value1" $8
|
||||
WriteINIStr "$INSTDIR\test.ini" "MySectionShit" "Value1" $8
|
||||
WriteINIStr "$INSTDIR\test.ini" "MySectionShit" "Value2" $8
|
||||
WriteINIStr "$INSTDIR\test.ini" "POOPon" "Value1" $8
|
||||
Call poopTest
|
||||
|
||||
DeleteINIStr "$INSTDIR\test.ini" "POOPon" "Value1"
|
||||
DeleteINISec "$INSTDIR\test.ini" "MySectionShit"
|
||||
WriteRegStr HKLM SOFTWARE\NSISCrap\BigNSISTest "StrTest_INSTDIR" "$INSTDIR"
|
||||
WriteRegDword HKLM SOFTWARE\NSISCrap\BigNSISTest "DwordTest_0xDEADBEEF" 0xdeadbeef
|
||||
WriteRegDword HKLM SOFTWARE\NSISCrap\BigNSISTest "DwordTest_123456" 123456
|
||||
WriteRegDword HKLM SOFTWARE\NSISCrap\BigNSISTest "DwordTest_0123" 0123
|
||||
WriteRegBin HKLM SOFTWARE\NSISCrap\BigNSISTest "BinTest_deadbeef01f00dbeef" "DEADBEEF01F00DBEEF"
|
||||
StrCpy $8 "$SYSDIR\Poop"
|
||||
WriteINIStr "$INSTDIR\test.ini" "MySection" "Value1" $8
|
||||
WriteINIStr "$INSTDIR\test.ini" "MySectionShit" "Value1" $8
|
||||
WriteINIStr "$INSTDIR\test.ini" "MySectionShit" "Value2" $8
|
||||
WriteINIStr "$INSTDIR\test.ini" "POOPon" "Value1" $8
|
||||
|
||||
ReadINIStr $1 "$INSTDIR\test.ini" "MySectionShit" "Value1"
|
||||
StrCmp $1 "" INIDelSuccess
|
||||
MessageBox MB_OK "DeleteINISec failed"
|
||||
INIDelSuccess:
|
||||
Call poopTest
|
||||
|
||||
ClearErrors
|
||||
ReadRegStr $1 HKCR "software\microsoft" shit
|
||||
IfErrors 0 NoError
|
||||
MessageBox MB_OK "could not read from HKCR\software\microsoft\shit"
|
||||
Goto ErrorYay
|
||||
NoError:
|
||||
MessageBox MB_OK "read '$1' from HKCR\software\microsoft\shit"
|
||||
ErrorYay:
|
||||
DeleteINIStr "$INSTDIR\test.ini" "POOPon" "Value1"
|
||||
DeleteINISec "$INSTDIR\test.ini" "MySectionShit"
|
||||
|
||||
ReadINIStr $1 "$INSTDIR\test.ini" "MySectionShit" "Value1"
|
||||
StrCmp $1 "" INIDelSuccess
|
||||
MessageBox MB_OK "DeleteINISec failed"
|
||||
INIDelSuccess:
|
||||
|
||||
ClearErrors
|
||||
ReadRegStr $1 HKCR "software\microsoft" shit
|
||||
IfErrors 0 NoError
|
||||
MessageBox MB_OK "could not read from HKCR\software\microsoft\shit"
|
||||
Goto ErrorYay
|
||||
NoError:
|
||||
MessageBox MB_OK "read '$1' from HKCR\software\microsoft\shit"
|
||||
ErrorYay:
|
||||
|
||||
SectionEnd
|
||||
|
||||
|
||||
Function "CSCTest"
|
||||
CreateDirectory "$SMPROGRAMS\Big NSIS Test"
|
||||
SetOutPath $INSTDIR ; for working directory
|
||||
CreateShortCut "$SMPROGRAMS\Big NSIS Test\Uninstall BIG NSIS Test.lnk" "$INSTDIR\bt-uninst.exe" ; use defaults for parameters, icon, etc.
|
||||
; this one will use notepad's icon, start it minimized, and give it a hotkey (of Ctrl+Shift+Q)
|
||||
CreateShortCut "$SMPROGRAMS\Big NSIS Test\bin2h.exe.lnk" "$INSTDIR\bin2h.exe" "" "$WINDIR\notepad.exe" 0 SW_SHOWMINIMIZED CONTROL|SHIFT|Q
|
||||
CreateShortCut "$SMPROGRAMS\Big NSIS Test\TheDir.lnk" "$INSTDIR\" "" "" 0 SW_SHOWMAXIMIZED CONTROL|SHIFT|Z
|
||||
FunctionEnd
|
||||
|
||||
|
||||
Section "Test CreateShortCut"
|
||||
SectionIn 1 2 3
|
||||
Call CSCTest
|
||||
|
||||
SectionIn 1 2 3
|
||||
|
||||
Call CSCTest
|
||||
|
||||
SectionEnd
|
||||
|
||||
SubSection Sub2
|
||||
|
||||
Function myfunc
|
||||
StrCpy $2 "poop=$1"
|
||||
MessageBox MB_OK "myfunc: $2"
|
||||
FunctionEnd
|
||||
|
||||
Section "Test Branching"
|
||||
BeginTestSection:
|
||||
SectionIn 1 2 3
|
||||
SetOutPath $INSTDIR
|
||||
IfFileExists "$INSTDIR\bin2h.c" 0 BranchTest69
|
||||
MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to overwrite $INSTDIR\bin2h.c?" IDNO NoOverwrite ; skipped if file doesn't exist
|
||||
BranchTest69:
|
||||
SetOverwrite ifnewer ; NOT AN INSTRUCTION, NOT COUNTED IN SKIPPINGS
|
||||
NoOverwrite:
|
||||
File "..\source\exehead\bin2h.c" ; skipped if answered no
|
||||
SetOverwrite try ; NOT AN INSTRUCTION, NOT COUNTED IN SKIPPINGS
|
||||
MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to skip the rest of this section?" IDYES EndTestBranch
|
||||
MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to go back to the beginning of this section?" IDYES BeginTestSection
|
||||
MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to hide the installer and wait five seconds?" IDNO NoHide
|
||||
HideWindow
|
||||
Sleep 5000
|
||||
BringToFront
|
||||
NoHide:
|
||||
MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to call the function 5 times?" IDNO NoRecurse
|
||||
StrCpy $1 "x"
|
||||
LoopPoop:
|
||||
Call myfunc
|
||||
StrCpy $1 "x$1"
|
||||
StrCmp $1 "xxxxxx" 0 LoopPoop
|
||||
NoRecurse:
|
||||
|
||||
BeginTestSection:
|
||||
SectionIn 1 2 3
|
||||
|
||||
SetOutPath $INSTDIR
|
||||
|
||||
EndTestBranch:
|
||||
IfFileExists "$INSTDIR\bin2h.c" 0 BranchTest69
|
||||
|
||||
MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to overwrite $INSTDIR\bin2h.c?" IDNO NoOverwrite ; skipped if file doesn't exist
|
||||
|
||||
BranchTest69:
|
||||
|
||||
SetOverwrite ifnewer ; NOT AN INSTRUCTION, NOT COUNTED IN SKIPPINGS
|
||||
|
||||
NoOverwrite:
|
||||
|
||||
File "..\source\exehead\bin2h.c" ; skipped if answered no
|
||||
SetOverwrite try ; NOT AN INSTRUCTION, NOT COUNTED IN SKIPPINGS
|
||||
|
||||
MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to skip the rest of this section?" IDYES EndTestBranch
|
||||
MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to go back to the beginning of this section?" IDYES BeginTestSection
|
||||
MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to hide the installer and wait five seconds?" IDNO NoHide
|
||||
|
||||
HideWindow
|
||||
Sleep 5000
|
||||
BringToFront
|
||||
|
||||
NoHide:
|
||||
|
||||
MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to call the function 5 times?" IDNO NoRecurse
|
||||
|
||||
StrCpy $1 "x"
|
||||
|
||||
LoopPoop:
|
||||
|
||||
Call myfunc
|
||||
StrCpy $1 "x$1"
|
||||
StrCmp $1 "xxxxxx" 0 LoopPoop
|
||||
|
||||
NoRecurse:
|
||||
|
||||
EndTestBranch:
|
||||
|
||||
SectionEnd
|
||||
|
||||
SubSectionEnd
|
||||
|
||||
Section "Test CopyFiles"
|
||||
SectionIn 1 2 3
|
||||
SetOutPath $INSTDIR\cpdest
|
||||
CopyFiles "$WINDIR\*.ini" "$INSTDIR\cpdest" 0
|
||||
|
||||
SectionIn 1 2 3
|
||||
|
||||
SetOutPath $INSTDIR\cpdest
|
||||
CopyFiles "$WINDIR\*.ini" "$INSTDIR\cpdest" 0
|
||||
|
||||
SectionEnd
|
||||
|
||||
SubSectionEnd
|
||||
|
||||
Section "Test Exec functions" CRAPIDX
|
||||
SectionIn 1 2 3
|
||||
SearchPath $1 notepad.exe
|
||||
MessageBox MB_OK "notepad.exe=$1"
|
||||
Exec '"$1"'
|
||||
ExecShell "open" '"$INSTDIR"'
|
||||
Sleep 500
|
||||
BringToFront
|
||||
|
||||
SectionIn 1 2 3
|
||||
|
||||
SearchPath $1 notepad.exe
|
||||
|
||||
MessageBox MB_OK "notepad.exe=$1"
|
||||
Exec '"$1"'
|
||||
ExecShell "open" '"$INSTDIR"'
|
||||
Sleep 500
|
||||
BringToFront
|
||||
|
||||
SectionEnd
|
||||
|
||||
Section "Test ActiveX control registration"
|
||||
SectionIn 2
|
||||
UnRegDLL "$SYSDIR\spin32.ocx"
|
||||
Sleep 1000
|
||||
RegDLL "$SYSDIR\spin32.ocx"
|
||||
Sleep 1000
|
||||
|
||||
SectionIn 2
|
||||
|
||||
UnRegDLL "$SYSDIR\spin32.ocx"
|
||||
Sleep 1000
|
||||
RegDLL "$SYSDIR\spin32.ocx"
|
||||
Sleep 1000
|
||||
|
||||
SectionEnd
|
||||
|
||||
; special uninstall section.
|
||||
Section "Uninstall"
|
||||
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BigNSISTest"
|
||||
DeleteRegKey HKLM "SOFTWARE\NSISCrap\BigNSISTest"
|
||||
Delete "$INSTDIR\bin2h.exe"
|
||||
Delete "$INSTDIR\bin2h.c"
|
||||
Delete "$INSTDIR\bt-uninst.exe"
|
||||
Delete "$INSTDIR\test.ini"
|
||||
Delete "$SMPROGRAMS\Big NSIS Test\*.*"
|
||||
RMDir "$SMPROGRAMS\BiG NSIS Test"
|
||||
MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to remove the directory $INSTDIR\cpdest?" IDNO NoDelete
|
||||
Delete "$INSTDIR\cpdest\*.*"
|
||||
RMDir "$INSTDIR\cpdest" ; skipped if no
|
||||
NoDelete:
|
||||
RMDir "$INSTDIR\shiz\crap"
|
||||
RMDir "$INSTDIR\shiz"
|
||||
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
|
||||
;--------------------------------
|
||||
|
||||
; eof
|
||||
Function "CSCTest"
|
||||
|
||||
CreateDirectory "$SMPROGRAMS\Big NSIS Test"
|
||||
SetOutPath $INSTDIR ; for working directory
|
||||
CreateShortCut "$SMPROGRAMS\Big NSIS Test\Uninstall BIG NSIS Test.lnk" "$INSTDIR\bt-uninst.exe" ; use defaults for parameters, icon, etc.
|
||||
; this one will use notepad's icon, start it minimized, and give it a hotkey (of Ctrl+Shift+Q)
|
||||
CreateShortCut "$SMPROGRAMS\Big NSIS Test\bin2h.exe.lnk" "$INSTDIR\bin2h.exe" "" "$WINDIR\notepad.exe" 0 SW_SHOWMINIMIZED CONTROL|SHIFT|Q
|
||||
CreateShortCut "$SMPROGRAMS\Big NSIS Test\TheDir.lnk" "$INSTDIR\" "" "" 0 SW_SHOWMAXIMIZED CONTROL|SHIFT|Z
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function myfunc
|
||||
|
||||
StrCpy $2 "poop=$1"
|
||||
MessageBox MB_OK "myfunc: $2"
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function poopTest
|
||||
|
||||
ReadINIStr $1 "$INSTDIR\test.ini" "MySectionShit" "Value1"
|
||||
StrCmp $1 $8 NoFailedMsg
|
||||
MessageBox MB_OK "WriteINIStr failed"
|
||||
|
||||
NoFailedMsg:
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function .onSelChange
|
||||
|
||||
SectionGetText ${CRAPIDX} $0
|
||||
StrCmp $0 "" e
|
||||
SectionSetText ${CRAPIDX} ""
|
||||
|
@ -237,3 +261,36 @@ e:
|
|||
e2:
|
||||
|
||||
FunctionEnd
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; Uninstaller
|
||||
|
||||
UninstallText "This will uninstall example2. Hit next to continue."
|
||||
UninstallIcon "..\contrib\Icons\normal-uninstall.ico"
|
||||
|
||||
Section "Uninstall"
|
||||
|
||||
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BigNSISTest"
|
||||
DeleteRegKey HKLM "SOFTWARE\NSISCrap\BigNSISTest"
|
||||
Delete "$INSTDIR\bin2h.exe"
|
||||
Delete "$INSTDIR\bin2h.c"
|
||||
Delete "$INSTDIR\bt-uninst.exe"
|
||||
Delete "$INSTDIR\test.ini"
|
||||
Delete "$SMPROGRAMS\Big NSIS Test\*.*"
|
||||
RMDir "$SMPROGRAMS\BiG NSIS Test"
|
||||
|
||||
MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to remove the directory $INSTDIR\cpdest?" IDNO NoDelete
|
||||
Delete "$INSTDIR\cpdest\*.*"
|
||||
RMDir "$INSTDIR\cpdest" ; skipped if no
|
||||
NoDelete:
|
||||
|
||||
RMDir "$INSTDIR\shiz\crap"
|
||||
RMDir "$INSTDIR\shiz"
|
||||
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
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
; optional settings are left to their default settings. The installer simply
|
||||
; prompts the user asking them where to install, and drops a copy of makensisw.exe
|
||||
; there.
|
||||
;
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; The name of the installer
|
||||
Name "Example1"
|
||||
|
@ -18,12 +19,15 @@ InstallDir $PROGRAMFILES\Example1
|
|||
; The text to prompt the user to enter a directory
|
||||
DirText "This will install the very simple example1 on your computer. Choose a directory"
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; The stuff to install
|
||||
Section "ThisNameIsIgnoredSoWhyBother?"
|
||||
Section "" ;Only one section, so the name is not important
|
||||
|
||||
; Set output path to the installation directory.
|
||||
SetOutPath $INSTDIR
|
||||
|
||||
; Put file there
|
||||
File ..\makensisw.exe
|
||||
SectionEnd ; end the section
|
||||
|
||||
; eof
|
||||
|
||||
SectionEnd ; end the section
|
|
@ -1,10 +1,11 @@
|
|||
; example2.nsi
|
||||
;
|
||||
; This script is based on example1.nsi, but adds uninstall support
|
||||
; and (optionally) start menu shortcuts.
|
||||
;
|
||||
; It will install notepad.exe into a directory that the user selects,
|
||||
; This script is based on example1.nsi, but it remember the directory,
|
||||
; has uninstall support and (optionally) installs start menu shortcuts.
|
||||
;
|
||||
; It will install makensisw.exe into a directory that the user selects,
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; The name of the installer
|
||||
Name "Example2"
|
||||
|
@ -14,55 +15,72 @@ OutFile "example2.exe"
|
|||
|
||||
; The default installation directory
|
||||
InstallDir $PROGRAMFILES\Example2
|
||||
|
||||
; Registry key to check for directory (so if you install again, it will
|
||||
; overwrite the old one automatically)
|
||||
InstallDirRegKey HKLM SOFTWARE\NSIS_Example2 "Install_Dir"
|
||||
|
||||
; The text to prompt the user to enter a directory
|
||||
ComponentText "This will install the less simple example2 on your computer. Select which optional things you want installed."
|
||||
|
||||
; The text to prompt the user to enter a directory
|
||||
DirText "Choose a directory to install in to:"
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; The stuff to install
|
||||
Section "Example2 (required)"
|
||||
|
||||
SectionIn RO
|
||||
|
||||
; Set output path to the installation directory.
|
||||
SetOutPath $INSTDIR
|
||||
|
||||
; Put file there
|
||||
File "..\makensisw.exe"
|
||||
|
||||
; Write the installation path into the registry
|
||||
WriteRegStr HKLM SOFTWARE\NSIS_Example2 "Install_Dir" "$INSTDIR"
|
||||
|
||||
; Write the uninstall keys for Windows
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2" "DisplayName" "NSIS Example2 (remove only)"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
||||
WriteUninstaller "uninstall.exe"
|
||||
|
||||
SectionEnd
|
||||
|
||||
; optional section
|
||||
; optional section (can be disabled by the user)
|
||||
Section "Start Menu Shortcuts"
|
||||
|
||||
CreateDirectory "$SMPROGRAMS\Example2"
|
||||
CreateShortCut "$SMPROGRAMS\Example2\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
|
||||
CreateShortCut "$SMPROGRAMS\Example2\Example2 (notepad).lnk" "$WINDIR\notepad.exe" "" "$INSTDIR\makensisw.exe" 0
|
||||
CreateShortCut "$SMPROGRAMS\Example2\Example2 (MakeNSISW).lnk" "$INSTDIR\makensisw.exe" "" "$INSTDIR\makensisw.exe" 0
|
||||
|
||||
SectionEnd
|
||||
|
||||
; uninstall stuff
|
||||
;--------------------------------
|
||||
|
||||
; Uninstaller
|
||||
|
||||
UninstallText "This will uninstall example2. Hit next to continue."
|
||||
|
||||
; special uninstall section.
|
||||
; Uninstall section
|
||||
|
||||
Section "Uninstall"
|
||||
|
||||
; remove registry keys
|
||||
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2"
|
||||
DeleteRegKey HKLM SOFTWARE\NSIS_Example2
|
||||
; remove files
|
||||
|
||||
; remove files and uninstaller
|
||||
Delete $INSTDIR\makensisw.exe
|
||||
; MUST REMOVE UNINSTALLER, too
|
||||
Delete $INSTDIR\uninstall.exe
|
||||
; remove shortcuts, if any.
|
||||
|
||||
; remove shortcuts, if any
|
||||
Delete "$SMPROGRAMS\Example2\*.*"
|
||||
; remove directories used.
|
||||
|
||||
; remove directories used
|
||||
RMDir "$SMPROGRAMS\Example2"
|
||||
RMDir "$INSTDIR"
|
||||
SectionEnd
|
||||
|
||||
; eof
|
||||
SectionEnd
|
|
@ -4,7 +4,8 @@
|
|||
; graphic related additions introduced in NSIS 2
|
||||
;
|
||||
; Written by Amir Szkeley 22nd July 2002
|
||||
;
|
||||
|
||||
;--------------------------------
|
||||
|
||||
!macro BIMAGE IMAGE PARMS
|
||||
Push $0
|
||||
|
@ -15,6 +16,8 @@
|
|||
Pop $0
|
||||
!macroend
|
||||
|
||||
;--------------------------------
|
||||
|
||||
Name "Graphical effects"
|
||||
|
||||
OutFile "gfx.exe"
|
||||
|
@ -44,6 +47,21 @@ Page custom customPage
|
|||
Page directory dirImage
|
||||
Page instfiles instImage
|
||||
|
||||
; Install dir
|
||||
InstallDir "${NSISDIR}\Examples"
|
||||
|
||||
;--------------------------------
|
||||
|
||||
Section ""
|
||||
; You can also use the BI_NEXT macro here...
|
||||
MessageBox MB_YESNO "We can change the branding image from within a section too!$\nDo you want me to change it?" IDNO done
|
||||
!insertmacro BIMAGE "${NSISDIR}\Contrib\Icons\checksX2.bmp" ""
|
||||
done:
|
||||
WriteUninstaller uninst.exe
|
||||
SectionEnd
|
||||
|
||||
;--------------------------------
|
||||
|
||||
Function licenseImage
|
||||
!insertmacro BIMAGE "${NSISDIR}\Contrib\Icons\checks1.bmp" /RESIZETOFIT
|
||||
MessageBox MB_YESNO 'Would you like to skip the license page?' IDNO no
|
||||
|
@ -65,21 +83,10 @@ Function instImage
|
|||
!insertmacro BIMAGE "${NSISDIR}\Contrib\Icons\checks-sdbarker.bmp" /RESIZETOFIT
|
||||
FunctionEnd
|
||||
|
||||
; Install dir
|
||||
InstallDir "${NSISDIR}\Examples"
|
||||
|
||||
Section
|
||||
; You can also use the BI_NEXT macro here...
|
||||
MessageBox MB_YESNO "We can change the branding image from within a section too!$\nDo you want me to change it?" IDNO done
|
||||
!insertmacro BIMAGE "${NSISDIR}\Contrib\Icons\checksX2.bmp" ""
|
||||
done:
|
||||
WriteUninstaller uninst.exe
|
||||
SectionEnd
|
||||
|
||||
; Another page for uninstaller
|
||||
UninstallText "Another page..."
|
||||
;--------------------------------
|
||||
|
||||
; Uninstall pages
|
||||
|
||||
UninstPage uninstConfirm un.uninstImage
|
||||
UninstPage custom un.customPage
|
||||
UninstPage instfiles un.instImage
|
||||
|
@ -98,6 +105,14 @@ Function un.instImage
|
|||
!insertmacro BIMAGE "${NSISDIR}\Contrib\Icons\jarsonic-checks.bmp" /RESIZETOFIT
|
||||
FunctionEnd
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; Uninstaller
|
||||
|
||||
; Another page for uninstaller
|
||||
UninstallText "Another page..."
|
||||
|
||||
Section uninstall
|
||||
MessageBox MB_OK "Bla"
|
||||
SectionEnd
|
||||
SectionEnd
|
||||
|
||||
|
|
|
@ -1,7 +1,16 @@
|
|||
; languages.nsi
|
||||
;
|
||||
; This is an example of a multilingual installer
|
||||
; The user can select the language on startup
|
||||
|
||||
;--------------------------------
|
||||
|
||||
OutFile languages.exe
|
||||
|
||||
XPStyle on
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; First is default
|
||||
LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf"
|
||||
Name English
|
||||
|
@ -63,6 +72,8 @@ LangString Message ${LANG_TRADCHINESE} "Trandional Chinese message"
|
|||
LangString Message ${LANG_SIMPCHINESE} "Simplified Chinese message"
|
||||
LangString Message ${LANG_SLOVAK} "Slovak message"
|
||||
|
||||
;--------------------------------
|
||||
|
||||
;Section names set by Language strings
|
||||
;It works with ! too
|
||||
Section !$(Sec1Name) sec1
|
||||
|
@ -94,7 +105,12 @@ Section "Section number two"
|
|||
MessageBox MB_OK "Installing Slovak stuff"
|
||||
SectionEnd
|
||||
|
||||
;--------------------------------
|
||||
|
||||
Function .onInit
|
||||
|
||||
;Language selection dialog
|
||||
|
||||
Push ""
|
||||
Push ${LANG_ENGLISH}
|
||||
Push English
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
; primes.nsi
|
||||
;
|
||||
; This is an example of the possibities of the NSIS Script language.
|
||||
; It calculates prime numbers.
|
||||
|
||||
;--------------------------------
|
||||
|
||||
Name "primes"
|
||||
AllowRootDirInstall true
|
||||
OutFile "primes.exe"
|
||||
|
@ -7,13 +14,19 @@ AllowRootDirInstall true
|
|||
InstallDir "$EXEDIR"
|
||||
DirText "Select directory to write primes.txt"
|
||||
|
||||
Section "crap"
|
||||
;--------------------------------
|
||||
|
||||
Section ""
|
||||
SetOutPath $INSTDIR
|
||||
Call DoPrimes
|
||||
SectionEnd
|
||||
|
||||
;--------------------------------
|
||||
|
||||
Function DoPrimes
|
||||
|
||||
; we put this in here so it doesn't update the progress bar (faster)
|
||||
|
||||
!define PPOS $0 ; position in prime searching
|
||||
!define PDIV $1 ; divisor
|
||||
!define PMOD $2 ; the result of the modulus
|
||||
|
@ -44,5 +57,5 @@ outerloop:
|
|||
Goto outerloop
|
||||
stop:
|
||||
FileClose $9
|
||||
FunctionEnd
|
||||
|
||||
|
||||
FunctionEnd
|
|
@ -3,7 +3,8 @@
|
|||
; This script creates a silent installer which extracts one (or more) HTML
|
||||
; files to a temporary directory, opens Internet Explorer to view the file(s),
|
||||
; and when Internet Explorer has quit, deletes the file(s).
|
||||
;
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; The name of the installer (not really used in a silent install)
|
||||
Name "ViewHTML"
|
||||
|
@ -14,26 +15,21 @@ SilentInstall silent
|
|||
; The file to write
|
||||
OutFile "viewhtml.exe"
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; The stuff to install
|
||||
Section ""
|
||||
; Set output path to the installation directory.
|
||||
|
||||
; Get a temporary filename (in the Windows Temp directory)
|
||||
GetTempFileName $R0
|
||||
|
||||
; Extract file
|
||||
File /oname=$R0 "..\Docs\Chapter1.html"
|
||||
|
||||
; View file
|
||||
ExecWait '"$PROGRAMFILES\Internet Explorer\iexplore.exe" "$R0"'
|
||||
; Delete the files
|
||||
Delete $R0
|
||||
SectionEnd
|
||||
; ExecShell "open" '"$R0"'
|
||||
|
||||
; Delete the files (on reboot if file is in use)
|
||||
Delete /REBOOTOK $R0
|
||||
|
||||
; Note: another way of doing this would be to use ExecShell, but then you
|
||||
; really couldn't get away with deleting the files. Here is the ExecShell
|
||||
; line that you would want to use:
|
||||
;
|
||||
; ExecShell "open" '"$R0"'
|
||||
;
|
||||
; The advantage of this way is that it would use the default browser to
|
||||
; open the HTML.
|
||||
;
|
||||
|
||||
; eof
|
||||
SectionEnd
|
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue