merged from work
This commit is contained in:
35
KattekerCreator/nsis/Examples/AdvSplash/Example.nsi
Normal file
35
KattekerCreator/nsis/Examples/AdvSplash/Example.nsi
Normal file
@ -0,0 +1,35 @@
|
||||
Name "AdvSplash.dll test"
|
||||
|
||||
OutFile "AdvSplash Test.exe"
|
||||
|
||||
XPStyle on
|
||||
|
||||
Function .onInit
|
||||
# the plugins dir is automatically deleted when the installer exits
|
||||
InitPluginsDir
|
||||
File /oname=$PLUGINSDIR\splash.bmp "${NSISDIR}\Contrib\Graphics\Header\nsis.bmp"
|
||||
#optional
|
||||
#File /oname=$PLUGINSDIR\splash.wav "C:\myprog\sound.wav"
|
||||
|
||||
MessageBox MB_OK "Fading"
|
||||
|
||||
advsplash::show 1000 600 400 -1 $PLUGINSDIR\splash
|
||||
|
||||
Pop $0 ; $0 has '1' if the user closed the splash screen early,
|
||||
; '0' if everything closed normally, and '-1' if some error occurred.
|
||||
|
||||
MessageBox MB_OK "Transparency"
|
||||
File /oname=$PLUGINSDIR\splash.bmp "${NSISDIR}\Contrib\Graphics\Wizard\orange-uninstall.bmp"
|
||||
advsplash::show 2000 0 0 0x1856B1 $PLUGINSDIR\splash
|
||||
Pop $0
|
||||
|
||||
MessageBox MB_OK "Transparency/Fading"
|
||||
File /oname=$PLUGINSDIR\splash.bmp "${NSISDIR}\Contrib\Graphics\Wizard\llama.bmp"
|
||||
advsplash::show 1000 600 400 0x04025C $PLUGINSDIR\splash
|
||||
Pop $0
|
||||
|
||||
Delete $PLUGINSDIR\splash.bmp
|
||||
FunctionEnd
|
||||
|
||||
Section
|
||||
SectionEnd
|
38
KattekerCreator/nsis/Examples/Banner/Example.nsi
Normal file
38
KattekerCreator/nsis/Examples/Banner/Example.nsi
Normal file
@ -0,0 +1,38 @@
|
||||
# Look at Readme.txt for usage alongside with the Modern UI
|
||||
|
||||
!include "WinMessages.nsh"
|
||||
|
||||
Name "Banner.dll test"
|
||||
|
||||
OutFile "Banner Test.exe"
|
||||
|
||||
ShowInstDetails show
|
||||
|
||||
Function .onInit
|
||||
Banner::show "Calculating important stuff..."
|
||||
|
||||
Banner::getWindow
|
||||
Pop $1
|
||||
|
||||
again:
|
||||
IntOp $0 $0 + 1
|
||||
Sleep 1
|
||||
StrCmp $0 100 0 again
|
||||
|
||||
GetDlgItem $2 $1 1030
|
||||
SendMessage $2 ${WM_SETTEXT} 0 "STR:Calculating more important stuff..."
|
||||
|
||||
again2:
|
||||
IntOp $0 $0 + 1
|
||||
Sleep 1
|
||||
StrCmp $0 200 0 again2
|
||||
|
||||
Banner::destroy
|
||||
FunctionEnd
|
||||
|
||||
Section
|
||||
DetailPrint "Using previous calculations to quickly calculate 1*2000..."
|
||||
Sleep 1000
|
||||
DetailPrint "Eureka! It's $0!!!"
|
||||
DetailPrint ""
|
||||
SectionEnd
|
101
KattekerCreator/nsis/Examples/BgImage/Example.nsi
Normal file
101
KattekerCreator/nsis/Examples/BgImage/Example.nsi
Normal file
@ -0,0 +1,101 @@
|
||||
Name "BgImage.dll test"
|
||||
|
||||
OutFile "BgImage Test.exe"
|
||||
|
||||
XPStyle on
|
||||
RequestExecutionLevel user
|
||||
|
||||
!define DEBUG
|
||||
!macro GetReturnValue
|
||||
!ifdef DEBUG
|
||||
Pop $R9
|
||||
StrCmp $R9 success +2
|
||||
DetailPrint "Error: $R9"
|
||||
!endif
|
||||
!macroend
|
||||
|
||||
Function .onGUIInit
|
||||
# the plugins dir is automatically deleted when the installer exits
|
||||
InitPluginsDir
|
||||
# lets extract some bitmaps...
|
||||
File /oname=$PLUGINSDIR\1.bmp "${NSISDIR}\Contrib\Graphics\Wizard\llama.bmp"
|
||||
File /oname=$PLUGINSDIR\2.bmp "${NSISDIR}\Contrib\Graphics\Checks\modern.bmp"
|
||||
|
||||
!ifdef DEBUG
|
||||
# turn return values on if in debug mode
|
||||
BgImage::SetReturn on
|
||||
!endif
|
||||
|
||||
# set the initial background for images to be drawn on
|
||||
# we will use a gradient from drak green to dark red
|
||||
BgImage::SetBg /GRADIENT 0 0x80 0 0x80 0 0
|
||||
!insertmacro GetReturnValue
|
||||
# add an image @ (150,0)
|
||||
BgImage::AddImage $PLUGINSDIR\2.bmp 150 0
|
||||
!insertmacro GetReturnValue
|
||||
# add the same image only transparent (magenta wiped) @ (150,16)
|
||||
BgImage::AddImage /TRANSPARENT 255 0 255 $PLUGINSDIR\2.bmp 150 16
|
||||
!insertmacro GetReturnValue
|
||||
# create the font for the following text
|
||||
CreateFont $R0 "Comic Sans MS" 50 700
|
||||
# add a blue shadow for the text
|
||||
BgImage::AddText "Testing 1... 2... 3..." $R0 0 0 255 48 48 798 198
|
||||
!insertmacro GetReturnValue
|
||||
# add a green shadow for the text
|
||||
BgImage::AddText "Testing 1... 2... 3..." $R0 0 255 0 52 52 802 202
|
||||
!insertmacro GetReturnValue
|
||||
# add the text
|
||||
BgImage::AddText "Testing 1... 2... 3..." $R0 255 0 0 50 50 800 200
|
||||
!insertmacro GetReturnValue
|
||||
# show our creation to the world!
|
||||
BgImage::Redraw
|
||||
# Refresh doesn't return any value
|
||||
|
||||
FunctionEnd
|
||||
|
||||
ShowInstDetails show
|
||||
|
||||
Section
|
||||
# play some sounds
|
||||
FindFirst $0 $1 $WINDIR\Media\*.wav
|
||||
StrCmp $0 "" skipSound
|
||||
moreSounds:
|
||||
StrCmp $1 "" noMoreSounds
|
||||
BgImage::Sound /WAIT $WINDIR\Media\$1
|
||||
# Sound doesn't return any value either
|
||||
MessageBox MB_YESNO "Another sound?" IDNO noMoreSounds
|
||||
FindNext $0 $1
|
||||
Goto moreSounds
|
||||
|
||||
noMoreSounds:
|
||||
FindClose $0
|
||||
skipSound:
|
||||
|
||||
# change the background image to Mike, tiled
|
||||
BgImage::SetBg /TILED $PLUGINSDIR\1.bmp
|
||||
!insertmacro GetReturnValue
|
||||
# we have to redraw to reflect the changes
|
||||
BgImage::Redraw
|
||||
|
||||
MessageBox MB_OK "Mike the llama"
|
||||
|
||||
# clear everything
|
||||
BgImage::Clear
|
||||
# Clear doesn't return any value
|
||||
# set another gradient
|
||||
BgImage::SetBg /GRADIENT 0xFF 0xFA 0xBA 0xAA 0xA5 0x65
|
||||
!insertmacro GetReturnValue
|
||||
# add some text
|
||||
BgImage::AddText "A Desert for Mike" $R0 0 0 0 50 50 800 150
|
||||
!insertmacro GetReturnValue
|
||||
# add mike as an image
|
||||
BgImage::AddImage $PLUGINSDIR\1.bmp 50 150
|
||||
!insertmacro GetReturnValue
|
||||
# again, we have to call redraw to reflect changes
|
||||
BgImage::Redraw
|
||||
SectionEnd
|
||||
|
||||
Function .onGUIEnd
|
||||
BgImage::Destroy
|
||||
# Destroy doesn't return any value
|
||||
FunctionEnd
|
91
KattekerCreator/nsis/Examples/FileFunc.ini
Normal file
91
KattekerCreator/nsis/Examples/FileFunc.ini
Normal file
@ -0,0 +1,91 @@
|
||||
[Settings]
|
||||
NumFields=11
|
||||
NextButtonText=&Enter
|
||||
|
||||
[Field 1]
|
||||
Type=Droplist
|
||||
Flags=NOTIFY
|
||||
State=" 1. Locate"
|
||||
ListItems=| 1. Locate| 2. GetSize (file)| (directory)| (no size, no subdir)| 3. DriveSpace| 4. GetDrives (by type)| (all by letter)| 5. GetTime (local time)| (file time)| 6. GetFileAttributes| 7. GetFileVersion| 8. GetExeName| 9. GetExePath|10. GetParameters|11. GetOptions|12. GetRoot|13. GetParent|14. GetFileName|15. GetBaseName|16. GetFileExt|17. BannerTrimPath|18. DirState|19. RefreshShellIcons
|
||||
Left=44
|
||||
Right=190
|
||||
Top=1
|
||||
Bottom=210
|
||||
|
||||
[Field 2]
|
||||
Type=FileRequest
|
||||
Left=44
|
||||
Right=-10
|
||||
Top=22
|
||||
Bottom=33
|
||||
|
||||
[Field 3]
|
||||
Type=DirRequest
|
||||
Left=44
|
||||
Right=-10
|
||||
Top=22
|
||||
Bottom=33
|
||||
|
||||
[Field 4]
|
||||
Type=Text
|
||||
Left=44
|
||||
Right=-10
|
||||
Top=36
|
||||
Bottom=49
|
||||
|
||||
[Field 5]
|
||||
Type=Text
|
||||
State=LocateCallback
|
||||
Left=44
|
||||
Right=232
|
||||
Top=53
|
||||
Bottom=66
|
||||
|
||||
[Field 6]
|
||||
Type=Button
|
||||
Text=view
|
||||
Flags=NOTIFY
|
||||
Left=236
|
||||
Right=255
|
||||
Top=54
|
||||
Bottom=65
|
||||
|
||||
[Field 7]
|
||||
Type=Text
|
||||
Flags=MULTILINE|VSCROLL|HSCROLL|READONLY
|
||||
Left=44
|
||||
Right=-10
|
||||
Top=73
|
||||
Bottom=128
|
||||
|
||||
[Field 8]
|
||||
Type=Label
|
||||
Text=Path
|
||||
Left=10
|
||||
Right=43
|
||||
Top=24
|
||||
Bottom=36
|
||||
|
||||
[Field 9]
|
||||
Type=Label
|
||||
Text=Options
|
||||
Left=10
|
||||
Right=43
|
||||
Top=40
|
||||
Bottom=52
|
||||
|
||||
[Field 10]
|
||||
Type=Label
|
||||
Text=Function
|
||||
Left=10
|
||||
Right=44
|
||||
Top=56
|
||||
Bottom=67
|
||||
|
||||
[Field 11]
|
||||
Type=Label
|
||||
Text=Result:
|
||||
Left=12
|
||||
Right=42
|
||||
Top=94
|
||||
Bottom=102
|
732
KattekerCreator/nsis/Examples/FileFunc.nsi
Normal file
732
KattekerCreator/nsis/Examples/FileFunc.nsi
Normal file
@ -0,0 +1,732 @@
|
||||
;_____________________________________________________________________________
|
||||
;
|
||||
; File Functions
|
||||
;_____________________________________________________________________________
|
||||
;
|
||||
; 2006 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)
|
||||
|
||||
Name "File Functions"
|
||||
OutFile "FileFunc.exe"
|
||||
Caption "$(^Name)"
|
||||
XPStyle on
|
||||
RequestExecutionLevel user
|
||||
|
||||
!include "WinMessages.nsh"
|
||||
!include "FileFunc.nsh"
|
||||
|
||||
Var INI
|
||||
Var HWND
|
||||
Var STATE
|
||||
Var FUNCTION
|
||||
Var LOCATE1
|
||||
Var LOCATE2
|
||||
Var GETSIZE1
|
||||
Var GETSIZE2
|
||||
Var GETSIZE3
|
||||
Var GETSIZE4
|
||||
Var GETSIZE5
|
||||
Var GETSIZE6
|
||||
Var DRIVESPACE1
|
||||
Var DRIVESPACE2
|
||||
Var GETDRIVES1
|
||||
Var GETTIME1
|
||||
Var GETTIME2
|
||||
Var GETFILEATTRIBUTES1
|
||||
Var GETFILEATTRIBUTES2
|
||||
Var GETFILEVERSION1
|
||||
Var GETOPTIONS1
|
||||
Var GETOPTIONS2
|
||||
Var GETROOT1
|
||||
Var GETPARENT1
|
||||
Var GETFILENAME1
|
||||
Var GETBASENAME1
|
||||
Var GETFILEEXT1
|
||||
Var BANNERTRIMPATH1
|
||||
Var BANNERTRIMPATH2
|
||||
Var DIRSTATE1
|
||||
|
||||
Page Custom ShowCustom LeaveCustom
|
||||
|
||||
Function ShowCustom
|
||||
InstallOptions::initDialog "$INI"
|
||||
Pop $hwnd
|
||||
GetDlgItem $1 $HWND 1201
|
||||
ShowWindow $1 0
|
||||
GetDlgItem $1 $HWND 1202
|
||||
ShowWindow $1 0
|
||||
GetDlgItem $1 $HWND 1206
|
||||
EnableWindow $1 0
|
||||
SendMessage $1 ${WM_ENABLE} 1 0
|
||||
StrCpy $LOCATE1 $DOCUMENTS
|
||||
StrCpy $LOCATE2 '/L=FD /M=*.* /S=0B /G=1 /B=0'
|
||||
StrCpy $GETSIZE1 '$WINDIR'
|
||||
StrCpy $GETSIZE2 '/M=Explorer.exe /S=0K /G=0'
|
||||
StrCpy $GETSIZE3 '$PROGRAMFILES\Common Files'
|
||||
StrCpy $GETSIZE4 '/S=0M'
|
||||
StrCpy $GETSIZE5 '$WINDIR'
|
||||
StrCpy $GETSIZE6 '/G=0'
|
||||
StrCpy $DRIVESPACE1 'C:\'
|
||||
StrCpy $DRIVESPACE2 '/D=F /S=M'
|
||||
StrCpy $GETDRIVES1 'FDD+CDROM'
|
||||
StrCpy $GETTIME1 '$WINDIR\Explorer.exe'
|
||||
StrCpy $GETTIME2 'C'
|
||||
StrCpy $GETFILEATTRIBUTES1 'C:\IO.SYS'
|
||||
StrCpy $GETFILEATTRIBUTES2 'ALL'
|
||||
StrCpy $GETFILEVERSION1 '$WINDIR\Explorer.exe'
|
||||
StrCpy $GETOPTIONS1 '/SILENT=yes /INSTDIR="$PROGRAMFILES\Common Files"'
|
||||
StrCpy $GETOPTIONS2 '/INSTDIR='
|
||||
StrCpy $GETROOT1 'C:\path\file.dll'
|
||||
StrCpy $GETPARENT1 'C:\path\file.dll'
|
||||
StrCpy $GETFILENAME1 'C:\path\file.dll'
|
||||
StrCpy $GETBASENAME1 'C:\path\file.dll'
|
||||
StrCpy $GETFILEEXT1 'C:\path\file.dll'
|
||||
StrCpy $BANNERTRIMPATH1 'C:\Server\Documents\Terminal\license.htm'
|
||||
StrCpy $BANNERTRIMPATH2 '34A'
|
||||
StrCpy $DIRSTATE1 '$TEMP'
|
||||
|
||||
GetDlgItem $1 $HWND 1203
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:$LOCATE1"
|
||||
GetDlgItem $1 $HWND 1205
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:$LOCATE2"
|
||||
InstallOptions::show
|
||||
Pop $0
|
||||
FunctionEnd
|
||||
|
||||
Function LeaveCustom
|
||||
ReadINIStr $STATE $INI "Field 1" "State"
|
||||
ReadINIStr $R1 $INI "Field 2" "State"
|
||||
ReadINIStr $R2 $INI "Field 3" "State"
|
||||
ReadINIStr $R3 $INI "Field 4" "State"
|
||||
ReadINIStr $R4 $INI "Field 5" "State"
|
||||
ReadINIStr $0 $INI "Settings" "State"
|
||||
StrCmp $0 6 view
|
||||
StrCmp $0 0 Enter
|
||||
goto main
|
||||
|
||||
view:
|
||||
StrCpy $0 '$$'
|
||||
StrCpy $1 'n'
|
||||
StrCpy $2 'r'
|
||||
StrCmp $R4 "LocateCallback" 0 +3
|
||||
StrCpy $R0 `Function LocateCallback$\r$\n MessageBox MB_OKCANCEL '$0$$R9 "path\name"=[$$R9]$0\$1$0$$R8 "path" =[$$R8]$0\$1$0$$R7 "name" =[$$R7]$0\$1$0$$R6 "size" =[$$R6]' IDOK +2$\r$\n StrCpy $$R0 StopLocate$\r$\n$\r$\n Push $$R0$\r$\nFunctionEnd`
|
||||
goto send
|
||||
StrCmp $R4 "GetDrivesCallback" 0 error
|
||||
StrCpy $R0 `Function GetDrivesCallback$\r$\n MessageBox MB_OKCANCEL '$0$$9 "drive letter"=[$$9]$0\$1$0$$8 "drive type" =[$$8]' IDOK +2$\r$\n StrCpy $$R0 StopGetDrives$\r$\n StrCpy $$R5 '$$R5$$9 [$$8 Drive]$$\$2$$\$1'$\r$\n$\r$\n Push $$R0$\r$\nFunctionEnd`
|
||||
goto send
|
||||
|
||||
main:
|
||||
StrCmp $FUNCTION '' DefaultSend
|
||||
StrCmp $FUNCTION Locate 0 +4
|
||||
StrCpy $LOCATE1 $R2
|
||||
StrCpy $LOCATE2 $R3
|
||||
goto DefaultSend
|
||||
StrCmp $FUNCTION GetSize1 0 +4
|
||||
StrCpy $GETSIZE1 $R2
|
||||
StrCpy $GETSIZE2 $R3
|
||||
goto DefaultSend
|
||||
StrCmp $FUNCTION GetSize2 0 +4
|
||||
StrCpy $GETSIZE3 $R2
|
||||
StrCpy $GETSIZE4 $R3
|
||||
goto DefaultSend
|
||||
StrCmp $FUNCTION GetSize3 0 +4
|
||||
StrCpy $GETSIZE5 $R2
|
||||
StrCpy $GETSIZE6 $R3
|
||||
goto DefaultSend
|
||||
StrCmp $FUNCTION DriveSpace 0 +4
|
||||
StrCpy $DRIVESPACE1 $R1
|
||||
StrCpy $DRIVESPACE2 $R3
|
||||
goto DefaultSend
|
||||
StrCmp $FUNCTION GetDrives 0 +3
|
||||
StrCpy $GETDRIVES1 $R1
|
||||
goto DefaultSend
|
||||
StrCmp $FUNCTION GetTime 0 +4
|
||||
StrCpy $GETTIME1 $R1
|
||||
StrCpy $GETTIME2 $R3
|
||||
goto DefaultSend
|
||||
StrCmp $FUNCTION GetFileAttributes 0 +4
|
||||
StrCpy $GETFILEATTRIBUTES1 $R1
|
||||
StrCpy $GETFILEATTRIBUTES2 $R3
|
||||
goto DefaultSend
|
||||
StrCmp $FUNCTION GetFileVersion 0 +3
|
||||
StrCpy $GETFILEVERSION1 $R1
|
||||
goto DefaultSend
|
||||
StrCmp $FUNCTION GetOptions 0 +4
|
||||
StrCpy $GETOPTIONS1 $R1
|
||||
StrCpy $GETOPTIONS2 $R3
|
||||
goto DefaultSend
|
||||
StrCmp $FUNCTION GetRoot 0 +3
|
||||
StrCpy $GETROOT1 $R1
|
||||
goto DefaultSend
|
||||
StrCmp $FUNCTION GetParent 0 +3
|
||||
StrCpy $GETPARENT1 $R1
|
||||
goto DefaultSend
|
||||
StrCmp $FUNCTION GetFileName 0 +3
|
||||
StrCpy $GETFILENAME1 $R1
|
||||
goto DefaultSend
|
||||
StrCmp $FUNCTION GetBaseName 0 +3
|
||||
StrCpy $GETBASENAME1 $R1
|
||||
goto DefaultSend
|
||||
StrCmp $FUNCTION GetFileExt 0 +3
|
||||
StrCpy $GETFILEEXT1 $R1
|
||||
goto DefaultSend
|
||||
StrCmp $FUNCTION BannerTrimPath 0 +4
|
||||
StrCpy $BANNERTRIMPATH1 $R1
|
||||
StrCpy $BANNERTRIMPATH2 $R3
|
||||
goto DefaultSend
|
||||
StrCmp $FUNCTION DirState 0 +2
|
||||
StrCpy $DIRSTATE1 $R2
|
||||
|
||||
DefaultSend:
|
||||
GetDlgItem $1 $HWND 1201
|
||||
EnableWindow $1 1
|
||||
ShowWindow $1 0
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:"
|
||||
GetDlgItem $1 $HWND 1202
|
||||
EnableWindow $1 1
|
||||
ShowWindow $1 0
|
||||
GetDlgItem $1 $HWND 1203
|
||||
EnableWindow $1 1
|
||||
ShowWindow $1 0
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:"
|
||||
GetDlgItem $1 $HWND 1204
|
||||
EnableWindow $1 1
|
||||
ShowWindow $1 0
|
||||
GetDlgItem $1 $HWND 1205
|
||||
EnableWindow $1 1
|
||||
GetDlgItem $1 $HWND 1206
|
||||
ShowWindow $1 0
|
||||
EnableWindow $1 0
|
||||
GetDlgItem $1 $HWND 1207
|
||||
ShowWindow $1 0
|
||||
GetDlgItem $1 $HWND 1208
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:"
|
||||
GetDlgItem $1 $HWND 1209
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:"
|
||||
GetDlgItem $1 $HWND 1210
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:"
|
||||
GetDlgItem $1 $HWND 1211
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:"
|
||||
|
||||
ReadINIStr $0 $INI "Field 1" "State"
|
||||
StrCmp $0 " 1. Locate" 0 GetSize1Send
|
||||
StrCpy $FUNCTION Locate
|
||||
GetDlgItem $1 $HWND 1203
|
||||
ShowWindow $1 1
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:$LOCATE1"
|
||||
GetDlgItem $1 $HWND 1204
|
||||
ShowWindow $1 1
|
||||
GetDlgItem $1 $HWND 1205
|
||||
ShowWindow $1 1
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:$LOCATE2"
|
||||
GetDlgItem $1 $HWND 1206
|
||||
ShowWindow $1 1
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:LocateCallback"
|
||||
GetDlgItem $1 $HWND 1207
|
||||
ShowWindow $1 1
|
||||
GetDlgItem $1 $HWND 1209
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Path"
|
||||
GetDlgItem $1 $HWND 1210
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Options"
|
||||
GetDlgItem $1 $HWND 1211
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Function"
|
||||
abort
|
||||
|
||||
GetSize1Send:
|
||||
StrCmp $0 " 2. GetSize (file)" 0 GetSize2Send
|
||||
StrCpy $FUNCTION 'GetSize1'
|
||||
GetDlgItem $1 $HWND 1203
|
||||
ShowWindow $1 1
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETSIZE1"
|
||||
GetDlgItem $1 $HWND 1204
|
||||
ShowWindow $1 1
|
||||
GetDlgItem $1 $HWND 1205
|
||||
ShowWindow $1 1
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETSIZE2"
|
||||
GetDlgItem $1 $HWND 1209
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:File"
|
||||
GetDlgItem $1 $HWND 1210
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Options"
|
||||
Abort
|
||||
|
||||
GetSize2Send:
|
||||
StrCmp $0 " (directory)" 0 GetSize3Send
|
||||
StrCpy $FUNCTION 'GetSize2'
|
||||
GetDlgItem $1 $HWND 1203
|
||||
ShowWindow $1 1
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETSIZE3"
|
||||
GetDlgItem $1 $HWND 1204
|
||||
ShowWindow $1 1
|
||||
GetDlgItem $1 $HWND 1205
|
||||
ShowWindow $1 1
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETSIZE4"
|
||||
GetDlgItem $1 $HWND 1209
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Directory"
|
||||
GetDlgItem $1 $HWND 1210
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Options"
|
||||
Abort
|
||||
|
||||
GetSize3Send:
|
||||
StrCmp $0 " (no size, no subdir)" 0 DriveSpaceSend
|
||||
StrCpy $FUNCTION 'GetSize3'
|
||||
GetDlgItem $1 $HWND 1203
|
||||
ShowWindow $1 1
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETSIZE5"
|
||||
GetDlgItem $1 $HWND 1204
|
||||
ShowWindow $1 1
|
||||
GetDlgItem $1 $HWND 1205
|
||||
ShowWindow $1 1
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETSIZE6"
|
||||
GetDlgItem $1 $HWND 1209
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Directory"
|
||||
GetDlgItem $1 $HWND 1210
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Options"
|
||||
Abort
|
||||
|
||||
DriveSpaceSend:
|
||||
StrCmp $0 " 3. DriveSpace" 0 GetDrivesSend
|
||||
StrCpy $FUNCTION DriveSpace
|
||||
GetDlgItem $1 $HWND 1201
|
||||
ShowWindow $1 1
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:$DRIVESPACE1"
|
||||
GetDlgItem $1 $HWND 1202
|
||||
ShowWindow $1 1
|
||||
EnableWindow $1 0
|
||||
GetDlgItem $1 $HWND 1205
|
||||
ShowWindow $1 1
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:$DRIVESPACE2"
|
||||
GetDlgItem $1 $HWND 1206
|
||||
ShowWindow $1 0
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:"
|
||||
GetDlgItem $1 $HWND 1207
|
||||
ShowWindow $1 0
|
||||
GetDlgItem $1 $HWND 1209
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Drive"
|
||||
GetDlgItem $1 $HWND 1210
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Options"
|
||||
abort
|
||||
|
||||
GetDrivesSend:
|
||||
StrCmp $0 " 4. GetDrives (by type)" 0 GetDrives2Send
|
||||
StrCpy $FUNCTION GetDrives
|
||||
GetDlgItem $1 $HWND 1201
|
||||
ShowWindow $1 1
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETDRIVES1"
|
||||
GetDlgItem $1 $HWND 1202
|
||||
ShowWindow $1 1
|
||||
EnableWindow $1 0
|
||||
GetDlgItem $1 $HWND 1205
|
||||
ShowWindow $1 0
|
||||
GetDlgItem $1 $HWND 1206
|
||||
ShowWindow $1 1
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:GetDrivesCallback"
|
||||
GetDlgItem $1 $HWND 1207
|
||||
ShowWindow $1 1
|
||||
GetDlgItem $1 $HWND 1209
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Option"
|
||||
GetDlgItem $1 $HWND 1211
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Function"
|
||||
abort
|
||||
|
||||
GetDrives2Send:
|
||||
StrCmp $0 " (all by letter)" 0 GetTime1Send
|
||||
StrCpy $FUNCTION ''
|
||||
GetDlgItem $1 $HWND 1201
|
||||
ShowWindow $1 1
|
||||
EnableWindow $1 0
|
||||
SendMessage $1 ${WM_ENABLE} 1 0
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:ALL"
|
||||
GetDlgItem $1 $HWND 1202
|
||||
ShowWindow $1 1
|
||||
EnableWindow $1 0
|
||||
GetDlgItem $1 $HWND 1205
|
||||
ShowWindow $1 0
|
||||
GetDlgItem $1 $HWND 1206
|
||||
ShowWindow $1 1
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:GetDrivesCallback"
|
||||
GetDlgItem $1 $HWND 1207
|
||||
ShowWindow $1 1
|
||||
GetDlgItem $1 $HWND 1209
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Option"
|
||||
GetDlgItem $1 $HWND 1211
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Function"
|
||||
abort
|
||||
|
||||
GetTime1Send:
|
||||
StrCmp $0 " 5. GetTime (local time)" 0 GetTime2Send
|
||||
StrCpy $FUNCTION ''
|
||||
GetDlgItem $1 $HWND 1201
|
||||
ShowWindow $1 1
|
||||
EnableWindow $1 0
|
||||
SendMessage $1 ${WM_ENABLE} 1 0
|
||||
GetDlgItem $1 $HWND 1202
|
||||
ShowWindow $1 1
|
||||
EnableWindow $1 0
|
||||
GetDlgItem $1 $HWND 1205
|
||||
ShowWindow $1 1
|
||||
EnableWindow $1 1
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:L"
|
||||
GetDlgItem $1 $HWND 1210
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Option"
|
||||
Abort
|
||||
|
||||
GetTime2Send:
|
||||
StrCmp $0 " (file time)" 0 GetFileAttributesSend
|
||||
StrCpy $FUNCTION GetTime
|
||||
GetDlgItem $1 $HWND 1201
|
||||
ShowWindow $1 1
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETTIME1"
|
||||
GetDlgItem $1 $HWND 1202
|
||||
ShowWindow $1 1
|
||||
GetDlgItem $1 $HWND 1205
|
||||
ShowWindow $1 1
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETTIME2"
|
||||
GetDlgItem $1 $HWND 1209
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:File"
|
||||
GetDlgItem $1 $HWND 1210
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Option"
|
||||
Abort
|
||||
|
||||
GetFileAttributesSend:
|
||||
StrCmp $0 " 6. GetFileAttributes" 0 GetFileVersionSend
|
||||
StrCpy $FUNCTION GetFileAttributes
|
||||
GetDlgItem $1 $HWND 1201
|
||||
ShowWindow $1 1
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETFILEATTRIBUTES1"
|
||||
GetDlgItem $1 $HWND 1202
|
||||
ShowWindow $1 1
|
||||
GetDlgItem $1 $HWND 1205
|
||||
ShowWindow $1 1
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETFILEATTRIBUTES2"
|
||||
GetDlgItem $1 $HWND 1209
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Path"
|
||||
GetDlgItem $1 $HWND 1210
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Attrib"
|
||||
Abort
|
||||
|
||||
GetFileVersionSend:
|
||||
StrCmp $0 " 7. GetFileVersion" 0 GetCmdSend
|
||||
StrCpy $FUNCTION GetFileVersion
|
||||
GetDlgItem $1 $HWND 1201
|
||||
ShowWindow $1 1
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETFILEVERSION1"
|
||||
GetDlgItem $1 $HWND 1202
|
||||
ShowWindow $1 1
|
||||
GetDlgItem $1 $HWND 1205
|
||||
ShowWindow $1 0
|
||||
GetDlgItem $1 $HWND 1209
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:File"
|
||||
Abort
|
||||
|
||||
GetCmdSend:
|
||||
StrCmp $0 " 8. GetExeName" +3
|
||||
StrCmp $0 " 9. GetExePath" +2
|
||||
StrCmp $0 "10. GetParameters" 0 GetOptionsSend
|
||||
StrCpy $FUNCTION ''
|
||||
GetDlgItem $1 $HWND 1205
|
||||
ShowWindow $1 0
|
||||
Abort
|
||||
|
||||
GetOptionsSend:
|
||||
StrCmp $0 "11. GetOptions" 0 GetRootSend
|
||||
StrCpy $FUNCTION GetOptions
|
||||
GetDlgItem $1 $HWND 1201
|
||||
ShowWindow $1 1
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETOPTIONS1"
|
||||
GetDlgItem $1 $HWND 1202
|
||||
ShowWindow $1 1
|
||||
EnableWindow $1 0
|
||||
GetDlgItem $1 $HWND 1205
|
||||
ShowWindow $1 1
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETOPTIONS2"
|
||||
GetDlgItem $1 $HWND 1209
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Parameters"
|
||||
GetDlgItem $1 $HWND 1210
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Option"
|
||||
Abort
|
||||
|
||||
GetRootSend:
|
||||
StrCmp $0 "12. GetRoot" 0 GetParentSend
|
||||
StrCpy $FUNCTION GetRoot
|
||||
GetDlgItem $1 $HWND 1201
|
||||
ShowWindow $1 1
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETROOT1"
|
||||
GetDlgItem $1 $HWND 1202
|
||||
ShowWindow $1 1
|
||||
GetDlgItem $1 $HWND 1205
|
||||
ShowWindow $1 0
|
||||
GetDlgItem $1 $HWND 1209
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:FullPath"
|
||||
Abort
|
||||
|
||||
GetParentSend:
|
||||
StrCmp $0 "13. GetParent" 0 GetFileNameSend
|
||||
StrCpy $FUNCTION GetParent
|
||||
GetDlgItem $1 $HWND 1201
|
||||
ShowWindow $1 1
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETPARENT1"
|
||||
GetDlgItem $1 $HWND 1202
|
||||
ShowWindow $1 1
|
||||
GetDlgItem $1 $HWND 1205
|
||||
ShowWindow $1 0
|
||||
GetDlgItem $1 $HWND 1209
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:PathString"
|
||||
Abort
|
||||
|
||||
GetFileNameSend:
|
||||
StrCmp $0 "14. GetFileName" 0 GetBaseNameSend
|
||||
StrCpy $FUNCTION GetFileName
|
||||
GetDlgItem $1 $HWND 1201
|
||||
ShowWindow $1 1
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETFILENAME1"
|
||||
GetDlgItem $1 $HWND 1202
|
||||
ShowWindow $1 1
|
||||
GetDlgItem $1 $HWND 1205
|
||||
ShowWindow $1 0
|
||||
GetDlgItem $1 $HWND 1209
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:PathString"
|
||||
Abort
|
||||
|
||||
GetBaseNameSend:
|
||||
StrCmp $0 "15. GetBaseName" 0 GetFileExtSend
|
||||
StrCpy $FUNCTION GetBaseName
|
||||
GetDlgItem $1 $HWND 1201
|
||||
ShowWindow $1 1
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETBASENAME1"
|
||||
GetDlgItem $1 $HWND 1202
|
||||
ShowWindow $1 1
|
||||
GetDlgItem $1 $HWND 1205
|
||||
ShowWindow $1 0
|
||||
GetDlgItem $1 $HWND 1209
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:FileString"
|
||||
Abort
|
||||
|
||||
GetFileExtSend:
|
||||
StrCmp $0 "16. GetFileExt" 0 BannerTrimPathSend
|
||||
StrCpy $FUNCTION GetFileExt
|
||||
GetDlgItem $1 $HWND 1201
|
||||
ShowWindow $1 1
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:$GETFILEEXT1"
|
||||
GetDlgItem $1 $HWND 1202
|
||||
ShowWindow $1 1
|
||||
GetDlgItem $1 $HWND 1205
|
||||
ShowWindow $1 0
|
||||
GetDlgItem $1 $HWND 1209
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:FileString"
|
||||
Abort
|
||||
|
||||
BannerTrimPathSend:
|
||||
StrCmp $0 "17. BannerTrimPath" 0 DirStateSend
|
||||
StrCpy $FUNCTION BannerTrimPath
|
||||
GetDlgItem $1 $HWND 1201
|
||||
ShowWindow $1 1
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:$BANNERTRIMPATH1"
|
||||
GetDlgItem $1 $HWND 1202
|
||||
ShowWindow $1 1
|
||||
EnableWindow $1 0
|
||||
GetDlgItem $1 $HWND 1205
|
||||
ShowWindow $1 1
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:$BANNERTRIMPATH2"
|
||||
GetDlgItem $1 $HWND 1209
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:PathString"
|
||||
GetDlgItem $1 $HWND 1210
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Option"
|
||||
Abort
|
||||
|
||||
DirStateSend:
|
||||
StrCmp $0 "18. DirState" 0 RefreshShellIconsSend
|
||||
StrCpy $FUNCTION DirState
|
||||
GetDlgItem $1 $HWND 1203
|
||||
ShowWindow $1 1
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:$DIRSTATE1"
|
||||
GetDlgItem $1 $HWND 1204
|
||||
ShowWindow $1 1
|
||||
GetDlgItem $1 $HWND 1205
|
||||
ShowWindow $1 0
|
||||
GetDlgItem $1 $HWND 1209
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Directory"
|
||||
Abort
|
||||
|
||||
RefreshShellIconsSend:
|
||||
StrCmp $0 "19. RefreshShellIcons" 0 Abort
|
||||
StrCpy $FUNCTION ''
|
||||
GetDlgItem $1 $HWND 1205
|
||||
ShowWindow $1 0
|
||||
|
||||
Abort:
|
||||
Abort
|
||||
|
||||
;=Enter=
|
||||
Enter:
|
||||
StrCpy $R0 ''
|
||||
StrCpy $R5 ''
|
||||
|
||||
StrCmp $STATE " 1. Locate" Locate
|
||||
StrCmp $STATE " 2. GetSize (file)" GetSize
|
||||
StrCmp $STATE " (directory)" GetSize
|
||||
StrCmp $STATE " (no size, no subdir)" GetSize
|
||||
StrCmp $STATE " 3. DriveSpace" DriveSpace
|
||||
StrCmp $STATE " 4. GetDrives (by type)" GetDrives
|
||||
StrCmp $STATE " (all by letter)" GetDrives
|
||||
StrCmp $STATE " 5. GetTime (local time)" GetTime
|
||||
StrCmp $STATE " (file time)" GetTime
|
||||
StrCmp $STATE " 6. GetFileAttributes" GetFileAttributes
|
||||
StrCmp $STATE " 7. GetFileVersion" GetFileVersion
|
||||
StrCmp $STATE " 8. GetExeName" GetExeName
|
||||
StrCmp $STATE " 9. GetExePath" GetExePath
|
||||
StrCmp $STATE "10. GetParameters" GetParameters
|
||||
StrCmp $STATE "11. GetOptions" GetOptions
|
||||
StrCmp $STATE "12. GetRoot" GetRoot
|
||||
StrCmp $STATE "13. GetParent" GetParent
|
||||
StrCmp $STATE "14. GetFileName" GetFileName
|
||||
StrCmp $STATE "15. GetBaseName" GetBaseName
|
||||
StrCmp $STATE "16. GetFileExt" GetFileExt
|
||||
StrCmp $STATE "17. BannerTrimPath" BannerTrimPath
|
||||
StrCmp $STATE "18. DirState" DirState
|
||||
StrCmp $STATE "19. RefreshShellIcons" RefreshShellIcons
|
||||
Abort
|
||||
|
||||
Locate:
|
||||
${Locate} "$R2" "$R3" "LocateCallback"
|
||||
IfErrors error
|
||||
StrCmp $R0 StopLocate 0 +3
|
||||
StrCpy $R0 'stopped'
|
||||
goto send
|
||||
StrCpy $R0 'done'
|
||||
goto send
|
||||
|
||||
GetSize:
|
||||
${GetSize} "$R2" "$R3" $0 $1 $2
|
||||
IfErrors error
|
||||
StrCpy $R0 "Size=$0$\r$\nFiles=$1$\r$\nFolders=$2"
|
||||
goto send
|
||||
|
||||
DriveSpace:
|
||||
${DriveSpace} "$R1" "$R3" $0
|
||||
IfErrors error
|
||||
StrCpy $R0 "$0"
|
||||
goto send
|
||||
|
||||
GetDrives:
|
||||
${GetDrives} "$R1" "GetDrivesCallback"
|
||||
StrCmp $R0 StopGetDrives 0 +3
|
||||
StrCpy $R0 '$R5stopped'
|
||||
goto send
|
||||
StrCpy $R0 '$R5done'
|
||||
goto send
|
||||
|
||||
GetTime:
|
||||
${GetTime} "$R1" "$R3" $0 $1 $2 $3 $4 $5 $6
|
||||
IfErrors error
|
||||
StrCpy $R0 'Date=$0/$1/$2 ($3)$\r$\nTime=$4:$5:$6'
|
||||
goto send
|
||||
|
||||
GetFileAttributes:
|
||||
${GetFileAttributes} "$R1" "$R3" $0
|
||||
IfErrors error
|
||||
StrCpy $R0 '$0'
|
||||
goto send
|
||||
|
||||
GetFileVersion:
|
||||
${GetFileVersion} "$R1" $0
|
||||
IfErrors error
|
||||
StrCpy $R0 '$0'
|
||||
goto send
|
||||
|
||||
GetExeName:
|
||||
${GetExeName} $0
|
||||
StrCpy $R0 '$0'
|
||||
goto send
|
||||
|
||||
GetExePath:
|
||||
${GetExePath} $0
|
||||
StrCpy $R0 '$0'
|
||||
goto send
|
||||
|
||||
GetParameters:
|
||||
${GetParameters} $0
|
||||
StrCpy $R0 '$0'
|
||||
StrCmp $R0 '' 0 send
|
||||
StrCpy $R0 'no parameters'
|
||||
goto send
|
||||
|
||||
GetOptions:
|
||||
${GetOptions} "$R1" "$R3" $0
|
||||
IfErrors error
|
||||
StrCpy $R0 '$0'
|
||||
goto send
|
||||
|
||||
GetRoot:
|
||||
${GetRoot} "$R1" $0
|
||||
StrCpy $R0 '$0'
|
||||
goto send
|
||||
|
||||
GetParent:
|
||||
${GetParent} "$R1" $0
|
||||
StrCpy $R0 '$0'
|
||||
goto send
|
||||
|
||||
GetFileName:
|
||||
${GetFileName} "$R1" $0
|
||||
StrCpy $R0 '$0'
|
||||
goto send
|
||||
|
||||
GetBaseName:
|
||||
${GetBaseName} "$R1" $0
|
||||
StrCpy $R0 '$0'
|
||||
goto send
|
||||
|
||||
GetFileExt:
|
||||
${GetFileExt} "$R1" $0
|
||||
StrCpy $R0 '$0'
|
||||
goto send
|
||||
|
||||
BannerTrimPath:
|
||||
${BannerTrimPath} "$R1" "$R3" $0
|
||||
StrCpy $R0 '$0'
|
||||
goto send
|
||||
|
||||
DirState:
|
||||
${DirState} "$R2" $0
|
||||
StrCpy $R0 '$0'
|
||||
goto send
|
||||
|
||||
RefreshShellIcons:
|
||||
${RefreshShellIcons}
|
||||
StrCpy $R0 'done'
|
||||
goto send
|
||||
|
||||
error:
|
||||
StrCpy $R0 'error'
|
||||
|
||||
send:
|
||||
GetDlgItem $1 $HWND 1208
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:$R0"
|
||||
|
||||
abort
|
||||
FunctionEnd
|
||||
|
||||
Function LocateCallback
|
||||
MessageBox MB_OKCANCEL '$$R9 "path\name"=[$R9]$\n$$R8 "path" =[$R8]$\n$$R7 "name" =[$R7]$\n$$R6 "size" =[$R6]' IDOK +2
|
||||
StrCpy $R0 StopLocate
|
||||
|
||||
Push $R0
|
||||
FunctionEnd
|
||||
|
||||
Function GetDrivesCallback
|
||||
MessageBox MB_OKCANCEL '$$9 "drive letter"=[$9]$\n$$8 "drive type" =[$8]' IDOK +2
|
||||
StrCpy $R0 StopGetDrives
|
||||
StrCpy $R5 '$R5$9 [$8 Drive]$\r$\n'
|
||||
|
||||
Push $R0
|
||||
FunctionEnd
|
||||
|
||||
Function .onInit
|
||||
InitPluginsDir
|
||||
GetTempFileName $INI $PLUGINSDIR
|
||||
File /oname=$INI "FileFunc.ini"
|
||||
FunctionEnd
|
||||
|
||||
Page instfiles
|
||||
|
||||
Section "Empty"
|
||||
SectionEnd
|
572
KattekerCreator/nsis/Examples/FileFuncTest.nsi
Normal file
572
KattekerCreator/nsis/Examples/FileFuncTest.nsi
Normal file
@ -0,0 +1,572 @@
|
||||
;_____________________________________________________________________________
|
||||
;
|
||||
; File Functions Test
|
||||
;_____________________________________________________________________________
|
||||
;
|
||||
; 2006 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)
|
||||
|
||||
Name "File Functions Test"
|
||||
OutFile "FileFuncTest.exe"
|
||||
Caption "$(^Name)"
|
||||
ShowInstDetails show
|
||||
XPStyle on
|
||||
RequestExecutionLevel user
|
||||
|
||||
Var FUNCTION
|
||||
Var OUT1
|
||||
Var OUT2
|
||||
Var OUT3
|
||||
Var OUT4
|
||||
Var OUT5
|
||||
Var OUT6
|
||||
Var OUT7
|
||||
|
||||
!include "FileFunc.nsh"
|
||||
!include "LogicLib.nsh"
|
||||
|
||||
;############### INSTALL ###############
|
||||
|
||||
!define StackVerificationStart `!insertmacro StackVerificationStart`
|
||||
!macro StackVerificationStart _FUNCTION
|
||||
StrCpy $FUNCTION ${_FUNCTION}
|
||||
Call StackVerificationStart
|
||||
!macroend
|
||||
|
||||
!define StackVerificationEnd `!insertmacro StackVerificationEnd`
|
||||
!macro StackVerificationEnd
|
||||
Call StackVerificationEnd
|
||||
!macroend
|
||||
|
||||
Function StackVerificationStart
|
||||
StrCpy $0 !0
|
||||
StrCpy $1 !1
|
||||
StrCpy $2 !2
|
||||
StrCpy $3 !3
|
||||
StrCpy $4 !4
|
||||
StrCpy $5 !5
|
||||
StrCpy $6 !6
|
||||
StrCpy $7 !7
|
||||
StrCpy $8 !8
|
||||
StrCpy $9 !9
|
||||
StrCpy $R0 !R0
|
||||
StrCpy $R1 !R1
|
||||
StrCpy $R2 !R2
|
||||
StrCpy $R3 !R3
|
||||
StrCpy $R4 !R4
|
||||
StrCpy $R5 !R5
|
||||
StrCpy $R6 !R6
|
||||
StrCpy $R7 !R7
|
||||
StrCpy $R8 !R8
|
||||
StrCpy $R9 !R9
|
||||
FunctionEnd
|
||||
|
||||
Function StackVerificationEnd
|
||||
IfErrors +3
|
||||
DetailPrint 'PASSED $FUNCTION no errors'
|
||||
goto +2
|
||||
DetailPrint 'FAILED $FUNCTION error'
|
||||
|
||||
StrCmp $0 '!0' 0 error
|
||||
StrCmp $1 '!1' 0 error
|
||||
StrCmp $2 '!2' 0 error
|
||||
StrCmp $3 '!3' 0 error
|
||||
StrCmp $4 '!4' 0 error
|
||||
StrCmp $5 '!5' 0 error
|
||||
StrCmp $6 '!6' 0 error
|
||||
StrCmp $7 '!7' 0 error
|
||||
StrCmp $8 '!8' 0 error
|
||||
StrCmp $9 '!9' 0 error
|
||||
StrCmp $R0 '!R0' 0 error
|
||||
StrCmp $R1 '!R1' 0 error
|
||||
StrCmp $R2 '!R2' 0 error
|
||||
StrCmp $R3 '!R3' 0 error
|
||||
StrCmp $R4 '!R4' 0 error
|
||||
StrCmp $R5 '!R5' 0 error
|
||||
StrCmp $R6 '!R6' 0 error
|
||||
StrCmp $R7 '!R7' 0 error
|
||||
StrCmp $R8 '!R8' 0 error
|
||||
StrCmp $R9 '!R9' 0 error
|
||||
DetailPrint 'PASSED $FUNCTION stack'
|
||||
goto end
|
||||
|
||||
error:
|
||||
DetailPrint 'FAILED $FUNCTION stack'
|
||||
; MessageBox MB_OKCANCEL '$$0={$0}$\n$$1={$1}$\n$$2={$2}$\n$$3={$3}$\n$$4={$4}$\n$$5={$5}$\n$$6={$6}$\n$$7={$7}$\n$$8={$8}$\n$$9={$9}$\n$$R0={$R0}$\n$$R1={$R1}$\n$$R2={$R2}$\n$$R3={$R3}$\n$$R4={$R4}$\n$$R5={$R5}$\n$$R6={$R6}$\n$$R7={$R7}$\n$$R8={$R8}$\n$$R9={$R9}' IDOK +2
|
||||
; quit
|
||||
|
||||
end:
|
||||
FunctionEnd
|
||||
|
||||
|
||||
|
||||
Section Locate
|
||||
${StackVerificationStart} Locate
|
||||
|
||||
${Locate} '$DOCUMENTS' '/L=FD /M=*.* /S=0B /G=0' 'LocateCallback'
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
Function LocateCallback
|
||||
; MessageBox MB_YESNO '$$0={$0}$\n$$1={$1}$\n$$2={$2}$\n$$3={$3}$\n$$4={$4}$\n$$5={$5}$\n$$6={$6}$\n$$7={$7}$\n$$8={$8}$\n$$9={$9}$\n$$R0={$R0}$\n$$R1={$R1}$\n$$R2={$R2}$\n$$R3={$R3}$\n$$R4={$R4}$\n$$R5={$R5}$\n$$R6={$R6}$\n$$R7={$R7}$\n$$R8={$R8}$\n$$R9={$R9}$\n$\nContinue?' IDYES +2
|
||||
; StrCpy $0 StopLocate
|
||||
|
||||
Push $0
|
||||
FunctionEnd
|
||||
|
||||
|
||||
Section GetSize
|
||||
${StackVerificationStart} GetSize
|
||||
|
||||
${GetSize} '$WINDIR' '/M=Explorer.exe /S=0K /G=0' $OUT1 $OUT2 $OUT3
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section DriveSpace
|
||||
${StackVerificationStart} DriveSpace
|
||||
|
||||
${DriveSpace} 'C:\' '/D=F /S=M' $OUT1
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section GetDrives
|
||||
${StackVerificationStart} GetDrives
|
||||
|
||||
${GetDrives} 'FDD+CDROM' 'GetDrivesCallback'
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
Function GetDrivesCallback
|
||||
; MessageBox MB_YESNO '$$0={$0}$\n$$1={$1}$\n$$2={$2}$\n$$3={$3}$\n$$4={$4}$\n$$5={$5}$\n$$6={$6}$\n$$7={$7}$\n$$8={$8}$\n$$9={$9}$\n$$R0={$R0}$\n$$R1={$R1}$\n$$R2={$R2}$\n$$R3={$R3}$\n$$R4={$R4}$\n$$R5={$R5}$\n$$R6={$R6}$\n$$R7={$R7}$\n$$R8={$R8}$\n$$R9={$R9}$\n$\nContinue?' IDYES +2
|
||||
; StrCpy $0 StopGetDrives
|
||||
|
||||
Push $0
|
||||
FunctionEnd
|
||||
|
||||
|
||||
Section GetTime
|
||||
${StackVerificationStart} GetTime
|
||||
|
||||
${GetTime} '' 'L' $OUT1 $OUT2 $OUT3 $OUT4 $OUT5 $OUT6 $OUT7
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section GetFileAttributes
|
||||
${StackVerificationStart} GetFileAttributes
|
||||
|
||||
${GetFileAttributes} '$WINDIR\explorer.exe' 'ALL' $OUT1
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section GetFileVersion
|
||||
${StackVerificationStart} GetFileVersion
|
||||
|
||||
${GetFileVersion} '$WINDIR\explorer.exe' $OUT1
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section GetExeName
|
||||
${StackVerificationStart} GetExeName
|
||||
|
||||
${GetExeName} $OUT1
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section GetExePath
|
||||
${StackVerificationStart} GetExePath
|
||||
|
||||
${GetExePath} $OUT1
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section GetParameters
|
||||
${StackVerificationStart} GetParameters
|
||||
|
||||
# basic stuff
|
||||
|
||||
StrCpy $CMDLINE '"$PROGRAMFILES\Something\Hello.exe"'
|
||||
${GetParameters} $OUT1
|
||||
StrCpy $CMDLINE '"$PROGRAMFILES\Something\Hello.exe" test'
|
||||
${GetParameters} $OUT2
|
||||
StrCpy $CMDLINE '"$PROGRAMFILES\Something\Hello.exe" "test"'
|
||||
${GetParameters} $OUT3
|
||||
StrCpy $CMDLINE 'C:\Hello.exe'
|
||||
${GetParameters} $OUT4
|
||||
StrCpy $CMDLINE 'C:\Hello.exe test'
|
||||
${GetParameters} $OUT5
|
||||
StrCpy $CMDLINE 'C:\Hello.exe "test"'
|
||||
${GetParameters} $OUT6
|
||||
StrCpy $CMDLINE 'C:\Hello.exe test test '
|
||||
${GetParameters} $OUT7
|
||||
|
||||
${If} $OUT1 != ""
|
||||
${OrIf} $OUT2 != "test"
|
||||
${OrIf} $OUT3 != '"test"'
|
||||
${OrIf} $OUT4 != ""
|
||||
${OrIf} $OUT5 != "test"
|
||||
${OrIf} $OUT6 != '"test"'
|
||||
${OrIf} $OUT7 != 'test test'
|
||||
SetErrors
|
||||
${EndIf}
|
||||
|
||||
# some corner cases
|
||||
|
||||
StrCpy $CMDLINE ''
|
||||
${GetParameters} $OUT1
|
||||
StrCpy $CMDLINE '"'
|
||||
${GetParameters} $OUT2
|
||||
StrCpy $CMDLINE '""'
|
||||
${GetParameters} $OUT3
|
||||
StrCpy $CMDLINE '"" test'
|
||||
${GetParameters} $OUT4
|
||||
StrCpy $CMDLINE ' test'
|
||||
${GetParameters} $OUT5
|
||||
StrCpy $CMDLINE ' test' # left over bug(?) from old GetParameters
|
||||
# it starts looking for ' ' from the third char
|
||||
${GetParameters} $OUT6
|
||||
StrCpy $CMDLINE ' '
|
||||
${GetParameters} $OUT7
|
||||
|
||||
${If} $OUT1 != ""
|
||||
${OrIf} $OUT2 != ""
|
||||
${OrIf} $OUT3 != ""
|
||||
${OrIf} $OUT4 != ""
|
||||
${OrIf} $OUT5 != ""
|
||||
${OrIf} $OUT6 != ""
|
||||
${OrIf} $OUT7 != ""
|
||||
SetErrors
|
||||
${EndIf}
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section GetOptions
|
||||
${StackVerificationStart} GetOptions
|
||||
|
||||
${GetOptions} '/INSTDIR=C:\Program Files\Common Files /SILENT=yes' '/INSTDIR=' $OUT1
|
||||
StrCmp $OUT1 'C:\Program Files\Common Files' 0 error
|
||||
|
||||
${GetOptions} '-TMP=temp.tmp -INSTDIR="C:/Program Files/Common Files" -SILENT=yes' '-INSTDIR=' $OUT1
|
||||
StrCmp $OUT1 'C:/Program Files/Common Files' 0 error
|
||||
|
||||
${GetOptions} "/INSTDIR='C:/Program Files/Common Files' /SILENT=yes" '/INSTDIR=' $OUT1
|
||||
StrCmp $OUT1 'C:/Program Files/Common Files' 0 error
|
||||
|
||||
StrCpy $OUT1 '/INSTDIR=`C:/Program Files/Common Files` /SILENT=yes'
|
||||
${GetOptions} '$OUT1' '/INSTDIR=' $OUT1
|
||||
StrCmp $OUT1 'C:/Program Files/Common Files' 0 error
|
||||
|
||||
${GetOptions} '/SILENT=yes /INSTDIR=C:\Program Files\Common Files' '/INSTDIR=' $OUT1
|
||||
StrCmp $OUT1 'C:\Program Files\Common Files' 0 error
|
||||
|
||||
${GetOptions} "/INSTDIR=common directory: 'C:\Program Files\Common Files' /SILENT=yes" '/INSTDIR=' $OUT1
|
||||
StrCmp $OUT1 "common directory: 'C:\Program Files\Common Files'" 0 error
|
||||
|
||||
${GetOptions} '/INSTDIR=WxxxW /SILENT=yes' '/INSTDIR=' $OUT1
|
||||
StrCmp $OUT1 'WxxxW' 0 error
|
||||
|
||||
${GetOptions} "/Prm='/D=True' /D=1" '/D=' $OUT1
|
||||
StrCmp $OUT1 "1" 0 error
|
||||
|
||||
${GetOptions} "/D=1 /Prm='/D=True'" '/Prm=' $OUT1
|
||||
StrCmp $OUT1 "/D=True" 0 error
|
||||
|
||||
${GetOptions} `/D=1 /Prm='/D="True" /S="/Temp"'` '/Prm=' $OUT1
|
||||
StrCmp $OUT1 '/D="True" /S="/Temp"' 0 error
|
||||
|
||||
${GetOptions} `/INSTDIR='"C:/Program Files/Common Files"' /SILENT=yes` '/INSTDIR=' $OUT1
|
||||
StrCmp $OUT1 '"C:/Program Files/Common Files"' 0 error
|
||||
|
||||
${GetOptions} `/INSTDIR='"C:/Program Files/Common Files"' /SILENT=yes` '/INSTDIR*=' $OUT1
|
||||
IfErrors 0 error
|
||||
StrCmp $OUT1 '' 0 error
|
||||
|
||||
${GetOptions} `/INSTDIR="C:/Program Files/Common Files" /SILENT=yes` '' $OUT1
|
||||
IfErrors 0 error
|
||||
StrCmp $OUT1 '' 0 error
|
||||
|
||||
${GetOptionsS} '/INSTDIR=C:\Program Files\Common Files /SILENT' '/SILENT' $OUT1
|
||||
IfErrors error
|
||||
StrCmp $OUT1 '' 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section GetOptionsS
|
||||
${StackVerificationStart} GetOptionsS
|
||||
|
||||
${GetOptionsS} '/INSTDIR=C:\Program Files\Common Files /SILENT=yes' '/INSTDIR=' $OUT1
|
||||
IfErrors error
|
||||
StrCmp $OUT1 'C:\Program Files\Common Files' 0 error
|
||||
|
||||
${GetOptionsS} '/INSTDIR=C:\Program Files\Common Files /SILENT=yes' '/Instdir=' $OUT1
|
||||
IfErrors 0 error
|
||||
StrCmp $OUT1 '' 0 error
|
||||
|
||||
${GetOptionsS} '/INSTDIR=C:\Program Files\Common Files /SILENT' '/SILENT' $OUT1
|
||||
IfErrors error
|
||||
StrCmp $OUT1 '' 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section GetRoot
|
||||
${StackVerificationStart} GetRoot
|
||||
|
||||
${GetRoot} 'C:\Program Files\NSIS' $OUT1
|
||||
StrCmp $OUT1 'C:' 0 error
|
||||
|
||||
${GetRoot} '\\SuperPimp\NSIS\Source\exehead\Ui.c' $OUT1
|
||||
StrCmp $OUT1 '\\SuperPimp\NSIS' 0 error
|
||||
|
||||
${GetRoot} '\\Program Files\NSIS' $OUT1
|
||||
StrCmp $OUT1 '\\Program Files\NSIS' 0 error
|
||||
|
||||
${GetRoot} '\\Program Files\NSIS\' $OUT1
|
||||
StrCmp $OUT1 '\\Program Files\NSIS' 0 error
|
||||
|
||||
${GetRoot} '\\Program Files\NSIS\Source\exehead\Ui.c' $OUT1
|
||||
StrCmp $OUT1 '\\Program Files\NSIS' 0 error
|
||||
|
||||
${GetRoot} '\Program Files\NSIS' $OUT1
|
||||
StrCmp $OUT1 '' 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section GetParent
|
||||
${StackVerificationStart} GetParent
|
||||
|
||||
${GetParent} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
|
||||
StrCmp $OUT1 'C:\Program Files\Winamp' 0 error
|
||||
|
||||
${GetParent} 'C:\Program Files\Winamp\plugins' $OUT1
|
||||
StrCmp $OUT1 'C:\Program Files\Winamp' 0 error
|
||||
|
||||
${GetParent} 'C:\Program Files\Winamp\plugins\' $OUT1
|
||||
StrCmp $OUT1 'C:\Program Files\Winamp' 0 error
|
||||
|
||||
${GetParent} 'C:\' $OUT1
|
||||
StrCmp $OUT1 '' 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section GetFileName
|
||||
${StackVerificationStart} GetFileName
|
||||
|
||||
${GetFileName} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
|
||||
StrCmp $OUT1 'uninstwa.exe' 0 error
|
||||
|
||||
${GetFileName} 'uninstwa.exe' $OUT1
|
||||
StrCmp $OUT1 'uninstwa.exe' 0 error
|
||||
|
||||
${GetFileName} 'C:\Program Files\Winamp\plugins' $OUT1
|
||||
StrCmp $OUT1 'plugins' 0 error
|
||||
|
||||
${GetFileName} 'C:\Program Files\Winamp\plugins\' $OUT1
|
||||
StrCmp $OUT1 'plugins' 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section GetBaseName
|
||||
${StackVerificationStart} GetBaseName
|
||||
|
||||
${GetBaseName} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
|
||||
StrCmp $OUT1 'uninstwa' 0 error
|
||||
|
||||
${GetBaseName} 'uninstwa.exe' $OUT1
|
||||
StrCmp $OUT1 'uninstwa' 0 error
|
||||
|
||||
${GetBaseName} 'C:\Program Files\Winamp\plugins' $OUT1
|
||||
StrCmp $OUT1 'plugins' 0 error
|
||||
|
||||
${GetBaseName} 'C:\Program Files\Winamp\plugins\' $OUT1
|
||||
StrCmp $OUT1 '' 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section GetFileExt
|
||||
${StackVerificationStart} GetFileExt
|
||||
|
||||
${GetFileExt} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
|
||||
StrCmp $OUT1 'exe' 0 error
|
||||
|
||||
${GetFileExt} 'uninstwa.exe' $OUT1
|
||||
StrCmp $OUT1 'exe' 0 error
|
||||
|
||||
${GetFileExt} 'C:\Program Files\Winamp\plugins' $OUT1
|
||||
StrCmp $OUT1 '' 0 error
|
||||
|
||||
${GetFileExt} 'C:\Program Files\Winamp\plugins\' $OUT1
|
||||
StrCmp $OUT1 '' 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section BannerTrimPath
|
||||
${StackVerificationStart} BannerTrimPath
|
||||
|
||||
${BannerTrimPath} 'C:\Server\Documents\Terminal\license.htm' '35A' $OUT1
|
||||
StrCmp $OUT1 'C:\Server\...\Terminal\license.htm' 0 error
|
||||
|
||||
${BannerTrimPath} 'C:\12\3456\789' '3A' $OUT1
|
||||
StrCmp $OUT1 '' 0 error
|
||||
|
||||
${BannerTrimPath} 'C:\12\3456\789' '4A' $OUT1
|
||||
StrCmp $OUT1 'C...' 0 error
|
||||
|
||||
${BannerTrimPath} 'C:\12\3456\789' '11A' $OUT1
|
||||
StrCmp $OUT1 'C:\12\...' 0 error
|
||||
|
||||
${BannerTrimPath} 'C:\12\3456\789' '13A' $OUT1
|
||||
StrCmp $OUT1 'C:\12\...\789' 0 error
|
||||
|
||||
${BannerTrimPath} 'C:\12\3456\789' '14A' $OUT1
|
||||
StrCmp $OUT1 'C:\12\3456\789' 0 error
|
||||
|
||||
${BannerTrimPath} 'C:\12\3456\789' '14A' $OUT1
|
||||
StrCmp $OUT1 'C:\12\3456\789' 0 error
|
||||
|
||||
${BannerTrimPath} 'C:\12\3456\789' '11B' $OUT1
|
||||
StrCmp $OUT1 'C:\12\...' 0 error
|
||||
|
||||
${BannerTrimPath} 'C:\12\3456\789' '5B' $OUT1
|
||||
StrCmp $OUT1 'C:...' 0 error
|
||||
|
||||
${BannerTrimPath} 'C:\12\3456\789' '5B' $OUT1
|
||||
StrCmp $OUT1 'C:...' 0 error
|
||||
|
||||
${BannerTrimPath} 'C:\12\3456\789' '11C' $OUT1
|
||||
StrCmp $OUT1 'C:\12\34...' 0 error
|
||||
|
||||
${BannerTrimPath} 'C:\12\3456\789' '9D' $OUT1
|
||||
StrCmp $OUT1 'C:\12\...' 0 error
|
||||
|
||||
${BannerTrimPath} 'C:\12\3456\789' '10D' $OUT1
|
||||
StrCmp $OUT1 'C:\...\789' 0 error
|
||||
|
||||
${BannerTrimPath} 'C:\12\3456\789' '11D' $OUT1
|
||||
StrCmp $OUT1 'C:\1...\789' 0 error
|
||||
|
||||
${BannerTrimPath} '123456789' '5D' $OUT1
|
||||
StrCmp $OUT1 '12...' 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section DirState
|
||||
${StackVerificationStart} DirState
|
||||
|
||||
${DirState} '$TEMP' $OUT1
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section RefreshShellIcons
|
||||
${StackVerificationStart} RefreshShellIcons
|
||||
|
||||
${RefreshShellIcons}
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section WriteUninstaller
|
||||
goto +2
|
||||
WriteUninstaller '$EXEDIR\un.FileFuncTest.exe'
|
||||
SectionEnd
|
||||
|
||||
|
||||
|
||||
;############### UNINSTALL ###############
|
||||
|
||||
Section un.Uninstall
|
||||
${Locate} '$DOCUMENTS' '/L=FD /M=*.* /S=0B /G=0' 'un.LocateCallback'
|
||||
${GetSize} '$WINDIR' '/M=Explorer.exe /S=0K /G=0' $OUT1 $OUT2 $OUT3
|
||||
${DriveSpace} 'C:\' '/D=F /S=M' $OUT1
|
||||
${GetDrives} 'FDD+CDROM' 'un.GetDrivesCallback'
|
||||
${GetTime} '' 'L' $OUT1 $OUT2 $OUT3 $OUT4 $OUT5 $OUT6 $OUT7
|
||||
${GetFileAttributes} '$WINDIR\explorer.exe' 'ALL' $OUT1
|
||||
${GetFileVersion} '$WINDIR\explorer.exe' $OUT1
|
||||
${GetExeName} $OUT1
|
||||
${GetExePath} $OUT1
|
||||
${GetParameters} $OUT1
|
||||
${GetOptions} '/INSTDIR=C:\Program Files\Common Files /SILENT=yes' '/INSTDIR=' $OUT1
|
||||
${GetOptionsS} '/INSTDIR=C:\Program Files\Common Files /SILENT=yes' '/INSTDIR=' $OUT1
|
||||
${GetRoot} 'C:\Program Files\NSIS' $OUT1
|
||||
${GetParent} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
|
||||
${GetFileName} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
|
||||
${GetBaseName} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
|
||||
${GetFileExt} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
|
||||
${BannerTrimPath} 'C:\Server\Documents\Terminal\license.htm' '35A' $OUT1
|
||||
${DirState} '$TEMP' $OUT1
|
||||
${RefreshShellIcons}
|
||||
SectionEnd
|
||||
|
||||
Function un.LocateCallback
|
||||
Push $0
|
||||
FunctionEnd
|
||||
|
||||
Function un.GetDrivesCallback
|
||||
Push $0
|
||||
FunctionEnd
|
76
KattekerCreator/nsis/Examples/InstallOptions/test.ini
Normal file
76
KattekerCreator/nsis/Examples/InstallOptions/test.ini
Normal file
@ -0,0 +1,76 @@
|
||||
[Settings]
|
||||
NumFields=8
|
||||
|
||||
[Field 1]
|
||||
Type=GroupBox
|
||||
Left=0
|
||||
Right=-1
|
||||
Top=0
|
||||
Bottom=-5
|
||||
Text=" This is a group box... "
|
||||
|
||||
[Field 2]
|
||||
Type=checkbox
|
||||
Text=Install support for X
|
||||
Left=10
|
||||
Right=-10
|
||||
Top=17
|
||||
Bottom=25
|
||||
State=0
|
||||
Flags=GROUP
|
||||
|
||||
[Field 3]
|
||||
Type=checkbox
|
||||
Text=Install support for Y
|
||||
Left=10
|
||||
Right=-10
|
||||
Top=30
|
||||
Bottom=38
|
||||
State=1
|
||||
Flags=NOTABSTOP
|
||||
|
||||
[Field 4]
|
||||
Type=checkbox
|
||||
Text=Install support for Z
|
||||
Left=10
|
||||
Right=-10
|
||||
Top=43
|
||||
Bottom=51
|
||||
State=0
|
||||
Flags=NOTABSTOP
|
||||
|
||||
[Field 5]
|
||||
Type=FileRequest
|
||||
State=C:\dummy.xyz
|
||||
Left=10
|
||||
Right=-10
|
||||
Top=56
|
||||
Bottom=68
|
||||
Filter=XYZ Files|*.xyz|All files|*.*
|
||||
Flags=GROUP|FILE_MUST_EXIST|FILE_EXPLORER|FILE_HIDEREADONLY
|
||||
|
||||
[Field 6]
|
||||
Type=DirRequest
|
||||
Left=10
|
||||
Right=-10
|
||||
Top=73
|
||||
Bottom=85
|
||||
Text=Select a directory...
|
||||
State=C:\Program Files\NSIS
|
||||
|
||||
[Field 7]
|
||||
Type=Label
|
||||
Left=10
|
||||
Right=-10
|
||||
Top=90
|
||||
Bottom=98
|
||||
Text=This is a label...
|
||||
|
||||
[Field 8]
|
||||
Type=Text
|
||||
Left=10
|
||||
Right=-10
|
||||
Top=98
|
||||
Bottom=120
|
||||
State="Multiline\r\nedit..."
|
||||
Flags=MULTILINE|VSCROLL|WANTRETURN
|
84
KattekerCreator/nsis/Examples/InstallOptions/test.nsi
Normal file
84
KattekerCreator/nsis/Examples/InstallOptions/test.nsi
Normal file
@ -0,0 +1,84 @@
|
||||
;InstallOptions Test Script
|
||||
;Written by Joost Verburg
|
||||
;--------------------------
|
||||
|
||||
!define TEMP1 $R0 ;Temp variable
|
||||
|
||||
;The name of the installer
|
||||
Name "InstallOptions Test"
|
||||
|
||||
;The file to write
|
||||
OutFile "Test.exe"
|
||||
|
||||
; Show install details
|
||||
ShowInstDetails show
|
||||
|
||||
;Things that need to be extracted on startup (keep these lines before any File command!)
|
||||
;Only useful for BZIP2 compression
|
||||
;Use ReserveFile for your own InstallOptions INI files too!
|
||||
|
||||
ReserveFile /plugin InstallOptions.dll
|
||||
ReserveFile "test.ini"
|
||||
|
||||
;Order of pages
|
||||
Page custom SetCustom ValidateCustom ": Testing InstallOptions" ;Custom page. InstallOptions gets called in SetCustom.
|
||||
Page instfiles
|
||||
|
||||
Section "Components"
|
||||
|
||||
;Get Install Options dialog user input
|
||||
|
||||
ReadINIStr ${TEMP1} "$PLUGINSDIR\test.ini" "Field 2" "State"
|
||||
DetailPrint "Install X=${TEMP1}"
|
||||
ReadINIStr ${TEMP1} "$PLUGINSDIR\test.ini" "Field 3" "State"
|
||||
DetailPrint "Install Y=${TEMP1}"
|
||||
ReadINIStr ${TEMP1} "$PLUGINSDIR\test.ini" "Field 4" "State"
|
||||
DetailPrint "Install Z=${TEMP1}"
|
||||
ReadINIStr ${TEMP1} "$PLUGINSDIR\test.ini" "Field 5" "State"
|
||||
DetailPrint "File=${TEMP1}"
|
||||
ReadINIStr ${TEMP1} "$PLUGINSDIR\test.ini" "Field 6" "State"
|
||||
DetailPrint "Dir=${TEMP1}"
|
||||
ReadINIStr ${TEMP1} "$PLUGINSDIR\test.ini" "Field 8" "State"
|
||||
DetailPrint "Info=${TEMP1}"
|
||||
|
||||
SectionEnd
|
||||
|
||||
Function .onInit
|
||||
|
||||
;Extract InstallOptions files
|
||||
;$PLUGINSDIR will automatically be removed when the installer closes
|
||||
|
||||
InitPluginsDir
|
||||
File /oname=$PLUGINSDIR\test.ini "test.ini"
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function SetCustom
|
||||
|
||||
;Display the InstallOptions dialog
|
||||
|
||||
Push ${TEMP1}
|
||||
|
||||
InstallOptions::dialog "$PLUGINSDIR\test.ini"
|
||||
Pop ${TEMP1}
|
||||
|
||||
Pop ${TEMP1}
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function ValidateCustom
|
||||
|
||||
ReadINIStr ${TEMP1} "$PLUGINSDIR\test.ini" "Field 2" "State"
|
||||
StrCmp ${TEMP1} 1 done
|
||||
|
||||
ReadINIStr ${TEMP1} "$PLUGINSDIR\test.ini" "Field 3" "State"
|
||||
StrCmp ${TEMP1} 1 done
|
||||
|
||||
ReadINIStr ${TEMP1} "$PLUGINSDIR\test.ini" "Field 4" "State"
|
||||
StrCmp ${TEMP1} 1 done
|
||||
MessageBox MB_ICONEXCLAMATION|MB_OK "You must select at least one install option!"
|
||||
Abort
|
||||
|
||||
done:
|
||||
|
||||
FunctionEnd
|
65
KattekerCreator/nsis/Examples/InstallOptions/testimgs.ini
Normal file
65
KattekerCreator/nsis/Examples/InstallOptions/testimgs.ini
Normal file
@ -0,0 +1,65 @@
|
||||
[Settings]
|
||||
NumFields=8
|
||||
|
||||
[Field 1]
|
||||
Type=GroupBox
|
||||
Left=0
|
||||
Right=-1
|
||||
Top=0
|
||||
Bottom=-5
|
||||
Text=" Images "
|
||||
|
||||
[Field 2]
|
||||
Type=Bitmap
|
||||
Left=10
|
||||
Right=-10
|
||||
Top=10
|
||||
Bottom=30
|
||||
Flags=TRANSPARENT
|
||||
|
||||
[Field 3]
|
||||
Type=Bitmap
|
||||
Left=10
|
||||
Right=-10
|
||||
Top=35
|
||||
Bottom=45
|
||||
Flags=TRANSPARENT
|
||||
|
||||
[Field 4]
|
||||
Type=Bitmap
|
||||
Left=10
|
||||
Right=-10
|
||||
Top=50
|
||||
Bottom=70
|
||||
Flags=RESIZETOFIT|TRANSPARENT
|
||||
|
||||
[Field 5]
|
||||
Type=Bitmap
|
||||
Left=10
|
||||
Right=-10
|
||||
Top=75
|
||||
Bottom=95
|
||||
Flags=RESIZETOFIT|TRANSPARENT
|
||||
|
||||
[Field 6]
|
||||
Type=Icon
|
||||
Left=10
|
||||
Right=40
|
||||
Top=100
|
||||
Bottom=120
|
||||
|
||||
[Field 7]
|
||||
Type=Icon
|
||||
Left=50
|
||||
Right=80
|
||||
Top=100
|
||||
Bottom=120
|
||||
|
||||
[Field 8]
|
||||
Type=Label
|
||||
Left=10
|
||||
Right=-10
|
||||
Top=10
|
||||
Bottom=-10
|
||||
Text=ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||
|
59
KattekerCreator/nsis/Examples/InstallOptions/testimgs.nsi
Normal file
59
KattekerCreator/nsis/Examples/InstallOptions/testimgs.nsi
Normal file
@ -0,0 +1,59 @@
|
||||
;InstallOptions Test Script
|
||||
;Written by Joost Verburg
|
||||
;--------------------------
|
||||
|
||||
;The name of the installer
|
||||
Name "InstallOptions Test"
|
||||
|
||||
;The file to write
|
||||
OutFile "Test.exe"
|
||||
|
||||
; Show install details
|
||||
ShowInstDetails show
|
||||
|
||||
;Things that need to be extracted on startup (keep these lines before any File command!)
|
||||
;Only useful for BZIP2 compression
|
||||
;Use ReserveFile for your own InstallOptions INI files too!
|
||||
|
||||
ReserveFile /plugin InstallOptions.dll
|
||||
ReserveFile "testimgs.ini"
|
||||
ReserveFile "${NSISDIR}\Contrib\Graphics\Checks\colorful.bmp"
|
||||
ReserveFile "${NSISDIR}\Contrib\Graphics\Checks\modern.bmp"
|
||||
ReserveFile "${NSISDIR}\Contrib\Graphics\Icons\pixel-install.ico"
|
||||
|
||||
;Order of pages
|
||||
Page custom SetCustom "" ": Testing InstallOptions" ;Custom page. InstallOptions gets called in SetCustom.
|
||||
Page instfiles
|
||||
|
||||
Section
|
||||
SectionEnd
|
||||
|
||||
Function .onInit
|
||||
|
||||
;Extract InstallOptions files
|
||||
;$PLUGINSDIR will automatically be removed when the installer closes
|
||||
|
||||
InitPluginsDir
|
||||
File /oname=$PLUGINSDIR\testimgs.ini "testimgs.ini"
|
||||
File /oname=$PLUGINSDIR\image.bmp "${NSISDIR}\Contrib\Graphics\Checks\colorful.bmp"
|
||||
File /oname=$PLUGINSDIR\image2.bmp "${NSISDIR}\Contrib\Graphics\Checks\modern.bmp"
|
||||
File /oname=$PLUGINSDIR\icon.ico "${NSISDIR}\Contrib\Graphics\Icons\pixel-install.ico"
|
||||
|
||||
;Write image paths to the INI file
|
||||
|
||||
WriteINIStr $PLUGINSDIR\testimgs.ini "Field 2" "Text" $PLUGINSDIR\image.bmp
|
||||
WriteINIStr $PLUGINSDIR\testimgs.ini "Field 3" "Text" $PLUGINSDIR\image2.bmp
|
||||
WriteINIStr $PLUGINSDIR\testimgs.ini "Field 4" "Text" $PLUGINSDIR\image.bmp
|
||||
WriteINIStr $PLUGINSDIR\testimgs.ini "Field 5" "Text" $PLUGINSDIR\image2.bmp
|
||||
WriteINIStr $PLUGINSDIR\testimgs.ini "Field 6" "Text" $PLUGINSDIR\icon.ico
|
||||
;No Text for Field 7 so it'll show the installer's icon
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function SetCustom
|
||||
|
||||
;Display the InstallOptions dialog
|
||||
InstallOptions::dialog "$PLUGINSDIR\testimgs.ini"
|
||||
Pop $0
|
||||
|
||||
FunctionEnd
|
44
KattekerCreator/nsis/Examples/InstallOptions/testlink.ini
Normal file
44
KattekerCreator/nsis/Examples/InstallOptions/testlink.ini
Normal file
@ -0,0 +1,44 @@
|
||||
[Settings]
|
||||
NumFields=5
|
||||
|
||||
[Field 1]
|
||||
Type=Label
|
||||
Left=10
|
||||
Right=-40
|
||||
Top=10
|
||||
Bottom=18
|
||||
Text=This custom page demonstrates the "Link" control
|
||||
|
||||
[Field 2]
|
||||
Type=Link
|
||||
Left=20
|
||||
Right=-40
|
||||
Top=40
|
||||
Bottom=50
|
||||
Text=* Run notepad
|
||||
|
||||
[Field 3]
|
||||
Type=Link
|
||||
Left=20
|
||||
Right=-40
|
||||
Top=55
|
||||
Bottom=65
|
||||
State=mailto:someone@anywhere.com
|
||||
Text=* Send E-mail
|
||||
|
||||
[Field 4]
|
||||
Type=Link
|
||||
Left=20
|
||||
Right=-40
|
||||
Top=70
|
||||
Bottom=80
|
||||
State=http://nsis.sourceforge.net/
|
||||
Text=* Homepage http://nsis.sourceforge.net/
|
||||
|
||||
[Field 5]
|
||||
Type=Text
|
||||
Left=20
|
||||
Right=-40
|
||||
Top=85
|
||||
Bottom=98
|
||||
State=Just to test proper interaction with the other fields
|
58
KattekerCreator/nsis/Examples/InstallOptions/testlink.nsi
Normal file
58
KattekerCreator/nsis/Examples/InstallOptions/testlink.nsi
Normal file
@ -0,0 +1,58 @@
|
||||
;InstallOptions Test Script
|
||||
;Written by Ramon
|
||||
;This script demonstrates the power of the new control "LINK"
|
||||
;that allows you to execute files, send mails, open wepsites, etc.
|
||||
;--------------------------
|
||||
|
||||
!define TEMP1 $R0 ;Temp variable
|
||||
|
||||
;The name of the installer
|
||||
Name "InstallOptions Test Link"
|
||||
|
||||
;The file to write
|
||||
OutFile "TestLink.exe"
|
||||
|
||||
; Show install details
|
||||
ShowInstDetails show
|
||||
|
||||
;Things that need to be extracted on startup (keep these lines before any File command!)
|
||||
;Only useful for BZIP2 compression
|
||||
;Use ReserveFile for your own InstallOptions INI files too!
|
||||
|
||||
ReserveFile /plugin InstallOptions.dll
|
||||
ReserveFile "testlink.ini"
|
||||
|
||||
;Order of pages
|
||||
Page custom SetCustom
|
||||
Page instfiles
|
||||
|
||||
Section "Components"
|
||||
|
||||
;Get Install Options dialog user input
|
||||
|
||||
SectionEnd
|
||||
|
||||
Function .onInit
|
||||
|
||||
;Extract InstallOptions files
|
||||
;$PLUGINSDIR will automatically be removed when the installer closes
|
||||
|
||||
InitPluginsDir
|
||||
File /oname=$PLUGINSDIR\test.ini "testlink.ini"
|
||||
WriteIniStr $PLUGINSDIR\test.ini "Field 2" "State" "$WINDIR\Notepad.exe"
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function SetCustom
|
||||
|
||||
;Display the InstallOptions dialog
|
||||
|
||||
Push ${TEMP1}
|
||||
|
||||
InstallOptions::dialog "$PLUGINSDIR\test.ini"
|
||||
Pop ${TEMP1}
|
||||
|
||||
Pop ${TEMP1}
|
||||
|
||||
FunctionEnd
|
||||
|
105
KattekerCreator/nsis/Examples/InstallOptions/testnotify.ini
Normal file
105
KattekerCreator/nsis/Examples/InstallOptions/testnotify.ini
Normal file
@ -0,0 +1,105 @@
|
||||
[Settings]
|
||||
NumFields=11
|
||||
|
||||
[Field 1]
|
||||
Type=Groupbox
|
||||
Text="This is a group box..."
|
||||
Left=0
|
||||
Right=-1
|
||||
Top=0
|
||||
Bottom=-4
|
||||
|
||||
[Field 2]
|
||||
Type=Checkbox
|
||||
Text=Install support for X
|
||||
Flags=NOTIFY
|
||||
State=1
|
||||
Left=10
|
||||
Right=100
|
||||
Top=17
|
||||
Bottom=25
|
||||
|
||||
[Field 3]
|
||||
Type=Checkbox
|
||||
Text=Install support for Y
|
||||
State=0
|
||||
Left=10
|
||||
Right=100
|
||||
Top=30
|
||||
Bottom=38
|
||||
|
||||
[Field 4]
|
||||
Type=Checkbox
|
||||
Text=Install support for Z
|
||||
Flags=RIGHT
|
||||
State=0
|
||||
Left=10
|
||||
Right=100
|
||||
Top=43
|
||||
Bottom=51
|
||||
|
||||
[Field 5]
|
||||
Type=FileRequest
|
||||
Flags=GROUP|FILE_MUST_EXIST|FILE_EXPLORER|FILE_HIDEREADONLY
|
||||
State=C:\dummy.xyz
|
||||
Filter=XYZ Files|*.xyz|All files|*.*
|
||||
Left=10
|
||||
Right=-10
|
||||
Top=56
|
||||
Bottom=69
|
||||
|
||||
[Field 6]
|
||||
Type=DirRequest
|
||||
Text=Select a directory...
|
||||
State=C:\Program Files\NSIS
|
||||
Left=10
|
||||
Right=-10
|
||||
Top=74
|
||||
Bottom=87
|
||||
|
||||
[Field 7]
|
||||
Type=Label
|
||||
Text=This is a label...
|
||||
Left=10
|
||||
Right=-10
|
||||
Top=89
|
||||
Bottom=97
|
||||
|
||||
[Field 8]
|
||||
Type=Text
|
||||
Flags=MULTILINE|VSCROLL|WANTRETURN|NOWORDWRAP
|
||||
State="Multiline\r\nedit..."
|
||||
Left=10
|
||||
Right=-10
|
||||
Top=97
|
||||
Bottom=118
|
||||
MinLen=1
|
||||
ValidateText=Please enter some text before proceeding.
|
||||
|
||||
[Field 9]
|
||||
Type=Button
|
||||
Flags=NOTIFY
|
||||
Text=&Clear
|
||||
Left=-60
|
||||
Right=-10
|
||||
Top=19
|
||||
Bottom=33
|
||||
|
||||
[Field 10]
|
||||
Type=Button
|
||||
Text=&Email
|
||||
State=mailto:someone@anywhere.com
|
||||
Left=-60
|
||||
Right=-10
|
||||
Top=35
|
||||
Bottom=49
|
||||
|
||||
[Field 11]
|
||||
Type=DROPLIST
|
||||
ListItems=Show|Hide
|
||||
State=Show
|
||||
Flags=NOTIFY
|
||||
Left=120
|
||||
Right=-80
|
||||
Top=20
|
||||
Bottom=56
|
133
KattekerCreator/nsis/Examples/InstallOptions/testnotify.nsi
Normal file
133
KattekerCreator/nsis/Examples/InstallOptions/testnotify.nsi
Normal file
@ -0,0 +1,133 @@
|
||||
; InstallOptions script demonstrating custom buttons
|
||||
;----------------------------------------------------
|
||||
|
||||
!include WinMessages.nsh
|
||||
|
||||
; The name of the installer
|
||||
Name "InstallOptions Test"
|
||||
|
||||
; The file to write
|
||||
OutFile "TestNotify.exe"
|
||||
|
||||
; Show install details
|
||||
ShowInstDetails show
|
||||
|
||||
; Called before anything else as installer initialises
|
||||
Function .onInit
|
||||
|
||||
; Extract InstallOptions files
|
||||
; $PLUGINSDIR will automatically be removed when the installer closes
|
||||
InitPluginsDir
|
||||
File /oname=$PLUGINSDIR\test.ini "testnotify.ini"
|
||||
|
||||
FunctionEnd
|
||||
|
||||
; Our custom page
|
||||
Page custom ShowCustom LeaveCustom ": Testing InstallOptions"
|
||||
|
||||
Function ShowCustom
|
||||
|
||||
; Initialise the dialog but don't show it yet
|
||||
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Test the right-to-left version?" IDNO +2
|
||||
WriteINIStr "$PLUGINSDIR\test.ini" "Settings" "RTL" "1"
|
||||
InstallOptions::initDialog "$PLUGINSDIR\test.ini"
|
||||
; In this mode InstallOptions returns the window handle so we can use it
|
||||
Pop $0
|
||||
; Now show the dialog and wait for it to finish
|
||||
InstallOptions::show
|
||||
; Finally fetch the InstallOptions status value (we don't care what it is though)
|
||||
Pop $0
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function LeaveCustom
|
||||
|
||||
; At this point the user has either pressed Next or one of our custom buttons
|
||||
; We find out which by reading from the INI file
|
||||
ReadINIStr $0 "$PLUGINSDIR\test.ini" "Settings" "State"
|
||||
StrCmp $0 0 validate ; Next button?
|
||||
StrCmp $0 2 supportx ; "Install support for X"?
|
||||
StrCmp $0 9 clearbtn ; "Clear" button?
|
||||
StrCmp $0 11 droplist ; "Show|Hide" drop-list?
|
||||
Abort ; Return to the page
|
||||
|
||||
supportx:
|
||||
; Make the FileRequest field depend on the first checkbox
|
||||
ReadINIStr $0 "$PLUGINSDIR\test.ini" "Field 2" "State"
|
||||
ReadINIStr $1 "$PLUGINSDIR\test.ini" "Field 5" "HWND"
|
||||
EnableWindow $1 $0
|
||||
ReadINIStr $1 "$PLUGINSDIR\test.ini" "Field 5" "HWND2"
|
||||
EnableWindow $1 $0
|
||||
; Add the disabled flag too so when we return to this page it's disabled again
|
||||
StrCmp $0 0 0 +3
|
||||
|
||||
WriteINIStr "$PLUGINSDIR\test.ini" "Field 5" "Flags" "GROUP|FILE_MUST_EXIST|FILE_EXPLORER|FILE_HIDEREADONLY|DISABLED"
|
||||
Goto +2
|
||||
|
||||
WriteINIStr "$PLUGINSDIR\test.ini" "Field 5" "Flags" "GROUP|FILE_MUST_EXIST|FILE_EXPLORER|FILE_HIDEREADONLY"
|
||||
Abort ; Return to the page
|
||||
|
||||
clearbtn:
|
||||
; Clear all text fields
|
||||
ReadINIStr $1 "$PLUGINSDIR\test.ini" "Field 5" "HWND"
|
||||
SendMessage $1 ${WM_SETTEXT} 0 "STR:"
|
||||
ReadINIStr $1 "$PLUGINSDIR\test.ini" "Field 6" "HWND"
|
||||
SendMessage $1 ${WM_SETTEXT} 0 "STR:"
|
||||
ReadINIStr $1 "$PLUGINSDIR\test.ini" "Field 8" "HWND"
|
||||
SendMessage $1 ${WM_SETTEXT} 0 "STR:"
|
||||
Abort ; Return to the page
|
||||
|
||||
droplist:
|
||||
; Make the DirRequest field depend on the droplist
|
||||
ReadINIStr $0 "$PLUGINSDIR\test.ini" "Field 11" "State"
|
||||
StrCmp $0 "Show" +3
|
||||
StrCpy $0 0
|
||||
Goto +2
|
||||
StrCpy $0 1
|
||||
ReadINIStr $1 "$PLUGINSDIR\test.ini" "Field 6" "HWND"
|
||||
EnableWindow $1 $0
|
||||
ReadINIStr $1 "$PLUGINSDIR\test.ini" "Field 6" "HWND2"
|
||||
EnableWindow $1 $0
|
||||
; Add the disabled flag too so when we return to this page it's disabled again
|
||||
StrCmp $0 0 0 +3
|
||||
|
||||
WriteINIStr "$PLUGINSDIR\test.ini" "Field 6" "Flags" "DISABLED"
|
||||
Goto +2
|
||||
|
||||
WriteINIStr "$PLUGINSDIR\test.ini" "Field 6" "Flags" ""
|
||||
Abort ; Return to the page
|
||||
|
||||
validate:
|
||||
; At this point we know the Next button was pressed, so perform any validation
|
||||
ReadINIStr $0 "$PLUGINSDIR\test.ini" "Field 2" "State"
|
||||
StrCmp $0 1 done
|
||||
ReadINIStr $0 "$PLUGINSDIR\test.ini" "Field 3" "State"
|
||||
StrCmp $0 1 done
|
||||
ReadINIStr $0 "$PLUGINSDIR\test.ini" "Field 4" "State"
|
||||
StrCmp $0 1 done
|
||||
MessageBox MB_ICONEXCLAMATION|MB_OK "You must select at least one install option!"
|
||||
Abort
|
||||
done:
|
||||
|
||||
FunctionEnd
|
||||
|
||||
; Installation page
|
||||
Page instfiles
|
||||
|
||||
Section
|
||||
|
||||
;Get Install Options dialog user input
|
||||
ReadINIStr $0 "$PLUGINSDIR\test.ini" "Field 2" "State"
|
||||
DetailPrint "Install X=$0"
|
||||
ReadINIStr $0 "$PLUGINSDIR\test.ini" "Field 3" "State"
|
||||
DetailPrint "Install Y=$0"
|
||||
ReadINIStr $0 "$PLUGINSDIR\test.ini" "Field 4" "State"
|
||||
DetailPrint "Install Z=$0"
|
||||
ReadINIStr $0 "$PLUGINSDIR\test.ini" "Field 5" "State"
|
||||
DetailPrint "File=$0"
|
||||
ReadINIStr $0 "$PLUGINSDIR\test.ini" "Field 6" "State"
|
||||
DetailPrint "Dir=$0"
|
||||
ReadINIStr $0 "$PLUGINSDIR\test.ini" "Field 8" "State"
|
||||
DetailPrint "Info=$0"
|
||||
|
||||
SectionEnd
|
130
KattekerCreator/nsis/Examples/Library.nsi
Normal file
130
KattekerCreator/nsis/Examples/Library.nsi
Normal file
@ -0,0 +1,130 @@
|
||||
# This example tests the compile time aspect of the Library macros
|
||||
# more than the runtime aspect. It is more of a syntax example,
|
||||
# rather than a usage example.
|
||||
|
||||
!include "Library.nsh"
|
||||
|
||||
Name "Library Test"
|
||||
OutFile "Library Test.exe"
|
||||
|
||||
InstallDir "$TEMP\Library Test"
|
||||
|
||||
Page directory
|
||||
Page instfiles
|
||||
|
||||
XPStyle on
|
||||
|
||||
RequestExecutionLevel user
|
||||
|
||||
|
||||
!define TestDLL '"${NSISDIR}\Plugins\${NSIS_CPU}-unicode\LangDLL.dll"'
|
||||
!define TestEXE '"${NSISDIR}\Contrib\UIs\default.exe"'
|
||||
|
||||
Section
|
||||
|
||||
!insertmacro InstallLib DLL NOTSHARED REBOOT_PROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
||||
!insertmacro InstallLib DLL NOTSHARED NOREBOOT_PROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
||||
!insertmacro InstallLib DLL NOTSHARED REBOOT_NOTPROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
||||
!insertmacro InstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
||||
|
||||
!insertmacro InstallLib REGDLL NOTSHARED REBOOT_PROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
||||
!insertmacro InstallLib REGDLL NOTSHARED NOREBOOT_PROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
||||
!insertmacro InstallLib REGDLL NOTSHARED REBOOT_NOTPROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
||||
!insertmacro InstallLib REGDLL NOTSHARED NOREBOOT_NOTPROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
||||
|
||||
!insertmacro InstallLib TLB NOTSHARED REBOOT_PROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
||||
!insertmacro InstallLib TLB NOTSHARED NOREBOOT_PROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
||||
!insertmacro InstallLib TLB NOTSHARED REBOOT_NOTPROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
||||
!insertmacro InstallLib TLB NOTSHARED NOREBOOT_NOTPROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
||||
|
||||
!insertmacro InstallLib REGDLLTLB NOTSHARED REBOOT_PROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
||||
!insertmacro InstallLib REGDLLTLB NOTSHARED NOREBOOT_PROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
||||
!insertmacro InstallLib REGDLLTLB NOTSHARED REBOOT_NOTPROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
||||
!insertmacro InstallLib REGDLLTLB NOTSHARED NOREBOOT_NOTPROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
||||
|
||||
!insertmacro InstallLib DLL $0 REBOOT_PROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
||||
!insertmacro InstallLib DLL $0 NOREBOOT_PROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
||||
!insertmacro InstallLib DLL $0 REBOOT_NOTPROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
||||
!insertmacro InstallLib DLL $0 NOREBOOT_NOTPROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
||||
|
||||
!insertmacro InstallLib REGDLL $0 REBOOT_PROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
||||
!insertmacro InstallLib REGDLL $0 NOREBOOT_PROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
||||
!insertmacro InstallLib REGDLL $0 REBOOT_NOTPROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
||||
!insertmacro InstallLib REGDLL $0 NOREBOOT_NOTPROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
||||
|
||||
!insertmacro InstallLib TLB $0 REBOOT_PROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
||||
!insertmacro InstallLib TLB $0 NOREBOOT_PROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
||||
!insertmacro InstallLib TLB $0 REBOOT_NOTPROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
||||
!insertmacro InstallLib TLB $0 NOREBOOT_NOTPROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
||||
|
||||
!insertmacro InstallLib REGDLLTLB $0 REBOOT_PROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
||||
!insertmacro InstallLib REGDLLTLB $0 NOREBOOT_PROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
||||
!insertmacro InstallLib REGDLLTLB $0 REBOOT_NOTPROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
||||
!insertmacro InstallLib REGDLLTLB $0 NOREBOOT_NOTPROTECTED ${TestDLL} $INSTDIR\test.dll $INSTDIR
|
||||
|
||||
!insertmacro InstallLib REGEXE $0 REBOOT_PROTECTED ${TestEXE} $INSTDIR\test.exe $INSTDIR
|
||||
!insertmacro InstallLib REGEXE $0 NOREBOOT_PROTECTED ${TestEXE} $INSTDIR\test.exe $INSTDIR
|
||||
!insertmacro InstallLib REGEXE $0 REBOOT_NOTPROTECTED ${TestEXE} $INSTDIR\test.exe $INSTDIR
|
||||
!insertmacro InstallLib REGEXE $0 NOREBOOT_NOTPROTECTED ${TestEXE} $INSTDIR\test.exe $INSTDIR
|
||||
|
||||
WriteUninstaller $INSTDIR\uninstall.exe
|
||||
|
||||
SectionEnd
|
||||
|
||||
Section uninstall
|
||||
|
||||
!insertmacro UninstallLib DLL NOTSHARED NOREMOVE $INSTDIR\test.dll
|
||||
!insertmacro UninstallLib DLL NOTSHARED REBOOT_PROTECTED $INSTDIR\test.dll
|
||||
!insertmacro UninstallLib DLL NOTSHARED NOREBOOT_PROTECTED $INSTDIR\test.dll
|
||||
!insertmacro UninstallLib DLL NOTSHARED REBOOT_NOTPROTECTED $INSTDIR\test.dll
|
||||
!insertmacro UninstallLib DLL NOTSHARED NOREBOOT_NOTPROTECTED $INSTDIR\test.dll
|
||||
|
||||
!insertmacro UninstallLib REGDLL NOTSHARED NOREMOVE $INSTDIR\test.dll
|
||||
!insertmacro UninstallLib REGDLL NOTSHARED REBOOT_PROTECTED $INSTDIR\test.dll
|
||||
!insertmacro UninstallLib REGDLL NOTSHARED NOREBOOT_PROTECTED $INSTDIR\test.dll
|
||||
!insertmacro UninstallLib REGDLL NOTSHARED REBOOT_NOTPROTECTED $INSTDIR\test.dll
|
||||
!insertmacro UninstallLib REGDLL NOTSHARED NOREBOOT_NOTPROTECTED $INSTDIR\test.dll
|
||||
|
||||
!insertmacro UninstallLib TLB NOTSHARED NOREMOVE $INSTDIR\test.dll
|
||||
!insertmacro UninstallLib TLB NOTSHARED REBOOT_PROTECTED $INSTDIR\test.dll
|
||||
!insertmacro UninstallLib TLB NOTSHARED NOREBOOT_PROTECTED $INSTDIR\test.dll
|
||||
!insertmacro UninstallLib TLB NOTSHARED REBOOT_NOTPROTECTED $INSTDIR\test.dll
|
||||
!insertmacro UninstallLib TLB NOTSHARED NOREBOOT_NOTPROTECTED $INSTDIR\test.dll
|
||||
|
||||
!insertmacro UninstallLib REGDLLTLB NOTSHARED NOREMOVE $INSTDIR\test.dll
|
||||
!insertmacro UninstallLib REGDLLTLB NOTSHARED REBOOT_PROTECTED $INSTDIR\test.dll
|
||||
!insertmacro UninstallLib REGDLLTLB NOTSHARED NOREBOOT_PROTECTED $INSTDIR\test.dll
|
||||
!insertmacro UninstallLib REGDLLTLB NOTSHARED REBOOT_NOTPROTECTED $INSTDIR\test.dll
|
||||
!insertmacro UninstallLib REGDLLTLB NOTSHARED NOREBOOT_NOTPROTECTED $INSTDIR\test.dll
|
||||
|
||||
!insertmacro UninstallLib DLL SHARED NOREMOVE $INSTDIR\test.dll
|
||||
!insertmacro UninstallLib DLL SHARED REBOOT_PROTECTED $INSTDIR\test.dll
|
||||
!insertmacro UninstallLib DLL SHARED NOREBOOT_PROTECTED $INSTDIR\test.dll
|
||||
!insertmacro UninstallLib DLL SHARED REBOOT_NOTPROTECTED $INSTDIR\test.dll
|
||||
!insertmacro UninstallLib DLL SHARED NOREBOOT_NOTPROTECTED $INSTDIR\test.dll
|
||||
|
||||
!insertmacro UninstallLib REGDLL SHARED NOREMOVE $INSTDIR\test.dll
|
||||
!insertmacro UninstallLib REGDLL SHARED REBOOT_PROTECTED $INSTDIR\test.dll
|
||||
!insertmacro UninstallLib REGDLL SHARED NOREBOOT_PROTECTED $INSTDIR\test.dll
|
||||
!insertmacro UninstallLib REGDLL SHARED REBOOT_NOTPROTECTED $INSTDIR\test.dll
|
||||
!insertmacro UninstallLib REGDLL SHARED NOREBOOT_NOTPROTECTED $INSTDIR\test.dll
|
||||
|
||||
!insertmacro UninstallLib TLB SHARED NOREMOVE $INSTDIR\test.dll
|
||||
!insertmacro UninstallLib TLB SHARED REBOOT_PROTECTED $INSTDIR\test.dll
|
||||
!insertmacro UninstallLib TLB SHARED NOREBOOT_PROTECTED $INSTDIR\test.dll
|
||||
!insertmacro UninstallLib TLB SHARED REBOOT_NOTPROTECTED $INSTDIR\test.dll
|
||||
!insertmacro UninstallLib TLB SHARED NOREBOOT_NOTPROTECTED $INSTDIR\test.dll
|
||||
|
||||
!insertmacro UninstallLib REGDLLTLB SHARED NOREMOVE $INSTDIR\test.dll
|
||||
!insertmacro UninstallLib REGDLLTLB SHARED REBOOT_PROTECTED $INSTDIR\test.dll
|
||||
!insertmacro UninstallLib REGDLLTLB SHARED NOREBOOT_PROTECTED $INSTDIR\test.dll
|
||||
!insertmacro UninstallLib REGDLLTLB SHARED REBOOT_NOTPROTECTED $INSTDIR\test.dll
|
||||
!insertmacro UninstallLib REGDLLTLB SHARED NOREBOOT_NOTPROTECTED $INSTDIR\test.dll
|
||||
|
||||
!insertmacro UninstallLib REGEXE SHARED NOREMOVE $INSTDIR\test.exe
|
||||
!insertmacro UninstallLib REGEXE SHARED REBOOT_PROTECTED $INSTDIR\test.exe
|
||||
!insertmacro UninstallLib REGEXE SHARED NOREBOOT_PROTECTED $INSTDIR\test.exe
|
||||
!insertmacro UninstallLib REGEXE SHARED REBOOT_NOTPROTECTED $INSTDIR\test.exe
|
||||
!insertmacro UninstallLib REGEXE SHARED NOREBOOT_NOTPROTECTED $INSTDIR\test.exe
|
||||
|
||||
SectionEnd
|
619
KattekerCreator/nsis/Examples/LogicLib.nsi
Normal file
619
KattekerCreator/nsis/Examples/LogicLib.nsi
Normal file
@ -0,0 +1,619 @@
|
||||
!verbose 2
|
||||
|
||||
Name "NSIS LogicLib Example"
|
||||
OutFile "LogicLib.exe"
|
||||
ShowInstDetails show
|
||||
RequestExecutionLevel user
|
||||
|
||||
!include "LogicLib.nsh"
|
||||
|
||||
;!undef LOGICLIB_VERBOSITY
|
||||
;!define LOGICLIB_VERBOSITY 4 ; For debugging - watch what logiclib does with your code!
|
||||
|
||||
Page components "" "" ComponentsLeave
|
||||
Page instfiles
|
||||
|
||||
Section /o "Run tests" TESTS
|
||||
|
||||
; kinds of if other than "value1 comparison value2"
|
||||
ClearErrors
|
||||
FindFirst $R1 $R2 "$PROGRAMFILES\*"
|
||||
${Unless} ${Errors}
|
||||
${Do}
|
||||
${Select} $R2
|
||||
${Case2} "." ".."
|
||||
; Do nothing
|
||||
${CaseElse}
|
||||
DetailPrint "Found $PROGRAMFILES\$R2"
|
||||
${EndSelect}
|
||||
FindNext $R1 $R2
|
||||
${LoopUntil} ${Errors}
|
||||
FindClose $R1
|
||||
${EndUnless}
|
||||
|
||||
${If} ${FileExists} "${__FILE__}"
|
||||
DetailPrint 'Source file "${__FILE__}" still exists'
|
||||
${Else}
|
||||
DetailPrint 'Source file "${__FILE__}" has gone'
|
||||
${EndIf}
|
||||
|
||||
; if..endif
|
||||
StrCpy $R1 1
|
||||
StrCpy $R2 ""
|
||||
${If} $R1 = 1
|
||||
StrCpy $R2 $R2A
|
||||
${EndIf}
|
||||
${If} $R1 = 2
|
||||
StrCpy $R2 $R2B
|
||||
${EndIf}
|
||||
${If} $R1 < 2
|
||||
StrCpy $R2 $R2C
|
||||
${EndIf}
|
||||
${If} $R1 < -2
|
||||
StrCpy $R2 $R2D
|
||||
${EndIf}
|
||||
${If} $R1 > 2
|
||||
StrCpy $R2 $R2E
|
||||
${EndIf}
|
||||
${If} $R1 > -2
|
||||
StrCpy $R2 $R2F
|
||||
${EndIf}
|
||||
${If} $R1 <> 1
|
||||
StrCpy $R2 $R2G
|
||||
${EndIf}
|
||||
${If} $R1 <> 2
|
||||
StrCpy $R2 $R2H
|
||||
${EndIf}
|
||||
${If} $R1 >= 2
|
||||
StrCpy $R2 $R2I
|
||||
${EndIf}
|
||||
${If} $R1 >= -2
|
||||
StrCpy $R2 $R2J
|
||||
${EndIf}
|
||||
${If} $R1 <= 2
|
||||
StrCpy $R2 $R2K
|
||||
${EndIf}
|
||||
${If} $R1 <= -2
|
||||
StrCpy $R2 $R2L
|
||||
${EndIf}
|
||||
${If} $R2 == "ACFHJK"
|
||||
DetailPrint "PASSED If..EndIf test"
|
||||
${Else}
|
||||
DetailPrint "FAILED If..EndIf test"
|
||||
${EndIf}
|
||||
|
||||
; if..elseif..else..endif
|
||||
StrCpy $R1 A
|
||||
StrCpy $R2 ""
|
||||
${If} $R1 == A
|
||||
StrCpy $R2 $R2A
|
||||
${ElseIf} $R1 == B
|
||||
StrCpy $R2 $R2B
|
||||
${ElseUnless} $R1 != C
|
||||
StrCpy $R2 $R2C
|
||||
${Else}
|
||||
StrCpy $R2 $R2D
|
||||
${EndIf}
|
||||
${If} $R1 == D
|
||||
StrCpy $R2 $R2D
|
||||
${ElseIf} $R1 == A
|
||||
StrCpy $R2 $R2A
|
||||
${ElseUnless} $R1 != B
|
||||
StrCpy $R2 $R2B
|
||||
${Else}
|
||||
StrCpy $R2 $R2C
|
||||
${EndIf}
|
||||
${If} $R1 == C
|
||||
StrCpy $R2 $R2C
|
||||
${ElseIf} $R1 == D
|
||||
StrCpy $R2 $R2D
|
||||
${ElseUnless} $R1 != A
|
||||
StrCpy $R2 $R2A
|
||||
${Else}
|
||||
StrCpy $R2 $R2B
|
||||
${EndIf}
|
||||
${If} $R1 == B
|
||||
StrCpy $R2 $R2B
|
||||
${ElseIf} $R1 == C
|
||||
StrCpy $R2 $R2C
|
||||
${ElseUnless} $R1 != D
|
||||
StrCpy $R2 $R2D
|
||||
${Else}
|
||||
StrCpy $R2 $R2A
|
||||
${EndIf}
|
||||
${If} $R2 == "$R1$R1$R1$R1"
|
||||
DetailPrint "PASSED If..ElseIf..Else..EndIf test"
|
||||
${Else}
|
||||
DetailPrint "FAILED If..ElseIf..Else..EndIf test"
|
||||
${EndIf}
|
||||
|
||||
; if..andif..orif..endif
|
||||
StrCpy $R2 ""
|
||||
${If} 1 = 1
|
||||
${AndIf} 2 = 2
|
||||
StrCpy $R2 $R2A
|
||||
${Else}
|
||||
StrCpy $R2 $R2B
|
||||
${EndIf}
|
||||
${If} 1 = 1
|
||||
${AndIf} 2 = 3
|
||||
StrCpy $R2 $R2B
|
||||
${Else}
|
||||
StrCpy $R2 $R2A
|
||||
${EndIf}
|
||||
${If} 1 = 2
|
||||
${AndIf} 2 = 2
|
||||
StrCpy $R2 $R2B
|
||||
${Else}
|
||||
StrCpy $R2 $R2A
|
||||
${EndIf}
|
||||
${If} 1 = 2
|
||||
${AndIf} 2 = 3
|
||||
StrCpy $R2 $R2B
|
||||
${Else}
|
||||
StrCpy $R2 $R2A
|
||||
${EndIf}
|
||||
|
||||
${If} 1 = 1
|
||||
${OrIf} 2 = 2
|
||||
StrCpy $R2 $R2A
|
||||
${Else}
|
||||
StrCpy $R2 $R2B
|
||||
${EndIf}
|
||||
${If} 1 = 1
|
||||
${OrIf} 2 = 3
|
||||
StrCpy $R2 $R2A
|
||||
${Else}
|
||||
StrCpy $R2 $R2B
|
||||
${EndIf}
|
||||
${If} 1 = 2
|
||||
${OrIf} 2 = 2
|
||||
StrCpy $R2 $R2A
|
||||
${Else}
|
||||
StrCpy $R2 $R2B
|
||||
${EndIf}
|
||||
${If} 1 = 2
|
||||
${OrIf} 2 = 3
|
||||
StrCpy $R2 $R2B
|
||||
${Else}
|
||||
StrCpy $R2 $R2A
|
||||
${EndIf}
|
||||
|
||||
${If} 1 = 1
|
||||
${AndIf} 2 = 2
|
||||
${OrIf} 3 = 3
|
||||
StrCpy $R2 $R2A
|
||||
${Else}
|
||||
StrCpy $R2 $R2B
|
||||
${EndIf}
|
||||
${If} 1 = 1
|
||||
${AndIf} 2 = 3
|
||||
${OrIf} 3 = 3
|
||||
StrCpy $R2 $R2A
|
||||
${Else}
|
||||
StrCpy $R2 $R2B
|
||||
${EndIf}
|
||||
${If} 1 = 2
|
||||
${AndIf} 2 = 2
|
||||
${OrIf} 3 = 3
|
||||
StrCpy $R2 $R2A
|
||||
${Else}
|
||||
StrCpy $R2 $R2B
|
||||
${EndIf}
|
||||
${If} 1 = 2
|
||||
${AndIf} 2 = 3
|
||||
${OrIf} 3 = 3
|
||||
StrCpy $R2 $R2A
|
||||
${Else}
|
||||
StrCpy $R2 $R2B
|
||||
${EndIf}
|
||||
${If} 1 = 1
|
||||
${AndIf} 2 = 2
|
||||
${OrIf} 3 = 4
|
||||
StrCpy $R2 $R2A
|
||||
${Else}
|
||||
StrCpy $R2 $R2B
|
||||
${EndIf}
|
||||
${If} 1 = 1
|
||||
${AndIf} 2 = 3
|
||||
${OrIf} 3 = 4
|
||||
StrCpy $R2 $R2B
|
||||
${Else}
|
||||
StrCpy $R2 $R2A
|
||||
${EndIf}
|
||||
${If} 1 = 2
|
||||
${AndIf} 2 = 2
|
||||
${OrIf} 3 = 4
|
||||
StrCpy $R2 $R2B
|
||||
${Else}
|
||||
StrCpy $R2 $R2A
|
||||
${EndIf}
|
||||
${If} 1 = 2
|
||||
${AndIf} 2 = 3
|
||||
${OrIf} 3 = 4
|
||||
StrCpy $R2 $R2B
|
||||
${Else}
|
||||
StrCpy $R2 $R2A
|
||||
${EndIf}
|
||||
|
||||
${If} 1 = 1
|
||||
${OrIf} 2 = 2
|
||||
${AndIf} 3 = 3
|
||||
StrCpy $R2 $R2A
|
||||
${Else}
|
||||
StrCpy $R2 $R2B
|
||||
${EndIf}
|
||||
${If} 1 = 1
|
||||
${OrIf} 2 = 3
|
||||
${AndIf} 3 = 3
|
||||
StrCpy $R2 $R2A
|
||||
${Else}
|
||||
StrCpy $R2 $R2B
|
||||
${EndIf}
|
||||
${If} 1 = 2
|
||||
${OrIf} 2 = 2
|
||||
${AndIf} 3 = 3
|
||||
StrCpy $R2 $R2A
|
||||
${Else}
|
||||
StrCpy $R2 $R2B
|
||||
${EndIf}
|
||||
${If} 1 = 2
|
||||
${OrIf} 2 = 3
|
||||
${AndIf} 3 = 3
|
||||
StrCpy $R2 $R2B
|
||||
${Else}
|
||||
StrCpy $R2 $R2A
|
||||
${EndIf}
|
||||
${If} 1 = 1
|
||||
${OrIf} 2 = 2
|
||||
${AndIf} 3 = 4
|
||||
StrCpy $R2 $R2B
|
||||
${Else}
|
||||
StrCpy $R2 $R2A
|
||||
${EndIf}
|
||||
${If} 1 = 1
|
||||
${OrIf} 2 = 3
|
||||
${AndIf} 3 = 4
|
||||
StrCpy $R2 $R2B
|
||||
${Else}
|
||||
StrCpy $R2 $R2A
|
||||
${EndIf}
|
||||
${If} 1 = 2
|
||||
${OrIf} 2 = 2
|
||||
${AndIf} 3 = 4
|
||||
StrCpy $R2 $R2B
|
||||
${Else}
|
||||
StrCpy $R2 $R2A
|
||||
${EndIf}
|
||||
${If} 1 = 2
|
||||
${OrIf} 2 = 3
|
||||
${AndIf} 3 = 4
|
||||
StrCpy $R2 $R2B
|
||||
${Else}
|
||||
StrCpy $R2 $R2A
|
||||
${EndIf}
|
||||
|
||||
${If} $R2 == "AAAAAAAAAAAAAAAAAAAAAAAA"
|
||||
DetailPrint "PASSED If..AndIf..OrIf..Else..EndIf test"
|
||||
${Else}
|
||||
DetailPrint "FAILED If..AndIf..OrIf..Else..EndIf test"
|
||||
${EndIf}
|
||||
|
||||
; ifthen..|..|
|
||||
StrCpy $R1 1
|
||||
StrCpy $R2 ""
|
||||
${IfThen} $R1 = 1 ${|} StrCpy $R2 $R2A ${|}
|
||||
${IfThen} $R1 = 2 ${|} StrCpy $R2 $R2B ${|}
|
||||
${IfNotThen} $R1 = 1 ${|} StrCpy $R2 $R2C ${|}
|
||||
${IfNotThen} $R1 = 2 ${|} StrCpy $R2 $R2D ${|}
|
||||
${If} $R2 == "AD"
|
||||
DetailPrint "PASSED IfThen test"
|
||||
${Else}
|
||||
DetailPrint "FAILED IfThen test"
|
||||
${EndIf}
|
||||
|
||||
; ifcmd..||..| and if/unless cmd
|
||||
StrCpy $R2 ""
|
||||
${IfCmd} MessageBox MB_YESNO "Please click Yes" IDYES ${||} StrCpy $R2 $R2A ${|}
|
||||
${Unless} ${Cmd} `MessageBox MB_YESNO|MB_DEFBUTTON2 "Please click No" IDYES`
|
||||
StrCpy $R2 $R2B
|
||||
${EndUnless}
|
||||
${If} $R2 == "AB"
|
||||
DetailPrint "PASSED IfCmd/If Cmd test"
|
||||
${Else}
|
||||
DetailPrint "FAILED IfCmd/If Cmd test"
|
||||
${EndIf}
|
||||
|
||||
; select..case..case2..case3..case4..case5..caseelse..endselect
|
||||
StrCpy $R1 1
|
||||
StrCpy $R2 ""
|
||||
${Select} $R1
|
||||
${Case} "1"
|
||||
StrCpy $R2 $R2A
|
||||
${Case} "2"
|
||||
StrCpy $R2 $R2B
|
||||
${Case2} "3" "4"
|
||||
StrCpy $R2 $R2C
|
||||
${CaseElse}
|
||||
StrCpy $R2 $R2D
|
||||
${EndSelect}
|
||||
${Select} $R1
|
||||
${Case} "2"
|
||||
StrCpy $R2 $R2A
|
||||
${Case} "3"
|
||||
StrCpy $R2 $R2B
|
||||
${Case2} "4" "5"
|
||||
StrCpy $R2 $R2C
|
||||
${CaseElse}
|
||||
StrCpy $R2 $R2D
|
||||
${EndSelect}
|
||||
${Select} $R1
|
||||
${Case} "3"
|
||||
StrCpy $R2 $R2A
|
||||
${Case} "4"
|
||||
StrCpy $R2 $R2B
|
||||
${Case2} "5" "1"
|
||||
StrCpy $R2 $R2C
|
||||
${CaseElse}
|
||||
StrCpy $R2 $R2D
|
||||
${EndSelect}
|
||||
${Select} $R1
|
||||
${Case} "4"
|
||||
StrCpy $R2 $R2A
|
||||
${Case} "5"
|
||||
StrCpy $R2 $R2B
|
||||
${Case2} "1" "2"
|
||||
StrCpy $R2 $R2C
|
||||
${CaseElse}
|
||||
StrCpy $R2 $R2D
|
||||
${EndSelect}
|
||||
${If} $R2 == "ADCC"
|
||||
DetailPrint "PASSED Select..Case*..EndSelect test"
|
||||
${Else}
|
||||
DetailPrint "FAILED Select..Case*..EndSelect test"
|
||||
${EndIf}
|
||||
|
||||
; switch..case..caseelse..endswitch
|
||||
StrCpy $R2 ""
|
||||
${For} $R1 1 10
|
||||
${Switch} $R1
|
||||
${Case} 3
|
||||
StrCpy $R2 $R2A
|
||||
${Case} 4
|
||||
StrCpy $R2 $R2B
|
||||
${Break}
|
||||
${Case} 5
|
||||
StrCpy $R2 $R2C
|
||||
${EndSwitch}
|
||||
${Switch} $R1
|
||||
${Case} 1
|
||||
StrCpy $R2 $R2D
|
||||
${Default}
|
||||
StrCpy $R2 $R2E
|
||||
${Break}
|
||||
${Case} 2
|
||||
StrCpy $R2 $R2F
|
||||
${EndSwitch}
|
||||
${Switch} $R1
|
||||
${Case} 6
|
||||
${Case} 7
|
||||
StrCpy $R2 $R2G
|
||||
${If} $R1 = 6
|
||||
${Case} 8
|
||||
StrCpy $R2 $R2H
|
||||
${Switch} $R1
|
||||
${Case} 6
|
||||
StrCpy $R2 $R2I
|
||||
${Break}
|
||||
${Case} 8
|
||||
StrCpy $R2 $R2J
|
||||
${EndSwitch}
|
||||
${EndIf}
|
||||
StrCpy $R2 $R2K
|
||||
${Break}
|
||||
${Default}
|
||||
StrCpy $R2 $R2L
|
||||
${Case} 9
|
||||
StrCpy $R2 $R2M
|
||||
${EndSwitch}
|
||||
${Next}
|
||||
${If} $R2 == "DELMFLMABELMBELMCELMEGHIKEGKEHJKEMELM"
|
||||
DetailPrint "PASSED Switch..Case*..EndSwitch test"
|
||||
${Else}
|
||||
DetailPrint "FAILED Switch..Case*..EndSwitch test"
|
||||
${EndIf}
|
||||
|
||||
; for[each]..exitfor..next
|
||||
StrCpy $R2 ""
|
||||
${For} $R1 1 5
|
||||
StrCpy $R2 $R2$R1
|
||||
${Next}
|
||||
${ForEach} $R1 10 1 - 1
|
||||
StrCpy $R2 $R2$R1
|
||||
${Next}
|
||||
${For} $R1 1 0
|
||||
StrCpy $R2 $R2$R1
|
||||
${Next}
|
||||
${If} $R2 == "1234510987654321"
|
||||
DetailPrint "PASSED For[Each]..Next test"
|
||||
${Else}
|
||||
DetailPrint "FAILED For[Each]..Next test"
|
||||
${EndIf}
|
||||
|
||||
; do..loop
|
||||
StrCpy $R1 0
|
||||
Call DoLoop
|
||||
${If} $R1 == 5
|
||||
DetailPrint "PASSED Do..Loop test"
|
||||
${Else}
|
||||
DetailPrint "FAILED Do..Loop test"
|
||||
${EndIf}
|
||||
|
||||
; do..exitdo..loop
|
||||
StrCpy $R1 0
|
||||
StrCpy $R2 ""
|
||||
${Do}
|
||||
StrCpy $R2 $R2$R1
|
||||
IntOp $R1 $R1 + 1
|
||||
${If} $R1 > 10
|
||||
${ExitDo}
|
||||
${EndIf}
|
||||
${Loop}
|
||||
${If} $R2 == "012345678910"
|
||||
DetailPrint "PASSED Do..ExitDo..Loop test"
|
||||
${Else}
|
||||
DetailPrint "FAILED Do..ExitDo..Loop test"
|
||||
${EndIf}
|
||||
|
||||
; do..exitdo..loopuntil
|
||||
StrCpy $R1 0
|
||||
StrCpy $R2 ""
|
||||
${Do}
|
||||
StrCpy $R2 $R2$R1
|
||||
IntOp $R1 $R1 + 1
|
||||
${LoopUntil} $R1 >= 5
|
||||
${If} $R2 == "01234"
|
||||
DetailPrint "PASSED Do..ExitDo..LoopUntil test"
|
||||
${Else}
|
||||
DetailPrint "FAILED Do..ExitDo..LoopUntil test"
|
||||
${EndIf}
|
||||
|
||||
; dountil..exitdo..loop
|
||||
StrCpy $R1 0
|
||||
StrCpy $R2 ""
|
||||
${DoUntil} $R1 >= 5
|
||||
StrCpy $R2 $R2$R1
|
||||
IntOp $R1 $R1 + 1
|
||||
${Loop}
|
||||
${If} $R2 == "01234"
|
||||
DetailPrint "PASSED DoUntil..ExitDo..Loop test"
|
||||
${Else}
|
||||
DetailPrint "FAILED DoUntil..ExitDo..Loop test"
|
||||
${EndIf}
|
||||
|
||||
; nested do test
|
||||
StrCpy $R1 0
|
||||
StrCpy $R2 0
|
||||
StrCpy $R3 ""
|
||||
${Do}
|
||||
StrCpy $R3 $R3$R1$R2
|
||||
IntOp $R1 $R1 + 1
|
||||
${If} $R1 > 5
|
||||
${ExitDo}
|
||||
${EndIf}
|
||||
StrCpy $R2 0
|
||||
${Do}
|
||||
StrCpy $R3 $R3$R1$R2
|
||||
IntOp $R2 $R2 + 1
|
||||
${If} $R2 >= 5
|
||||
${ExitDo}
|
||||
${EndIf}
|
||||
${Loop}
|
||||
${Loop}
|
||||
${If} $R3 == "00101112131415202122232425303132333435404142434445505152535455"
|
||||
DetailPrint "PASSED nested Do test"
|
||||
${Else}
|
||||
DetailPrint "FAILED nested Do test"
|
||||
${EndIf}
|
||||
|
||||
; while..exitwhile..endwhile (exact replica of dowhile..enddo}
|
||||
StrCpy $R1 0
|
||||
StrCpy $R2 ""
|
||||
${While} $R1 < 5
|
||||
StrCpy $R2 $R2$R1
|
||||
IntOp $R1 $R1 + 1
|
||||
${EndWhile}
|
||||
${If} $R2 == "01234"
|
||||
DetailPrint "PASSED While..ExitWhile..EndWhile test"
|
||||
${Else}
|
||||
DetailPrint "FAILED While..ExitWhile..EndWhile test"
|
||||
${EndIf}
|
||||
|
||||
; Unsigned integer tests
|
||||
StrCpy $R2 ""
|
||||
${If} -1 < 1
|
||||
StrCpy $R2 $R2A
|
||||
${EndIf}
|
||||
${If} -1 U< 1
|
||||
StrCpy $R2 $R2B
|
||||
${EndIf}
|
||||
${If} 0xFFFFFFFF > 1
|
||||
StrCpy $R2 $R2C
|
||||
${EndIf}
|
||||
${If} 0xFFFFFFFF U> 1
|
||||
StrCpy $R2 $R2D
|
||||
${EndIf}
|
||||
${If} $R2 == "AD"
|
||||
DetailPrint "PASSED unsigned integer test"
|
||||
${Else}
|
||||
DetailPrint "FAILED unsigned integer test"
|
||||
${EndIf}
|
||||
|
||||
; 64-bit integer tests (uses System.dll)
|
||||
StrCpy $R2 ""
|
||||
${If} 0x100000000 L= 4294967296
|
||||
StrCpy $R2 $R2A
|
||||
${EndIf}
|
||||
${If} 0x100000000 L< 0x200000000
|
||||
StrCpy $R2 $R2B
|
||||
${EndIf}
|
||||
${If} 0x500000000 L>= 0x500000000
|
||||
StrCpy $R2 $R2C
|
||||
${EndIf}
|
||||
${If} $R2 == "ABC"
|
||||
DetailPrint "PASSED 64-bit integer test"
|
||||
${Else}
|
||||
DetailPrint "FAILED 64-bit integer test"
|
||||
${EndIf}
|
||||
|
||||
; Extra string tests (uses System.dll)
|
||||
StrCpy $R2 ""
|
||||
${If} "A" S< "B"
|
||||
StrCpy $R2 $R2A
|
||||
${EndIf}
|
||||
${If} "b" S> "A"
|
||||
StrCpy $R2 $R2B
|
||||
${EndIf}
|
||||
${If} "a" S<= "B"
|
||||
StrCpy $R2 $R2C
|
||||
${EndIf}
|
||||
${If} "B" S< "B"
|
||||
StrCpy $R2 $R2D
|
||||
${EndIf}
|
||||
${If} "A" S== "A"
|
||||
StrCpy $R2 $R2E
|
||||
${EndIf}
|
||||
${If} "A" S== "a"
|
||||
StrCpy $R2 $R2F
|
||||
${EndIf}
|
||||
${If} "A" S!= "a"
|
||||
StrCpy $R2 $R2G
|
||||
${EndIf}
|
||||
${If} $R2 == "ABCEG"
|
||||
DetailPrint "PASSED extra string test"
|
||||
${Else}
|
||||
DetailPrint "FAILED extra string test"
|
||||
${EndIf}
|
||||
|
||||
SectionEnd
|
||||
|
||||
Function ComponentsLeave
|
||||
; Section flags tests (requires sections.nsh be included)
|
||||
${Unless} ${SectionIsSelected} ${TESTS}
|
||||
MessageBox MB_OK "Please select the component"
|
||||
Abort
|
||||
${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
Function DoLoop
|
||||
|
||||
${Do}
|
||||
IntOp $R1 $R1 + 1
|
||||
${If} $R1 == 5
|
||||
Return
|
||||
${EndIf}
|
||||
${Loop}
|
||||
|
||||
FunctionEnd
|
||||
|
||||
!verbose 3
|
33
KattekerCreator/nsis/Examples/Math/math.nsi
Normal file
33
KattekerCreator/nsis/Examples/Math/math.nsi
Normal file
@ -0,0 +1,33 @@
|
||||
; This is just an example of Math plugin
|
||||
;
|
||||
; (c) brainsucker, 2002
|
||||
; (r) BSForce
|
||||
|
||||
Name "Math Plugin Example"
|
||||
OutFile "math.exe"
|
||||
ShowInstDetails show
|
||||
XPStyle on
|
||||
|
||||
Section "ThisNameIsIgnoredSoWhyBother?"
|
||||
Math::Script 'SaR(s,fa,ra, i,f,r,e,p) (i=0;#{i<l(fa),e=l(f=fa[i]);r=ra[i];p=0;#{p<l(s),#[s[p,p+e-1]==f,s=(s[,p-1])+r+(s[p+e,]);p+=l(r), p++]}; i++}; s);'
|
||||
Math::Script "TQ(s) (s = s(NS); #[s[0]=='$\"',s=s[1,]]; #[s[-1]=='$\"',s=s[,-2]]; NS = s)"
|
||||
Math::Script "P(s,e, p,i) (p=-1;i=0; #{(i<l(s))&&(p<0), #[s[i,i+l(e)-1]==e, p=i]; i++}; p)"
|
||||
Math::Script "DL(s) (s=s(NS); p=P(s,'\r\n'); #[p>=0, (NS=s[p+4,]; NS=#[p>0,s[,p-1],'']), (NS='';NS=s)])"
|
||||
|
||||
Math::Script "a = 'Hello \r\n World \r\n!!!'; a = SaR(a,{'\r','\n'},{'$\r','$\n'}); R0 = a"
|
||||
Math::Script "NS = '$\"In quotes$\"'; TQ(); R1=NS; R3=P(s(R1),'qu')"
|
||||
Math::Script "NS = 'No quotes'; TQ(); R2=NS"
|
||||
Math::Script "NS='123\r\n456\r\n789'; DL(); R4=NS; DL(); R5=NS; DL(); R6=NS; R7=NS"
|
||||
|
||||
|
||||
DetailPrint "'$R0'"
|
||||
DetailPrint "'$R1'"
|
||||
DetailPrint "'$R2'"
|
||||
DetailPrint "'$R3'"
|
||||
DetailPrint "'$R4'"
|
||||
DetailPrint "'$R5'"
|
||||
DetailPrint "'$R6'"
|
||||
DetailPrint "'$R7'"
|
||||
SectionEnd
|
||||
|
||||
; eof
|
101
KattekerCreator/nsis/Examples/Math/mathtest.ini
Normal file
101
KattekerCreator/nsis/Examples/Math/mathtest.ini
Normal file
@ -0,0 +1,101 @@
|
||||
[Settings]
|
||||
NumFields=10
|
||||
NextButtonText=Execute
|
||||
CancelButtonText=Quit
|
||||
BackButtonText=Readme
|
||||
|
||||
[Field 1]
|
||||
Type=label
|
||||
Text=Enter your script here:
|
||||
Left=0
|
||||
Right=-1
|
||||
Top=0
|
||||
Bottom=8
|
||||
|
||||
[Field 2]
|
||||
Type=text
|
||||
Left=0
|
||||
Right=-1
|
||||
Top=9
|
||||
Bottom=55
|
||||
flags=MULTILINE|WANTRETURN|HSCROLL
|
||||
State=""
|
||||
|
||||
[Field 3]
|
||||
Type=text
|
||||
Left=53
|
||||
Right=175
|
||||
Top=56
|
||||
Bottom=140
|
||||
flags=MULTILINE|READONLY
|
||||
State=""
|
||||
|
||||
[Field 4]
|
||||
Type=text
|
||||
Left=175
|
||||
Right=-1
|
||||
Top=56
|
||||
Bottom=140
|
||||
flags=MULTILINE|READONLY
|
||||
State=""
|
||||
|
||||
[Field 5]
|
||||
Type=RadioButton
|
||||
Left=0
|
||||
Right=-1
|
||||
Top=70
|
||||
Bottom=80
|
||||
flags=GROUP
|
||||
Text="Your script"
|
||||
State=1
|
||||
|
||||
[Field 6]
|
||||
Type=RadioButton
|
||||
Left=0
|
||||
Right=-1
|
||||
Top=80
|
||||
Bottom=90
|
||||
flags=
|
||||
Text="Sample 1"
|
||||
State=0
|
||||
|
||||
[Field 7]
|
||||
Type=RadioButton
|
||||
Left=0
|
||||
Right=-1
|
||||
Top=90
|
||||
Bottom=100
|
||||
flags=
|
||||
Text="Sample 2"
|
||||
State=0
|
||||
|
||||
[Field 8]
|
||||
Type=RadioButton
|
||||
Left=0
|
||||
Right=-1
|
||||
Top=100
|
||||
Bottom=110
|
||||
flags=
|
||||
Text="Sample 3"
|
||||
State=0
|
||||
|
||||
[Field 9]
|
||||
Type=RadioButton
|
||||
Left=0
|
||||
Right=-1
|
||||
Top=110
|
||||
Bottom=120
|
||||
flags=
|
||||
Text="Sample 4"
|
||||
State=0
|
||||
|
||||
[Field 10]
|
||||
Type=RadioButton
|
||||
Left=0
|
||||
Right=-1
|
||||
Top=120
|
||||
Bottom=130
|
||||
flags=
|
||||
Text="Sample 5"
|
||||
State=0
|
||||
|
171
KattekerCreator/nsis/Examples/Math/mathtest.nsi
Normal file
171
KattekerCreator/nsis/Examples/Math/mathtest.nsi
Normal file
@ -0,0 +1,171 @@
|
||||
;NSIS Modern User Interface version 1.65
|
||||
;InstallOptions Example Script
|
||||
;Written by Joost Verburg
|
||||
|
||||
!define MUI_BUTTONTEXT_NEXT "Execute"
|
||||
|
||||
;---------------------
|
||||
;Include Modern UI
|
||||
|
||||
!include "MUI.nsh"
|
||||
|
||||
;--------------------------------
|
||||
;Product Info
|
||||
|
||||
Name "Math::Script Test"
|
||||
|
||||
;--------------------------------
|
||||
;Configuration
|
||||
|
||||
;General
|
||||
OutFile "MathTest.exe"
|
||||
|
||||
;--------------------------------
|
||||
;Variables
|
||||
|
||||
Var TEMP1
|
||||
Var TEMP2
|
||||
Var TEMP3
|
||||
|
||||
;--------------------------------
|
||||
;Pages
|
||||
|
||||
!insertmacro MUI_PAGE_LICENSE "mathtest.txt"
|
||||
Page custom ScriptPageEnter
|
||||
Page instfiles
|
||||
|
||||
;--------------------------------
|
||||
;Modern UI Configuration
|
||||
|
||||
; !define MUI_ABORTWARNING
|
||||
|
||||
;--------------------------------
|
||||
;Languages
|
||||
|
||||
!insertmacro MUI_LANGUAGE "English"
|
||||
|
||||
;--------------------------------
|
||||
;Reserve Files
|
||||
|
||||
;Things that need to be extracted on first (keep these lines before any File command!)
|
||||
;Only for BZIP2 compression
|
||||
|
||||
ReserveFile "MathTest.ini"
|
||||
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
|
||||
|
||||
;--------------------------------
|
||||
;Installer Functions
|
||||
|
||||
LangString SCRIPTSAMPLE0 ${LANG_ENGLISH} "r0 = 'Hello'; r1 = 'Math::Script'\r\nr0 += ' from the ' + r1 + '!'; r1=''"
|
||||
LangString SCRIPTSAMPLE1 ${LANG_ENGLISH} "a =0; b=1.0\r\n#{a++ < 100, b *= a}\r\nr0 = a; R0 = b; R1 = ff(b, 15)\r\nr1 = (a-1) + '! = ' + b"
|
||||
LangString SCRIPTSAMPLE2 ${LANG_ENGLISH} 'pi=3.14159; \r\nangle = pi/4;\r\ntext = "x = " + ff(angle,16+3) \r\nr0 = text += ", sin x = " + sin(angle)'
|
||||
LangString SCRIPTSAMPLE3 ${LANG_ENGLISH} "v1 = 123.456; v2 = 123456789.1011\r\nr0 = v1; r1 = v2\r\nr2 = ff(v1, 3); r3 = ff(v2, 3); r4 = ff(v1, 3+16); r5 = ff(v2, 3+16)\r\nr6 = ff(v1, 3+32); r7 = ff(v2, 3+32); r8 = ff(v1, 3+32+64); r9 = ff(v2, 3+32+64)\r\n"
|
||||
LangString SCRIPTSAMPLE4 ${LANG_ENGLISH} "a = 10000; b = 0; #{--a > 0, b+= a}; r0 = a; r1 = b\r\nz = 1.55; r2 = #[z > 1.5, 'Its greater', 'Its lower']\r\nz = 1.45; r3 = #[z > 1.5, 'Its greater', 'Its lower']"
|
||||
LangString SCRIPTSAMPLE5 ${LANG_ENGLISH} 'r0 = "123a123"\r\nr1 = r0; \r\nr2 = s(r0); r3 = f(r0); r4 = i(r0); r5 = l(r0)'
|
||||
|
||||
Function .onInit
|
||||
|
||||
;Extract InstallOptions INI files
|
||||
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "MathTest.ini"
|
||||
|
||||
Strcpy "$TEMP1" "$(SCRIPTSAMPLE0)"
|
||||
!insertmacro MUI_INSTALLOPTIONS_WRITE "MathTest.ini" "Field 2" "State" $TEMP1
|
||||
|
||||
FunctionEnd
|
||||
|
||||
LangString TEXT_IO_TITLE ${LANG_ENGLISH} "MathTest Script Page"
|
||||
LangString TEXT_IO_SUBTITLE ${LANG_ENGLISH} "Try your scripting capapibilites or test one of sample scripts"
|
||||
|
||||
|
||||
Function DumpVariables
|
||||
Strcpy "$TEMP1" "$$0='$0'\r\n$$1='$1'\r\n$$2='$2'\r\n$$3='$3'\r\n$$4='$4'\r\n$$5='$5'\r\n$$6='$6'\r\n$$7='$7'\r\n$$8='$8'\r\n$$9='$9'"
|
||||
!insertmacro MUI_INSTALLOPTIONS_WRITE "MathTest.ini" "Field 3" "State" $TEMP1
|
||||
Strcpy "$TEMP1" "$$R0='$R0'\r\n$$R1='$R1'\r\n$$R2='$R2'\r\n$$R3='$R3'\r\n$$R4='$R4'\r\n$$R5='$R5'\r\n$$R6='$R6'\r\n$$R7='$R7'\r\n$$R8='$R8'\r\n$$R9='$R9'"
|
||||
!insertmacro MUI_INSTALLOPTIONS_WRITE "MathTest.ini" "Field 4" "State" $TEMP1
|
||||
FunctionEnd
|
||||
|
||||
Function ClearVariables
|
||||
Math::Script "r0=r1=r2=r3=r4=r5=r6=r7=r8=r9=R0=R1=R2=R3=R4=R5=R6=R7=R8=R9=''"
|
||||
FunctionEnd
|
||||
|
||||
Function GetLine
|
||||
push $TEMP1
|
||||
Math::Script "mtsDL()"
|
||||
pop $TEMP2
|
||||
pop $TEMP1
|
||||
FunctionEnd
|
||||
|
||||
Function ExecuteScript
|
||||
!insertmacro MUI_INSTALLOPTIONS_READ $TEMP1 "MathTest.ini" "Field 2" "State"
|
||||
|
||||
Math::Script "mtsTQ(s) (s = s(NS); #[s[0]=='$\"',s=s[1,]]; #[s[-1]=='$\"',s=s[,-2]]; NS = s)"
|
||||
Math::Script "mtsP(s,e, p,i) (p=-1;i=0; #{(i<l(s))&&(p<0), #[s[i,i+l(e)-1]==e, p=i]; i++}; p)"
|
||||
Math::Script "mtsDL(s) (s=s(NS); p=mtsP(s,'\r\n'); #[p>=0, (NS=s[p+4,]; NS=#[p>0,s[,p-1],'']), (NS='';NS=s)])"
|
||||
|
||||
push $TEMP1
|
||||
; remove ""
|
||||
Math::Script "mtsTQ()"
|
||||
pop $TEMP1
|
||||
|
||||
; script at $TEMP1
|
||||
Go:
|
||||
StrLen $TEMP3 $TEMP1
|
||||
IntCmp $TEMP3 0 End
|
||||
; get single line to $TEMP2
|
||||
Call GetLine
|
||||
; MessageBox MB_OK "'$TEMP2' '$TEMP1'"
|
||||
Math::Script "$TEMP2"
|
||||
goto Go
|
||||
End:
|
||||
Math::Script ""
|
||||
FunctionEnd
|
||||
|
||||
Function ScriptPageEnter
|
||||
|
||||
!insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
|
||||
|
||||
Again:
|
||||
Call ClearVariables
|
||||
Call ExecuteScript
|
||||
Call DumpVariables
|
||||
|
||||
!insertmacro MUI_INSTALLOPTIONS_DISPLAY_RETURN "mathtest.ini"
|
||||
pop $TEMP3
|
||||
|
||||
!insertmacro MUI_INSTALLOPTIONS_READ $TEMP1 "MathTest.ini" "Field 5" "State"
|
||||
IntCmp $TEMP1 1 Test
|
||||
|
||||
Strcpy "$TEMP2" "$(SCRIPTSAMPLE1)"
|
||||
!insertmacro MUI_INSTALLOPTIONS_READ $TEMP1 "MathTest.ini" "Field 6" "State"
|
||||
IntCmp $TEMP1 1 Write
|
||||
|
||||
Strcpy "$TEMP2" "$(SCRIPTSAMPLE2)"
|
||||
!insertmacro MUI_INSTALLOPTIONS_READ $TEMP1 "MathTest.ini" "Field 7" "State"
|
||||
IntCmp $TEMP1 1 Write
|
||||
|
||||
Strcpy "$TEMP2" "$(SCRIPTSAMPLE3)"
|
||||
!insertmacro MUI_INSTALLOPTIONS_READ $TEMP1 "MathTest.ini" "Field 8" "State"
|
||||
IntCmp $TEMP1 1 Write
|
||||
|
||||
Strcpy "$TEMP2" "$(SCRIPTSAMPLE4)"
|
||||
!insertmacro MUI_INSTALLOPTIONS_READ $TEMP1 "MathTest.ini" "Field 9" "State"
|
||||
IntCmp $TEMP1 1 Write
|
||||
|
||||
Strcpy "$TEMP2" "$(SCRIPTSAMPLE5)"
|
||||
|
||||
Write:
|
||||
!insertmacro MUI_INSTALLOPTIONS_WRITE "MathTest.ini" "Field 2" "State" "$TEMP2"
|
||||
!insertmacro MUI_INSTALLOPTIONS_WRITE "MathTest.ini" "Field 5" "State" "1"
|
||||
!insertmacro MUI_INSTALLOPTIONS_WRITE "MathTest.ini" "Field 6" "State" "0"
|
||||
!insertmacro MUI_INSTALLOPTIONS_WRITE "MathTest.ini" "Field 7" "State" "0"
|
||||
!insertmacro MUI_INSTALLOPTIONS_WRITE "MathTest.ini" "Field 8" "State" "0"
|
||||
!insertmacro MUI_INSTALLOPTIONS_WRITE "MathTest.ini" "Field 9" "State" "0"
|
||||
!insertmacro MUI_INSTALLOPTIONS_WRITE "MathTest.ini" "Field 10" "State" "0"
|
||||
|
||||
Test:
|
||||
Strcmp $TEMP3 "success" Again
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Section "Dummy Section" SecDummy
|
||||
SectionEnd
|
7
KattekerCreator/nsis/Examples/Math/mathtest.txt
Normal file
7
KattekerCreator/nsis/Examples/Math/mathtest.txt
Normal file
@ -0,0 +1,7 @@
|
||||
Math Tester.
|
||||
|
||||
This demo allows you to test your Math::Script expressions without need to compile anything. Just enter your expressions into multiline editbox (every single line is a separate call to Math::Script) or select one of sample expressions and press Execute.
|
||||
|
||||
Every call to Math::Script can accept up to 1kb of script, but this demo is limited to the summ of 1 kb at all lines. And... watch your scripts. No.... Watch your errors at scripts!
|
||||
|
||||
(c) Brainsucker, 2003.
|
79
KattekerCreator/nsis/Examples/Memento.nsi
Normal file
79
KattekerCreator/nsis/Examples/Memento.nsi
Normal file
@ -0,0 +1,79 @@
|
||||
!include LogicLib.nsh
|
||||
!include Memento.nsh
|
||||
|
||||
Name Memento
|
||||
OutFile Memento.exe
|
||||
|
||||
XPStyle on
|
||||
|
||||
ShowInstDetails show
|
||||
|
||||
Page components
|
||||
Page instfiles
|
||||
|
||||
RequestExecutionLevel user
|
||||
|
||||
# settings
|
||||
|
||||
!define MEMENTO_REGISTRY_ROOT HKCU
|
||||
!define MEMENTO_REGISTRY_KEY "Software\NSIS\Memento Test"
|
||||
|
||||
# restore
|
||||
|
||||
Function .onInit
|
||||
|
||||
${If} ${Cmd} `MessageBox MB_YESNO "Would you like to load an example state?" IDYES`
|
||||
|
||||
DeleteRegKey HKCU "Software\NSIS\Memento Test"
|
||||
|
||||
WriteRegStr HKCU "Software\NSIS\Memento Test" MementoSectionUsed ""
|
||||
WriteRegDWORD HKCU "Software\NSIS\Memento Test" MementoSection_sec_horse 1
|
||||
WriteRegDWORD HKCU "Software\NSIS\Memento Test" MementoSection_sec_chicken 1
|
||||
WriteRegDWORD HKCU "Software\NSIS\Memento Test" MementoSection_sec_donkey 0
|
||||
WriteRegDWORD HKCU "Software\NSIS\Memento Test" MementoSection_sec_croc 0
|
||||
|
||||
${EndIf}
|
||||
|
||||
${MementoSectionRestore}
|
||||
|
||||
FunctionEnd
|
||||
|
||||
# sections
|
||||
|
||||
${MementoSection} horse sec_horse
|
||||
${MementoSectionEnd}
|
||||
|
||||
${MementoSection} donkey sec_donkey
|
||||
${MementoSectionEnd}
|
||||
|
||||
${MementoSection} chicken sec_chicken
|
||||
${MementoSectionEnd}
|
||||
|
||||
SectionGroup /e group
|
||||
|
||||
SectionGroup /e group
|
||||
|
||||
${MementoSection} croc sec_croc
|
||||
${MementoSectionEnd}
|
||||
|
||||
${MementoSection} cow sec_cow
|
||||
${MementoSectionEnd}
|
||||
|
||||
SectionGroupEnd
|
||||
|
||||
SectionGroupEnd
|
||||
|
||||
${MementoUnselectedSection} dinosaur sec_dinosaur
|
||||
${MementoSectionEnd}
|
||||
|
||||
# done...
|
||||
|
||||
${MementoSectionDone}
|
||||
|
||||
# save
|
||||
|
||||
Function .onInstSuccess
|
||||
|
||||
${MementoSectionSave}
|
||||
|
||||
FunctionEnd
|
88
KattekerCreator/nsis/Examples/Modern UI/Basic.nsi
Normal file
88
KattekerCreator/nsis/Examples/Modern UI/Basic.nsi
Normal file
@ -0,0 +1,88 @@
|
||||
;NSIS Modern User Interface
|
||||
;Basic Example Script
|
||||
;Written by Joost Verburg
|
||||
|
||||
;--------------------------------
|
||||
;Include Modern UI
|
||||
|
||||
!include "MUI2.nsh"
|
||||
|
||||
;--------------------------------
|
||||
;General
|
||||
|
||||
;Name and file
|
||||
Name "Modern UI Test"
|
||||
OutFile "Basic.exe"
|
||||
|
||||
;Default installation folder
|
||||
InstallDir "$LOCALAPPDATA\Modern UI Test"
|
||||
|
||||
;Get installation folder from registry if available
|
||||
InstallDirRegKey HKCU "Software\Modern UI Test" ""
|
||||
|
||||
;Request application privileges for Windows Vista
|
||||
RequestExecutionLevel user
|
||||
|
||||
;--------------------------------
|
||||
;Interface Settings
|
||||
|
||||
!define MUI_ABORTWARNING
|
||||
|
||||
;--------------------------------
|
||||
;Pages
|
||||
|
||||
!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
|
||||
!insertmacro MUI_PAGE_COMPONENTS
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
|
||||
;--------------------------------
|
||||
;Languages
|
||||
|
||||
!insertmacro MUI_LANGUAGE "English"
|
||||
|
||||
;--------------------------------
|
||||
;Installer Sections
|
||||
|
||||
Section "Dummy Section" SecDummy
|
||||
|
||||
SetOutPath "$INSTDIR"
|
||||
|
||||
;ADD YOUR OWN FILES HERE...
|
||||
|
||||
;Store installation folder
|
||||
WriteRegStr HKCU "Software\Modern UI Test" "" $INSTDIR
|
||||
|
||||
;Create uninstaller
|
||||
WriteUninstaller "$INSTDIR\Uninstall.exe"
|
||||
|
||||
SectionEnd
|
||||
|
||||
;--------------------------------
|
||||
;Descriptions
|
||||
|
||||
;Language strings
|
||||
LangString DESC_SecDummy ${LANG_ENGLISH} "A test section."
|
||||
|
||||
;Assign language strings to sections
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
||||
|
||||
;--------------------------------
|
||||
;Uninstaller Section
|
||||
|
||||
Section "Uninstall"
|
||||
|
||||
;ADD YOUR OWN FILES HERE...
|
||||
|
||||
Delete "$INSTDIR\Uninstall.exe"
|
||||
|
||||
RMDir "$INSTDIR"
|
||||
|
||||
DeleteRegKey /ifempty HKCU "Software\Modern UI Test"
|
||||
|
||||
SectionEnd
|
90
KattekerCreator/nsis/Examples/Modern UI/HeaderBitmap.nsi
Normal file
90
KattekerCreator/nsis/Examples/Modern UI/HeaderBitmap.nsi
Normal file
@ -0,0 +1,90 @@
|
||||
;NSIS Modern User Interface
|
||||
;Header Bitmap Example Script
|
||||
;Written by Joost Verburg
|
||||
|
||||
;--------------------------------
|
||||
;Include Modern UI
|
||||
|
||||
!include "MUI2.nsh"
|
||||
|
||||
;--------------------------------
|
||||
;General
|
||||
|
||||
;Name and file
|
||||
Name "Modern UI Test"
|
||||
OutFile "HeaderBitmap.exe"
|
||||
|
||||
;Default installation folder
|
||||
InstallDir "$LOCALAPPDATA\Modern UI Test"
|
||||
|
||||
;Get installation folder from registry if available
|
||||
InstallDirRegKey HKCU "Software\Modern UI Test" ""
|
||||
|
||||
;Request application privileges for Windows Vista
|
||||
RequestExecutionLevel user
|
||||
|
||||
;--------------------------------
|
||||
;Interface Configuration
|
||||
|
||||
!define MUI_HEADERIMAGE
|
||||
!define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\nsis.bmp" ; optional
|
||||
!define MUI_ABORTWARNING
|
||||
|
||||
;--------------------------------
|
||||
;Pages
|
||||
|
||||
!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
|
||||
!insertmacro MUI_PAGE_COMPONENTS
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
|
||||
;--------------------------------
|
||||
;Languages
|
||||
|
||||
!insertmacro MUI_LANGUAGE "English"
|
||||
|
||||
;--------------------------------
|
||||
;Installer Sections
|
||||
|
||||
Section "Dummy Section" SecDummy
|
||||
|
||||
SetOutPath "$INSTDIR"
|
||||
|
||||
;ADD YOUR OWN FILES HERE...
|
||||
|
||||
;Store installation folder
|
||||
WriteRegStr HKCU "Software\Modern UI Test" "" $INSTDIR
|
||||
|
||||
;Create uninstaller
|
||||
WriteUninstaller "$INSTDIR\Uninstall.exe"
|
||||
|
||||
SectionEnd
|
||||
|
||||
;--------------------------------
|
||||
;Descriptions
|
||||
|
||||
;Language strings
|
||||
LangString DESC_SecDummy ${LANG_ENGLISH} "A test section."
|
||||
|
||||
;Assign language strings to sections
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
||||
|
||||
;--------------------------------
|
||||
;Uninstaller Section
|
||||
|
||||
Section "Uninstall"
|
||||
|
||||
;ADD YOUR OWN FILES HERE...
|
||||
|
||||
Delete "$INSTDIR\Uninstall.exe"
|
||||
|
||||
RMDir "$INSTDIR"
|
||||
|
||||
DeleteRegKey /ifempty HKCU "Software\Modern UI Test"
|
||||
|
||||
SectionEnd
|
204
KattekerCreator/nsis/Examples/Modern UI/MultiLanguage.nsi
Normal file
204
KattekerCreator/nsis/Examples/Modern UI/MultiLanguage.nsi
Normal file
@ -0,0 +1,204 @@
|
||||
;NSIS Modern User Interface
|
||||
;Multilingual Example Script
|
||||
;Written by Joost Verburg
|
||||
|
||||
!pragma warning error all
|
||||
|
||||
;--------------------------------
|
||||
;Include Modern UI
|
||||
|
||||
!include "MUI2.nsh"
|
||||
|
||||
;--------------------------------
|
||||
;General
|
||||
|
||||
;Properly display all languages (Installer will not work on Windows 95, 98 or ME!)
|
||||
Unicode true
|
||||
|
||||
;Name and file
|
||||
Name "Modern UI Test"
|
||||
OutFile "MultiLanguage.exe"
|
||||
|
||||
;Default installation folder
|
||||
InstallDir "$LOCALAPPDATA\Modern UI Test"
|
||||
|
||||
;Get installation folder from registry if available
|
||||
InstallDirRegKey HKCU "Software\Modern UI Test" ""
|
||||
|
||||
;Request application privileges for Windows Vista
|
||||
RequestExecutionLevel user
|
||||
|
||||
;--------------------------------
|
||||
;Interface Settings
|
||||
|
||||
!define MUI_ABORTWARNING
|
||||
|
||||
;Show all languages, despite user's codepage
|
||||
!define MUI_LANGDLL_ALLLANGUAGES
|
||||
|
||||
;--------------------------------
|
||||
;Language Selection Dialog Settings
|
||||
|
||||
;Remember the installer language
|
||||
!define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
|
||||
!define MUI_LANGDLL_REGISTRY_KEY "Software\Modern UI Test"
|
||||
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
|
||||
|
||||
;--------------------------------
|
||||
;Pages
|
||||
|
||||
!insertmacro MUI_PAGE_WELCOME
|
||||
!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
|
||||
!insertmacro MUI_PAGE_COMPONENTS
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
!insertmacro MUI_PAGE_FINISH
|
||||
|
||||
!insertmacro MUI_UNPAGE_WELCOME
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
!insertmacro MUI_UNPAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
|
||||
!insertmacro MUI_UNPAGE_COMPONENTS
|
||||
!insertmacro MUI_UNPAGE_DIRECTORY
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
!insertmacro MUI_UNPAGE_FINISH
|
||||
|
||||
;--------------------------------
|
||||
;Languages
|
||||
|
||||
!insertmacro MUI_LANGUAGE "English" ; The first language is the default language
|
||||
!insertmacro MUI_LANGUAGE "French"
|
||||
!insertmacro MUI_LANGUAGE "German"
|
||||
!insertmacro MUI_LANGUAGE "Spanish"
|
||||
!insertmacro MUI_LANGUAGE "SpanishInternational"
|
||||
!insertmacro MUI_LANGUAGE "SimpChinese"
|
||||
!insertmacro MUI_LANGUAGE "TradChinese"
|
||||
!insertmacro MUI_LANGUAGE "Japanese"
|
||||
!insertmacro MUI_LANGUAGE "Korean"
|
||||
!insertmacro MUI_LANGUAGE "Italian"
|
||||
!insertmacro MUI_LANGUAGE "Dutch"
|
||||
!insertmacro MUI_LANGUAGE "Danish"
|
||||
!insertmacro MUI_LANGUAGE "Swedish"
|
||||
!insertmacro MUI_LANGUAGE "Norwegian"
|
||||
!insertmacro MUI_LANGUAGE "NorwegianNynorsk"
|
||||
!insertmacro MUI_LANGUAGE "Finnish"
|
||||
!insertmacro MUI_LANGUAGE "Greek"
|
||||
!insertmacro MUI_LANGUAGE "Russian"
|
||||
!insertmacro MUI_LANGUAGE "Portuguese"
|
||||
!insertmacro MUI_LANGUAGE "PortugueseBR"
|
||||
!insertmacro MUI_LANGUAGE "Polish"
|
||||
!insertmacro MUI_LANGUAGE "Ukrainian"
|
||||
!insertmacro MUI_LANGUAGE "Czech"
|
||||
!insertmacro MUI_LANGUAGE "Slovak"
|
||||
!insertmacro MUI_LANGUAGE "Croatian"
|
||||
!insertmacro MUI_LANGUAGE "Bulgarian"
|
||||
!insertmacro MUI_LANGUAGE "Hungarian"
|
||||
!insertmacro MUI_LANGUAGE "Thai"
|
||||
!insertmacro MUI_LANGUAGE "Romanian"
|
||||
!insertmacro MUI_LANGUAGE "Latvian"
|
||||
!insertmacro MUI_LANGUAGE "Macedonian"
|
||||
!insertmacro MUI_LANGUAGE "Estonian"
|
||||
!insertmacro MUI_LANGUAGE "Turkish"
|
||||
!insertmacro MUI_LANGUAGE "Lithuanian"
|
||||
!insertmacro MUI_LANGUAGE "Slovenian"
|
||||
!insertmacro MUI_LANGUAGE "Serbian"
|
||||
!insertmacro MUI_LANGUAGE "SerbianLatin"
|
||||
!insertmacro MUI_LANGUAGE "Arabic"
|
||||
!insertmacro MUI_LANGUAGE "Farsi"
|
||||
!insertmacro MUI_LANGUAGE "Hebrew"
|
||||
!insertmacro MUI_LANGUAGE "Indonesian"
|
||||
!insertmacro MUI_LANGUAGE "Mongolian"
|
||||
!insertmacro MUI_LANGUAGE "Luxembourgish"
|
||||
!insertmacro MUI_LANGUAGE "Albanian"
|
||||
!insertmacro MUI_LANGUAGE "Breton"
|
||||
!insertmacro MUI_LANGUAGE "Belarusian"
|
||||
!insertmacro MUI_LANGUAGE "Icelandic"
|
||||
!insertmacro MUI_LANGUAGE "Malay"
|
||||
!insertmacro MUI_LANGUAGE "Bosnian"
|
||||
!insertmacro MUI_LANGUAGE "Kurdish"
|
||||
!insertmacro MUI_LANGUAGE "Irish"
|
||||
!insertmacro MUI_LANGUAGE "Uzbek"
|
||||
!insertmacro MUI_LANGUAGE "Galician"
|
||||
!insertmacro MUI_LANGUAGE "Afrikaans"
|
||||
!insertmacro MUI_LANGUAGE "Catalan"
|
||||
!insertmacro MUI_LANGUAGE "Esperanto"
|
||||
!insertmacro MUI_LANGUAGE "Asturian"
|
||||
!insertmacro MUI_LANGUAGE "Basque"
|
||||
!insertmacro MUI_LANGUAGE "Pashto"
|
||||
!insertmacro MUI_LANGUAGE "ScotsGaelic"
|
||||
!insertmacro MUI_LANGUAGE "Georgian"
|
||||
!insertmacro MUI_LANGUAGE "Vietnamese"
|
||||
!insertmacro MUI_LANGUAGE "Welsh"
|
||||
!insertmacro MUI_LANGUAGE "Armenian"
|
||||
!insertmacro MUI_LANGUAGE "Corsican"
|
||||
!insertmacro MUI_LANGUAGE "Tatar"
|
||||
!insertmacro MUI_LANGUAGE "Hindi"
|
||||
|
||||
;--------------------------------
|
||||
;Reserve Files
|
||||
|
||||
;If you are using solid compression, files that are required before
|
||||
;the actual installation should be stored first in the data block,
|
||||
;because this will make your installer start faster.
|
||||
|
||||
!insertmacro MUI_RESERVEFILE_LANGDLL
|
||||
|
||||
;--------------------------------
|
||||
;Installer Sections
|
||||
|
||||
Section "Dummy Section" SecDummy
|
||||
|
||||
SetOutPath "$INSTDIR"
|
||||
|
||||
;ADD YOUR OWN FILES HERE...
|
||||
|
||||
;Store installation folder
|
||||
WriteRegStr HKCU "Software\Modern UI Test" "" $INSTDIR
|
||||
|
||||
;Create uninstaller
|
||||
WriteUninstaller "$INSTDIR\Uninstall.exe"
|
||||
|
||||
SectionEnd
|
||||
|
||||
;--------------------------------
|
||||
;Installer Functions
|
||||
|
||||
Function .onInit
|
||||
|
||||
!insertmacro MUI_LANGDLL_DISPLAY
|
||||
|
||||
FunctionEnd
|
||||
|
||||
;--------------------------------
|
||||
;Descriptions
|
||||
|
||||
;USE A LANGUAGE STRING IF YOU WANT YOUR DESCRIPTIONS TO BE LANGAUGE SPECIFIC
|
||||
|
||||
;Assign descriptions to sections
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} "A test section."
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
||||
|
||||
|
||||
;--------------------------------
|
||||
;Uninstaller Section
|
||||
|
||||
Section "Uninstall"
|
||||
|
||||
;ADD YOUR OWN FILES HERE...
|
||||
|
||||
Delete "$INSTDIR\Uninstall.exe"
|
||||
|
||||
RMDir "$INSTDIR"
|
||||
|
||||
DeleteRegKey /ifempty HKCU "Software\Modern UI Test"
|
||||
|
||||
SectionEnd
|
||||
|
||||
;--------------------------------
|
||||
;Uninstaller Functions
|
||||
|
||||
Function un.onInit
|
||||
|
||||
!insertmacro MUI_UNGETLANGUAGE
|
||||
|
||||
FunctionEnd
|
114
KattekerCreator/nsis/Examples/Modern UI/StartMenu.nsi
Normal file
114
KattekerCreator/nsis/Examples/Modern UI/StartMenu.nsi
Normal file
@ -0,0 +1,114 @@
|
||||
;NSIS Modern User Interface
|
||||
;Start Menu Folder Selection Example Script
|
||||
;Written by Joost Verburg
|
||||
|
||||
;--------------------------------
|
||||
;Include Modern UI
|
||||
|
||||
!include "MUI2.nsh"
|
||||
|
||||
;--------------------------------
|
||||
;General
|
||||
|
||||
;Name and file
|
||||
Name "Modern UI Test"
|
||||
OutFile "StartMenu.exe"
|
||||
|
||||
;Default installation folder
|
||||
InstallDir "$LOCALAPPDATA\Modern UI Test"
|
||||
|
||||
;Get installation folder from registry if available
|
||||
InstallDirRegKey HKCU "Software\Modern UI Test" ""
|
||||
|
||||
;Request application privileges for Windows Vista
|
||||
RequestExecutionLevel user
|
||||
|
||||
;--------------------------------
|
||||
;Variables
|
||||
|
||||
Var StartMenuFolder
|
||||
|
||||
;--------------------------------
|
||||
;Interface Settings
|
||||
|
||||
!define MUI_ABORTWARNING
|
||||
|
||||
;--------------------------------
|
||||
;Pages
|
||||
|
||||
!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
|
||||
!insertmacro MUI_PAGE_COMPONENTS
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
|
||||
;Start Menu Folder Page Configuration
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Modern UI Test"
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
|
||||
|
||||
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
|
||||
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
|
||||
;--------------------------------
|
||||
;Languages
|
||||
|
||||
!insertmacro MUI_LANGUAGE "English"
|
||||
|
||||
;--------------------------------
|
||||
;Installer Sections
|
||||
|
||||
Section "Dummy Section" SecDummy
|
||||
|
||||
SetOutPath "$INSTDIR"
|
||||
|
||||
;ADD YOUR OWN FILES HERE...
|
||||
|
||||
;Store installation folder
|
||||
WriteRegStr HKCU "Software\Modern UI Test" "" $INSTDIR
|
||||
|
||||
;Create uninstaller
|
||||
WriteUninstaller "$INSTDIR\Uninstall.exe"
|
||||
|
||||
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
||||
|
||||
;Create shortcuts
|
||||
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
|
||||
CreateShortcut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
|
||||
|
||||
!insertmacro MUI_STARTMENU_WRITE_END
|
||||
|
||||
SectionEnd
|
||||
|
||||
;--------------------------------
|
||||
;Descriptions
|
||||
|
||||
;Language strings
|
||||
LangString DESC_SecDummy ${LANG_ENGLISH} "A test section."
|
||||
|
||||
;Assign language strings to sections
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
||||
|
||||
;--------------------------------
|
||||
;Uninstaller Section
|
||||
|
||||
Section "Uninstall"
|
||||
|
||||
;ADD YOUR OWN FILES HERE...
|
||||
|
||||
Delete "$INSTDIR\Uninstall.exe"
|
||||
|
||||
RMDir "$INSTDIR"
|
||||
|
||||
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
|
||||
|
||||
Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk"
|
||||
RMDir "$SMPROGRAMS\$StartMenuFolder"
|
||||
|
||||
DeleteRegKey /ifempty HKCU "Software\Modern UI Test"
|
||||
|
||||
SectionEnd
|
92
KattekerCreator/nsis/Examples/Modern UI/WelcomeFinish.nsi
Normal file
92
KattekerCreator/nsis/Examples/Modern UI/WelcomeFinish.nsi
Normal file
@ -0,0 +1,92 @@
|
||||
;NSIS Modern User Interface
|
||||
;Welcome/Finish Page Example Script
|
||||
;Written by Joost Verburg
|
||||
|
||||
;--------------------------------
|
||||
;Include Modern UI
|
||||
|
||||
!include "MUI2.nsh"
|
||||
|
||||
;--------------------------------
|
||||
;General
|
||||
|
||||
;Name and file
|
||||
Name "Modern UI Test"
|
||||
OutFile "WelcomeFinish.exe"
|
||||
|
||||
;Default installation folder
|
||||
InstallDir "$LOCALAPPDATA\Modern UI Test"
|
||||
|
||||
;Get installation folder from registry if available
|
||||
InstallDirRegKey HKCU "Software\Modern UI Test" ""
|
||||
|
||||
;Request application privileges for Windows Vista
|
||||
RequestExecutionLevel user
|
||||
|
||||
;--------------------------------
|
||||
;Interface Settings
|
||||
|
||||
!define MUI_ABORTWARNING
|
||||
|
||||
;--------------------------------
|
||||
;Pages
|
||||
|
||||
!insertmacro MUI_PAGE_WELCOME
|
||||
!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
|
||||
!insertmacro MUI_PAGE_COMPONENTS
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
!insertmacro MUI_PAGE_FINISH
|
||||
|
||||
!insertmacro MUI_UNPAGE_WELCOME
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
!insertmacro MUI_UNPAGE_FINISH
|
||||
|
||||
;--------------------------------
|
||||
;Languages
|
||||
|
||||
!insertmacro MUI_LANGUAGE "English"
|
||||
|
||||
;--------------------------------
|
||||
;Installer Sections
|
||||
|
||||
Section "Dummy Section" SecDummy
|
||||
|
||||
SetOutPath "$INSTDIR"
|
||||
|
||||
;ADD YOUR OWN FILES HERE...
|
||||
|
||||
;Store installation folder
|
||||
WriteRegStr HKCU "Software\Modern UI Test" "" $INSTDIR
|
||||
|
||||
;Create uninstaller
|
||||
WriteUninstaller "$INSTDIR\Uninstall.exe"
|
||||
|
||||
SectionEnd
|
||||
|
||||
;--------------------------------
|
||||
;Descriptions
|
||||
|
||||
;Language strings
|
||||
LangString DESC_SecDummy ${LANG_ENGLISH} "A test section."
|
||||
|
||||
;Assign language strings to sections
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
||||
|
||||
;--------------------------------
|
||||
;Uninstaller Section
|
||||
|
||||
Section "Uninstall"
|
||||
|
||||
;ADD YOUR OWN FILES HERE...
|
||||
|
||||
Delete "$INSTDIR\Uninstall.exe"
|
||||
|
||||
RMDir "$INSTDIR"
|
||||
|
||||
DeleteRegKey /ifempty HKCU "Software\Modern UI Test"
|
||||
|
||||
SectionEnd
|
300
KattekerCreator/nsis/Examples/NSISMenu.nsi
Normal file
300
KattekerCreator/nsis/Examples/NSISMenu.nsi
Normal file
@ -0,0 +1,300 @@
|
||||
OutFile "NSIS.exe"
|
||||
Name "NSIS Menu"
|
||||
Unicode True
|
||||
RequestExecutionLevel User
|
||||
XPStyle On
|
||||
ManifestDPIAware System
|
||||
SetCompressor LZMA
|
||||
ChangeUI IDD_INST "${NSISDIR}\Contrib\UIs\modern_headerbmp.exe"
|
||||
Icon "${NSISDIR}\Contrib\Graphics\Icons\nsis-menu.ico"
|
||||
BrandingText " "
|
||||
MiscButtonText " " " " " " " "
|
||||
InstallButtonText " "
|
||||
CompletedText " "
|
||||
LangString ^ClickInstall 0 " "
|
||||
Caption "$(^Name)"
|
||||
|
||||
!include nsDialogs.nsh
|
||||
!include WinMessages.nsh
|
||||
!include LogicLib.nsh
|
||||
!define /IfNDef IDC_CHILDRECT 1018
|
||||
!define QUIT_ON_EXECUTE
|
||||
!define PR $ExeDir ; Local root path
|
||||
!define PD "Docs" ; Local with WWW fallback (located at the same relative path)
|
||||
!define WWW "http://nsis.sf.net"
|
||||
|
||||
!define CB_HEADER 0x755585
|
||||
!define UY_HEADER 28
|
||||
!define CB_PAGE 0xffffff
|
||||
!define CT_SECTION 0x666666
|
||||
!define CB_SECTION ${CB_PAGE}
|
||||
!define UY_SECTION 11 ; Height of a section
|
||||
!define UY_SECTIONBPAD 2 ; Extra padding on the bottom of section headers
|
||||
!define UY_TXT 9 ; Height of a normal item
|
||||
!define UY_TXTBPAD 1 ; Extra padding on the bottom of normal items
|
||||
!define UX_COLPAD 7 ; Spacing between columns
|
||||
!define UY_ROW2 104 ; Absolute position of the 2nd row
|
||||
!define CT_LINK 0x0c6e97 ; SYSCLR:HOTLIGHT
|
||||
!define /Math UX_PAGE 00 + ${UX_COLPAD}
|
||||
!define /Math UY_PAGE ${UY_HEADER} + 20
|
||||
!define UX ${UX_PAGE}
|
||||
|
||||
Function PageLeave
|
||||
System::Call 'USER32::GetFocus()p.r0'
|
||||
System::Call 'USER32::GetDlgCtrlID(pr0)i.r1'
|
||||
System::Call 'USER32::GetParent(pr0)p.r2'
|
||||
SendMessage $2 ${WM_COMMAND} $1 $0 ; Handle <ENTER> in dialog by pretending it was a click on the active control
|
||||
Abort
|
||||
FunctionEnd
|
||||
|
||||
Function PageCreate
|
||||
GetDlgItem $0 $hWndParent 1
|
||||
ShowWindow $0 0
|
||||
GetDlgItem $0 $hWndParent 2
|
||||
ShowWindow $0 0
|
||||
|
||||
System::Call 'USER32::GetClientRect(p$hWndParent,@r0)'
|
||||
System::Call '*$0(i,i,i.r3,i.r4)'
|
||||
GetDlgItem $0 $hWndParent ${IDC_CHILDRECT}
|
||||
System::Call 'USER32::MoveWindow(pr0,i0,i0,ir3,ir4,i0)'
|
||||
|
||||
nsDialogs::Create ${IDC_CHILDRECT}
|
||||
Pop $R9
|
||||
SetCtlColors $R9 000000 ${CB_PAGE}
|
||||
|
||||
!macro StartColumn W
|
||||
!define /ReDef UY ${UY_PAGE}
|
||||
!define /ReDef UX_W ${W}
|
||||
!ifdef UX_INTERNAL_PREV_W
|
||||
!define /ReDef /Math UX ${UX} + ${UX_INTERNAL_PREV_W}
|
||||
!define /ReDef /Math UX ${UX} + ${UX_COLPAD}
|
||||
!define /ReDef UX_INTERNAL_PREV_W ${UX_W}
|
||||
!else
|
||||
!define /Math UX_INTERNAL_PREV_W 0 + ${UX_W}
|
||||
!endif
|
||||
!macroend
|
||||
!macro CreateHeader Txt W
|
||||
!define /ReDef /Math W ${W} + 4 ; Make it slightly wider
|
||||
${NSD_CreateLabel} ${UX}u ${UY}u ${W}u ${UY_SECTION}u "${Txt}"
|
||||
Pop $0
|
||||
SetCtlColors $0 ${CT_SECTION} transparent
|
||||
SendMessage $0 ${WM_SETFONT} ${HF_HEADER} 1
|
||||
!define /ReDef /Math UY ${UY} + ${UY_SECTION}
|
||||
!define /ReDef /Math UY ${UY} + ${UY_SECTIONBPAD}
|
||||
!macroend
|
||||
!macro CreateControl Class Txt W H
|
||||
${NSD_Create${Class}} ${UX}u ${UY}u ${W}u ${H}u "${Txt}"
|
||||
!define /ReDef /Math UY ${UY} + ${H}
|
||||
!define /ReDef /Math UY ${UY} + ${UY_TXTBPAD}
|
||||
!macroend
|
||||
!macro CreateSimpleLinkHelper Txt Url W
|
||||
!insertmacro CreateControl Link "${Txt}|${Url}" ${W} ${UY_TXT}
|
||||
!macroend
|
||||
!macro CreateSimpleLink Txt Url W
|
||||
!insertmacro CreateSimpleLinkHelper "${Txt}" "${Url}" ${W}
|
||||
Call ConfigureLink
|
||||
!macroend
|
||||
|
||||
|
||||
; --- Header ---
|
||||
!define HF_HEADER $R8
|
||||
CreateFont ${HF_HEADER} "Arial" ${UY_SECTION} 700
|
||||
|
||||
nsDialogs::CreateControl ${__NSD_Label_CLASS} ${__NSD_Label_STYLE} ${__NSD_Label_EXSTYLE} 33u 0 -33u ${UY_HEADER}u ""
|
||||
Pop $0
|
||||
SetCtlColors $0 0xffffff ${CB_HEADER}
|
||||
|
||||
nsDialogs::CreateControl ${__NSD_Icon_CLASS} ${__NSD_Icon_STYLE}|${SS_CENTERIMAGE}|${SS_CENTER} ${__NSD_Icon_EXSTYLE} 0 0 33u ${UY_HEADER}u ""
|
||||
Pop $0
|
||||
SetCtlColors $0 "" ${CB_HEADER}
|
||||
${NSD_SetIconFromInstaller} $0 $1
|
||||
|
||||
CreateFont $1 "Trebuchet MS" 17
|
||||
!searchreplace VERSTR "${NSIS_VERSION}" "v" ""
|
||||
nsDialogs::CreateControl ${__NSD_Label_CLASS} ${__NSD_Label_STYLE}|${SS_CENTERIMAGE}|${SS_ENDELLIPSIS} ${__NSD_Label_EXSTYLE} 34u 1u -34u ${UY_HEADER}u "nullsoft scriptable install system ${VERSTR}"
|
||||
Pop $0
|
||||
SetCtlColors $0 0x3A2A42 transparent
|
||||
SendMessage $0 ${WM_SETFONT} $1 1
|
||||
nsDialogs::CreateControl ${__NSD_Label_CLASS} ${__NSD_Label_STYLE}|${SS_CENTERIMAGE}|${SS_ENDELLIPSIS} ${__NSD_Label_EXSTYLE} 33u 0 -33u ${UY_HEADER}u "nullsoft scriptable install system ${VERSTR}"
|
||||
Pop $0
|
||||
SetCtlColors $0 0xffffff transparent
|
||||
SendMessage $0 ${WM_SETFONT} $1 1
|
||||
|
||||
|
||||
; --- Page ---
|
||||
!insertmacro StartColumn 90
|
||||
!insertmacro CreateHeader "Compiler" ${UX_W}
|
||||
!insertmacro CreateSimpleLink "Compile NSI scripts" "${PR}\MakeNSISW" ${UX_W}
|
||||
!insertmacro CreateSimpleLink "Installer based on .ZIP file" "${PR}\bin\Zip2Exe" ${UX_W}
|
||||
|
||||
|
||||
!define /ReDef UY ${UY_ROW2}
|
||||
!insertmacro CreateHeader "Developer Center" ${UX_W}
|
||||
!define /ReDef UY_MULTILINE 42
|
||||
!insertmacro CreateControl Label "Many more examples, tutorials, plug-ins and NSIS-releted software are available at the online Developer Center." ${UX_W} ${UY_MULTILINE}
|
||||
Pop $0
|
||||
SetCtlColors $0 00000000 ${CB_PAGE}
|
||||
|
||||
|
||||
!insertmacro StartColumn 80
|
||||
!insertmacro CreateHeader "Documentation" ${UX_W}
|
||||
!insertmacro CreateSimpleLink "NSIS Users Manual" "${PR}\NSIS.chm|${WWW}/Docs/" ${UX_W}
|
||||
!insertmacro CreateSimpleLink "Example scripts" "${PR}\Examples|${WWW}/Examples" ${UX_W}
|
||||
!insertmacro CreateSimpleLink "Modern UI 2" "${PD}\Modern UI 2\Readme.html" ${UX_W}
|
||||
|
||||
|
||||
!define /ReDef UY ${UY_ROW2}
|
||||
!insertmacro CreateHeader "Online Help" ${UX_W}
|
||||
!insertmacro CreateSimpleLink "Developer Center" "${WWW}/Developer_Center" ${UX_W}
|
||||
!insertmacro CreateSimpleLink "FAQ" "${WWW}/FAQ" ${UX_W}
|
||||
!insertmacro CreateSimpleLink "Forum" "http://forums.winamp.com/forumdisplay.php?forumid=65" ${UX_W}
|
||||
;"Project Tracker" "http://sourceforge.net/tracker/?group_id=22049"
|
||||
!insertmacro CreateSimpleLink "Bug Tracker" "http://sourceforge.net/tracker/?group_id=22049&atid=373085" ${UX_W}
|
||||
!insertmacro CreateSimpleLink "Stackoverflow" "http://stackoverflow.com/questions/tagged/nsis" ${UX_W}
|
||||
!insertmacro CreateSimpleLink "Slack collaboration hub" "${WWW}/r/Slack" ${UX_W}
|
||||
!insertmacro CreateSimpleLink "IRC channel" "irc://irc.landoleet.org/nsis" ${UX_W}
|
||||
;"Pastebin" "http://nsis.pastebin.com/index/1FtyKP89"
|
||||
;"Search" "http://www.google.com/cse/home?cx=005317984255499820329:c_glv1-6a6a"
|
||||
|
||||
|
||||
!insertmacro StartColumn 130
|
||||
!insertmacro CreateHeader "Plug-ins" ${UX_W}
|
||||
!macro CreatePluginLink Name Desc Url
|
||||
!define /ReDef SAVE_UY ${UY}
|
||||
!insertmacro CreateSimpleLinkHelper "${Name}" "${Url}" ${UX_W} ; AdjustLinkPair will configure this link
|
||||
!define /ReDef UY ${SAVE_UY}
|
||||
!insertmacro CreateControl Label "${Name} - ${Desc}" ${UX_W} ${UY_TXT}
|
||||
Call AdjustLinkPair
|
||||
!macroend
|
||||
!insertmacro CreatePluginLink "AdvSplash" "splash with fade in/out" "${PD}\AdvSplash\advsplash.txt"
|
||||
!insertmacro CreatePluginLink "Banner" "banner with custom text" "${PD}\Banner\Readme.txt"
|
||||
!insertmacro CreatePluginLink "BgImage" "background image" "${PD}\BgImage\BgImage.txt"
|
||||
!insertmacro CreatePluginLink "Dialer" "internet connection" "${PD}\Dialer\Dialer.txt"
|
||||
!insertmacro CreatePluginLink "Math" "math operations" "${PD}\Math\Math.txt"
|
||||
!insertmacro CreatePluginLink "nsDialogs" "custom wizard pages" "${PD}\nsDialogs\Readme.html"
|
||||
!insertmacro CreatePluginLink "nsExec" "launch command line tools" "${PD}\nsExec\nsExec.txt"
|
||||
!insertmacro CreatePluginLink "NSISdl" "download files" "${PD}\NSISdl\Readme.txt"
|
||||
!insertmacro CreatePluginLink "Splash" "splash screen" "${PD}\Splash\splash.txt"
|
||||
!insertmacro CreatePluginLink "StartMenu" "Start Menu folder selection" "${PD}\StartMenu\Readme.txt"
|
||||
!insertmacro CreatePluginLink "System" "Windows API calls" "${PD}\System\System.html"
|
||||
!insertmacro CreatePluginLink "VPatch" "update existing files" "${PD}\VPatch\Readme.html"
|
||||
|
||||
|
||||
; --- Footer ---
|
||||
${NSD_CreateLabel} 0 -22u 100% 1 ""
|
||||
Pop $0
|
||||
SetCtlColors $0 000000 0xc4c4c4
|
||||
|
||||
nsDialogs::CreateControl ${__NSD_Label_CLASS} ${__NSD_Label_STYLE}|${SS_CENTERIMAGE}|${SS_NOTIFY} ${__NSD_Label_EXSTYLE} -110u -20u 100% 20u "nsis.sourceforge.net"
|
||||
Pop $0
|
||||
SetCtlColors $0 0xbbbbbb transparent
|
||||
SendMessage $0 ${WM_SETFONT} ${HF_HEADER} 1
|
||||
nsDialogs::SetUserData $0 "http://nsis.sourceforge.net"
|
||||
${NSD_OnClick} $0 OnLinkClick
|
||||
|
||||
nsDialogs::Show
|
||||
FunctionEnd
|
||||
|
||||
Function OnLinkClick
|
||||
Pop $1 ; HWND
|
||||
nsDialogs::GetUserData $1
|
||||
Call SplitPipe
|
||||
Pop $0 ; First URL in UserData from SplitPipe
|
||||
StrCpy $3 ""
|
||||
StrCpy $1 $0 4 ; Copy length of ${PD}
|
||||
${IfThen} $1 == "${PD}" ${|} StrCpy $3 "${PR}\" ${|}
|
||||
!ifdef QUIT_ON_EXECUTE
|
||||
System::Call 'USER32::GetKeyState(i0x11)i.r9' ; VK_CONTROL
|
||||
!endif
|
||||
ClearErrors
|
||||
ExecShell "" "$3$0"
|
||||
Pop $1 ; ... the rest of SplitPipe ...
|
||||
${If} $1 != "" ; ... might contain a fallback location
|
||||
StrCpy $0 $1
|
||||
StrCpy $3 ""
|
||||
${ElseIf} $3 != "" ; Local docs path failed, use WWW fallback
|
||||
StrCpy $3 0
|
||||
slashconvloop:
|
||||
StrCpy $2 $0 1 $3
|
||||
${If} $2 == "\"
|
||||
StrCpy $2 $0 $3
|
||||
IntOp $3 $3 + 1
|
||||
StrCpy $0 $0 "" $3
|
||||
StrCpy $0 "$2/$0"
|
||||
${Else}
|
||||
IntOp $3 $3 + 1
|
||||
${EndIf}
|
||||
StrCmp $2 "" 0 slashconvloop
|
||||
StrCpy $3 "${WWW}/"
|
||||
${EndIf}
|
||||
${If} "$3$1" != ""
|
||||
${AndIf} ${Errors}
|
||||
ExecShell "" "$3$0"
|
||||
${EndIf}
|
||||
${If} ${Errors}
|
||||
!ifdef QUIT_ON_EXECUTE
|
||||
StrCpy $9 0 ; Don't allow close
|
||||
!endif
|
||||
MessageBox MB_IconStop 'Error: Unable to open "$0"!'
|
||||
${EndIf}
|
||||
!ifdef QUIT_ON_EXECUTE
|
||||
${IfThen} $9 < 0 ${|} SendMessage $hWndParent ${WM_CLOSE} 0 0 ${|}
|
||||
!endif
|
||||
FunctionEnd
|
||||
|
||||
Function ConfigureLink
|
||||
Pop $1 ; HWND
|
||||
${NSD_OnClick} $1 OnLinkClick
|
||||
SetCtlColors $1 ${CT_LINK} ${CB_PAGE}
|
||||
${NSD_GetText} $1 $4
|
||||
Push $4
|
||||
Call SplitPipe
|
||||
Pop $4
|
||||
Pop $2
|
||||
${NSD_SetText} $1 $4
|
||||
nsDialogs::SetUserData $1 $2
|
||||
System::Call 'USER32::GetDC(pr1)p.r3'
|
||||
SendMessage $1 ${WM_GETFONT} 0 0 $5
|
||||
System::Call 'GDI32::SelectObject(pr3,pr5)p.s'
|
||||
StrLen $5 $4
|
||||
System::Call 'GDI32::GetTextExtentPoint32(pr3,tr4,ir5,@r5)'
|
||||
System::Call '*$5(i.r6)'
|
||||
System::Call 'GDI32::SelectObject(pr3,ps)'
|
||||
System::Call 'USER32::ReleaseDC(pr1,pr3)'
|
||||
System::Call 'USER32::GetWindowRect(pr1,@r3)'
|
||||
System::Call '*$3(i,i.r5,i,i.r7)'
|
||||
IntOp $7 $7 - $5
|
||||
IntOp $6 $6 + 4 ; Padding for focus rect
|
||||
System::Call 'USER32::SetWindowPos(pr1,p,i,i,ir6,ir7,i0x16)'
|
||||
FunctionEnd
|
||||
|
||||
Function AdjustLinkPair
|
||||
Pop $2 ; Label
|
||||
SetCtlColors $2 00000000 ${CB_PAGE}
|
||||
Call ConfigureLink
|
||||
FunctionEnd
|
||||
|
||||
Function SplitPipe
|
||||
Exch $0
|
||||
Push $1
|
||||
Push $2
|
||||
StrCpy $2 0
|
||||
findSep:
|
||||
StrCpy $1 $0 1 $2
|
||||
IntOp $2 $2 + 1
|
||||
StrCmp $1 "" +2
|
||||
StrCmp $1 "|" "" findSep
|
||||
StrCpy $1 $0 "" $2
|
||||
IntOp $2 $2 - 1
|
||||
StrCpy $0 $0 $2
|
||||
Pop $2
|
||||
Exch $1
|
||||
Exch
|
||||
Exch $0
|
||||
FunctionEnd
|
||||
|
||||
Section
|
||||
SectionEnd
|
||||
|
||||
Page Custom PageCreate PageLeave
|
||||
!pragma warning disable 8000 ; Page instfiles not used
|
20
KattekerCreator/nsis/Examples/Plugin/exdll-vs2008.sln
Normal file
20
KattekerCreator/nsis/Examples/Plugin/exdll-vs2008.sln
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "exdll", "exdll-vs2008.vcproj", "{5E3E2AFD-1D6B-4997-A9B5-8ECBC8F6C31A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{5E3E2AFD-1D6B-4997-A9B5-8ECBC8F6C31A}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{5E3E2AFD-1D6B-4997-A9B5-8ECBC8F6C31A}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{5E3E2AFD-1D6B-4997-A9B5-8ECBC8F6C31A}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{5E3E2AFD-1D6B-4997-A9B5-8ECBC8F6C31A}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
266
KattekerCreator/nsis/Examples/Plugin/exdll-vs2008.vcproj
Normal file
266
KattekerCreator/nsis/Examples/Plugin/exdll-vs2008.vcproj
Normal file
@ -0,0 +1,266 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="exdll"
|
||||
ProjectGUID="{5E3E2AFD-1D6B-4997-A9B5-8ECBC8F6C31A}"
|
||||
RootNamespace="exdll"
|
||||
TargetFrameworkVersion="0"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\Release"
|
||||
IntermediateDirectory=".\Release"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="true"
|
||||
SuppressStartupBanner="true"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\Release/exdll.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="1"
|
||||
InlineFunctionExpansion="0"
|
||||
AdditionalIncludeDirectories="."
|
||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_USRDLL;EXDLL_EXPORTS;NSISCALL=__stdcall"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="false"
|
||||
EnableFunctionLevelLinking="true"
|
||||
PrecompiledHeaderFile=".\Release/exdll.pch"
|
||||
AssemblerListingLocation=".\Release/"
|
||||
ObjectFile=".\Release/"
|
||||
ProgramDataBaseFileName=".\Release/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="odbc32.lib odbccp32.lib nsis\pluginapi.lib"
|
||||
OutputFile=".\Release/exdll.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
GenerateManifest="false"
|
||||
IgnoreAllDefaultLibraries="true"
|
||||
IgnoreDefaultLibraryNames="libc.lib"
|
||||
ProgramDatabaseFile=".\Release/exdll.pdb"
|
||||
OptimizeForWindows98="1"
|
||||
EntryPointSymbol="DllMain"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary=".\Release/exdll.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
OutputFile=".\Release/exdll.bsc"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\Debug"
|
||||
IntermediateDirectory=".\Debug"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="true"
|
||||
SuppressStartupBanner="true"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\Debug/exdll.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="."
|
||||
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;_USRDLL;EXDLL_EXPORTS;NSISCALL=__stdcall"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="0"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="false"
|
||||
PrecompiledHeaderFile=".\Debug/exdll.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
ProgramDataBaseFileName=".\Debug/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="odbc32.lib odbccp32.lib nsis\pluginapi.lib"
|
||||
OutputFile=".\Debug/exdll.dll"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
GenerateManifest="false"
|
||||
IgnoreAllDefaultLibraries="true"
|
||||
IgnoreDefaultLibraryNames=""
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile=".\Debug/exdll.pdb"
|
||||
EntryPointSymbol="DllMain"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary=".\Debug/exdll.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
OutputFile=".\Debug/exdll.bsc"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
>
|
||||
<File
|
||||
RelativePath="exdll.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl"
|
||||
>
|
||||
<File
|
||||
RelativePath="nsis\pluginapi.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
42
KattekerCreator/nsis/Examples/Plugin/exdll.c
Normal file
42
KattekerCreator/nsis/Examples/Plugin/exdll.c
Normal file
@ -0,0 +1,42 @@
|
||||
#include <windows.h>
|
||||
#include <nsis/pluginapi.h> // nsis plugin
|
||||
|
||||
HINSTANCE g_hInstance;
|
||||
HWND g_hwndParent;
|
||||
|
||||
// To work with Unicode version of NSIS, please use TCHAR-type
|
||||
// functions for accessing the variables and the stack.
|
||||
|
||||
void __declspec(dllexport) myFunction(HWND hwndParent, int string_size,
|
||||
LPTSTR variables, stack_t **stacktop,
|
||||
extra_parameters *extra, ...)
|
||||
{
|
||||
EXDLL_INIT();
|
||||
g_hwndParent = hwndParent;
|
||||
|
||||
|
||||
// note if you want parameters from the stack, pop them off in order.
|
||||
// i.e. if you are called via exdll::myFunction file.dat read.txt
|
||||
// calling popstring() the first time would give you file.dat,
|
||||
// and the second time would give you read.txt.
|
||||
// you should empty the stack of your parameters, and ONLY your
|
||||
// parameters.
|
||||
|
||||
// do your stuff here
|
||||
{
|
||||
LPTSTR msgbuf = (LPTSTR) GlobalAlloc(GPTR, (3 + string_size + 1) * sizeof(*msgbuf));
|
||||
if (msgbuf)
|
||||
{
|
||||
wsprintf(msgbuf, TEXT("$0=%s"), getuservariable(INST_0));
|
||||
MessageBox(g_hwndParent, msgbuf, TEXT("Message from example plugin"), MB_OK);
|
||||
GlobalFree(msgbuf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
||||
{
|
||||
g_hInstance = hInst;
|
||||
return TRUE;
|
||||
}
|
118
KattekerCreator/nsis/Examples/Plugin/exdll.dpr
Normal file
118
KattekerCreator/nsis/Examples/Plugin/exdll.dpr
Normal file
@ -0,0 +1,118 @@
|
||||
{
|
||||
NSIS ExDLL example
|
||||
(C) 2001 - Peter Windridge
|
||||
|
||||
Fixed and formatted by Brett Dever
|
||||
http://editor.nfscheats.com/
|
||||
|
||||
Tested in Delphi 7.0
|
||||
}
|
||||
|
||||
library exdll;
|
||||
|
||||
uses Windows;
|
||||
|
||||
type
|
||||
VarConstants = (
|
||||
INST_0,
|
||||
INST_1, // $1
|
||||
INST_2, // $2
|
||||
INST_3, // $3
|
||||
INST_4, // $4
|
||||
INST_5, // $5
|
||||
INST_6, // $6
|
||||
INST_7, // $7
|
||||
INST_8, // $8
|
||||
INST_9, // $9
|
||||
INST_R0, // $R0
|
||||
INST_R1, // $R1
|
||||
INST_R2, // $R2
|
||||
INST_R3, // $R3
|
||||
INST_R4, // $R4
|
||||
INST_R5, // $R5
|
||||
INST_R6, // $R6
|
||||
INST_R7, // $R7
|
||||
INST_R8, // $R8
|
||||
INST_R9, // $R9
|
||||
INST_CMDLINE, // $CMDLINE
|
||||
INST_INSTDIR, // $INSTDIR
|
||||
INST_OUTDIR, // $OUTDIR
|
||||
INST_EXEDIR, // $EXEDIR
|
||||
INST_LANG, // $LANGUAGE
|
||||
__INST_LAST
|
||||
);
|
||||
TVariableList = INST_0..__INST_LAST;
|
||||
pstack_t = ^stack_t;
|
||||
stack_t = record
|
||||
next: pstack_t;
|
||||
text: PChar;
|
||||
end;
|
||||
|
||||
var
|
||||
g_stringsize: integer;
|
||||
g_stacktop: ^pstack_t;
|
||||
g_variables: PChar;
|
||||
g_hwndParent: HWND;
|
||||
|
||||
function PopString(): string;
|
||||
var
|
||||
th: pstack_t;
|
||||
begin
|
||||
if integer(g_stacktop^) <> 0 then begin
|
||||
th := g_stacktop^;
|
||||
Result := PChar(@th.text);
|
||||
g_stacktop^ := th.next;
|
||||
GlobalFree(HGLOBAL(th));
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure PushString(const str: string='');
|
||||
var
|
||||
th: pstack_t;
|
||||
begin
|
||||
if integer(g_stacktop) <> 0 then begin
|
||||
th := pstack_t(GlobalAlloc(GPTR, SizeOf(stack_t) + g_stringsize));
|
||||
lstrcpyn(@th.text, PChar(str), g_stringsize);
|
||||
th.next := g_stacktop^;
|
||||
g_stacktop^ := th;
|
||||
end;
|
||||
end;
|
||||
|
||||
function GetUserVariable(const varnum: TVariableList): string;
|
||||
begin
|
||||
if (integer(varnum) >= 0) and (integer(varnum) < integer(__INST_LAST)) then
|
||||
Result := g_variables + integer(varnum) * g_stringsize
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
|
||||
procedure SetUserVariable(const varnum: TVariableList; const value: string);
|
||||
begin
|
||||
if (value <> '') and (integer(varnum) >= 0) and (integer(varnum) < integer(__INST_LAST)) then
|
||||
lstrcpy(g_variables + integer(varnum) * g_stringsize, PChar(value))
|
||||
end;
|
||||
|
||||
procedure NSISDialog(const text, caption: string; const buttons: integer);
|
||||
begin
|
||||
MessageBox(g_hwndParent, PChar(text), PChar(caption), buttons);
|
||||
end;
|
||||
|
||||
procedure ex_dll(const hwndParent: HWND; const string_size: integer; const variables: PChar; const stacktop: pointer); cdecl;
|
||||
begin
|
||||
// setup global variables
|
||||
g_stringsize := string_size;
|
||||
g_hwndParent := hwndParent;
|
||||
g_stacktop := stacktop;
|
||||
g_variables := variables;
|
||||
// end global variable setup
|
||||
|
||||
NSISDialog(GetUserVariable(INST_0), 'The value of $0', MB_OK);
|
||||
NSISDialog(PopString, 'pop', MB_OK);
|
||||
PushString('Hello, this is a push');
|
||||
SetUserVariable(INST_0, 'This is user var $0');
|
||||
end;
|
||||
|
||||
exports ex_dll;
|
||||
|
||||
begin
|
||||
end.
|
112
KattekerCreator/nsis/Examples/Plugin/exdll.dsp
Normal file
112
KattekerCreator/nsis/Examples/Plugin/exdll.dsp
Normal file
@ -0,0 +1,112 @@
|
||||
# Microsoft Developer Studio Project File - Name="exdll" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=exdll - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "exdll.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "exdll.mak" CFG="exdll - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "exdll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "exdll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "exdll - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXDLL_EXPORTS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O1 /I "." /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXDLL_EXPORTS" /D NSISCALL=__stdcall /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib nsis\pluginapi.lib /nologo /entry:"DllMain" /dll /machine:I386 /nodefaultlib /out:"../../Plugins/exdll.dll" /opt:nowin98
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ELSEIF "$(CFG)" == "exdll - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXDLL_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "." /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXDLL_EXPORTS" /D NSISCALL=__stdcall /YX /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib nsis\pluginapi.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "exdll - Win32 Release"
|
||||
# Name "exdll - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\exdll.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsis\pluginapi.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
29
KattekerCreator/nsis/Examples/Plugin/exdll.dsw
Normal file
29
KattekerCreator/nsis/Examples/Plugin/exdll.dsw
Normal file
@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "exdll"=.\exdll.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
93
KattekerCreator/nsis/Examples/Plugin/exdll_with_unit.dpr
Normal file
93
KattekerCreator/nsis/Examples/Plugin/exdll_with_unit.dpr
Normal file
@ -0,0 +1,93 @@
|
||||
{
|
||||
NSIS ExDLL2 example
|
||||
Original is ExDLL
|
||||
(C) 2001 - Peter Windridge
|
||||
|
||||
Changed with delphi unit nsis.pas
|
||||
by bernhard mayer
|
||||
|
||||
Tested in Delphi 7.0
|
||||
}
|
||||
|
||||
// Example NSIS code
|
||||
{
|
||||
Section
|
||||
exdll_with_unit::registerplugincallback
|
||||
|
||||
StrCpy $0 "Hello"
|
||||
Push "World"
|
||||
exdll_with_unit::pop_dlg_push
|
||||
Pop $1
|
||||
DetailPrint $$0=$0
|
||||
DetailPrint $$1=$1
|
||||
|
||||
GetFunctionAddress $0 nsistest
|
||||
Push $0
|
||||
exdll_with_unit::callnsisfunc
|
||||
SectionEnd
|
||||
|
||||
Function nsistest
|
||||
DetailPrint "Hello from NSIS function"
|
||||
FunctionEnd
|
||||
}
|
||||
|
||||
|
||||
library exdll;
|
||||
|
||||
uses
|
||||
nsis, windows;
|
||||
|
||||
|
||||
procedure pop_dlg_push(const hwndParent: HWND; const string_size: integer; const variables: PChar; const stacktop: pointer); cdecl;
|
||||
begin
|
||||
// set up global variables
|
||||
Init(hwndParent, string_size, variables, stacktop);
|
||||
|
||||
NSISDialog(GetUserVariable(INST_0), 'The value of $0', MB_OK);
|
||||
NSISDialog(PopString, 'pop', MB_OK);
|
||||
PushString('Hello, this is a push');
|
||||
SetUserVariable(INST_0, 'This is user var $0');
|
||||
end;
|
||||
|
||||
|
||||
procedure callnsisfunc(const hwndParent: HWND; const string_size: integer; const variables: PChar; const stacktop: pointer; const extraparameters: pointer); cdecl;
|
||||
var
|
||||
FuncAddr : String;
|
||||
begin
|
||||
Init(hwndParent, string_size, variables, stacktop, extraparameters);
|
||||
|
||||
FuncAddr := PopString();
|
||||
Call(FuncAddr);
|
||||
end;
|
||||
|
||||
|
||||
function mynsiscallback(const NSPIM: TNSPIM): Pointer; cdecl;
|
||||
begin
|
||||
Result := nil;
|
||||
if NSPIM = NSPIM_UNLOAD then
|
||||
begin
|
||||
NSISDialog(PChar('NSPIM_UNLOAD is the final callback, goodbye...'), PChar('mynsiscallback'), MB_OK);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure registerplugincallback(const hwndParent: HWND; const string_size: integer; const variables: PChar; const stacktop: pointer; const extraparameters: pointer); cdecl;
|
||||
var
|
||||
ThisDllInstance : HMODULE;
|
||||
begin
|
||||
Init(hwndParent, string_size, variables, stacktop, extraparameters);
|
||||
|
||||
if g_extraparameters <> nil then
|
||||
begin
|
||||
ThisDllInstance := hInstance;
|
||||
TRegisterPluginCallback(g_extraparameters.RegisterPluginCallback)(ThisDllInstance, @mynsiscallback);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
exports pop_dlg_push;
|
||||
exports callnsisfunc;
|
||||
exports registerplugincallback;
|
||||
|
||||
begin
|
||||
end.
|
145
KattekerCreator/nsis/Examples/Plugin/extdll.inc
Normal file
145
KattekerCreator/nsis/Examples/Plugin/extdll.inc
Normal file
@ -0,0 +1,145 @@
|
||||
;################################################################
|
||||
; ExtDLL header for MASM32
|
||||
;
|
||||
; Author: Ramon
|
||||
;
|
||||
; Obs: This header must be included after windows.inc and kernel32.inc
|
||||
; because it need the prototypes for lstrcpy, lstrcpyn,
|
||||
; GlobalAlloc and GlobalFree
|
||||
;
|
||||
;################################################################
|
||||
stack_t struct
|
||||
next dd ?
|
||||
text dd ? ; 1 DUP(?) ; this should be the length of string_size
|
||||
stack_t ends
|
||||
|
||||
.const
|
||||
; For page showing plug-ins
|
||||
WM_NOTIFY_OUTER_NEXT equ (WM_USER+0x8)
|
||||
WM_NOTIFY_CUSTOM_READY equ (WM_USER+0xd)
|
||||
NOTIFY_BYE_BYE equ 'x'
|
||||
|
||||
INST_0 EQU 0 ; $0
|
||||
INST_1 EQU 1 ; $1
|
||||
INST_2 EQU 2 ; $2
|
||||
INST_3 EQU 3 ; $3
|
||||
INST_4 EQU 4 ; $4
|
||||
INST_5 EQU 5 ; $5
|
||||
INST_6 EQU 6 ; $6
|
||||
INST_7 EQU 7 ; $7
|
||||
INST_8 EQU 8 ; $8
|
||||
INST_9 EQU 9 ; $9
|
||||
INST_R0 EQU 10 ; $R0
|
||||
INST_R1 EQU 11 ; $R1
|
||||
INST_R2 EQU 12 ; $R2
|
||||
INST_R3 EQU 13 ; $R3
|
||||
INST_R4 EQU 14 ; $R4
|
||||
INST_R5 EQU 15 ; $R5
|
||||
INST_R6 EQU 16 ; $R6
|
||||
INST_R7 EQU 17 ; $R7
|
||||
INST_R8 EQU 18 ; $R8
|
||||
INST_R9 EQU 19 ; $R9
|
||||
INST_CMDLINE EQU 20 ; $CMDLINE
|
||||
INST_INSTDIR EQU 21 ; $INSTDIR
|
||||
INST_OUTDIR EQU 22 ; $OUTDIR
|
||||
INST_EXEDIR EQU 23 ; $EXEDIR
|
||||
INST_LANG EQU 24 ; $LANGUAGE
|
||||
__INST_LAST EQU 25
|
||||
|
||||
.data?
|
||||
g_stringsize dd ?
|
||||
g_stacktop dd ?
|
||||
g_variables dd ?
|
||||
|
||||
m2m MACRO M1, M2
|
||||
push M2
|
||||
pop M1
|
||||
ENDM
|
||||
|
||||
EXDLL_INIT MACRO
|
||||
m2m g_stringsize, string_size
|
||||
m2m g_stacktop, stacktop
|
||||
m2m g_variables, variables
|
||||
ENDM
|
||||
|
||||
.code
|
||||
|
||||
; utility functions (not required but often useful)
|
||||
popstring proc uses edi pStr:DWORD
|
||||
|
||||
LOCAL th:DWORD
|
||||
|
||||
mov edi, g_stacktop
|
||||
cmp edi, 0
|
||||
jz STACK_ERR
|
||||
mov edi, [edi]
|
||||
cmp edi, 0
|
||||
jz STACK_ERR
|
||||
|
||||
ASSUME edi:PTR stack_t
|
||||
invoke lstrcpy, pStr, ADDR [edi].text
|
||||
mov th , edi
|
||||
mov edi, [edi].next
|
||||
mov eax, g_stacktop
|
||||
mov [eax], edi
|
||||
invoke GlobalFree, th
|
||||
ASSUME edi:PTR NOTHING
|
||||
mov eax, 0
|
||||
ret
|
||||
|
||||
STACK_ERR:
|
||||
mov eax, 1
|
||||
ret
|
||||
|
||||
popstring endp
|
||||
|
||||
pushstring proc uses edi pStr:DWORD
|
||||
|
||||
cmp g_stacktop, 0
|
||||
jz STACK_ERR
|
||||
|
||||
mov eax, sizeof stack_t
|
||||
add eax, g_stringsize
|
||||
invoke GlobalAlloc, GPTR, eax
|
||||
|
||||
mov edi, eax
|
||||
assume edi:PTR stack_t
|
||||
|
||||
invoke lstrcpyn, ADDR [edi].text, pStr, g_stringsize
|
||||
mov eax, g_stacktop
|
||||
push DWORD PTR[eax]
|
||||
mov [eax], edi
|
||||
pop eax
|
||||
;lea edi, [edi].next ; Not needed [edi].next == edi
|
||||
mov DWORD PTR[edi], eax
|
||||
ASSUME edi:PTR NOTHING
|
||||
|
||||
STACK_ERR:
|
||||
ret
|
||||
|
||||
pushstring endp
|
||||
|
||||
getuservariable proc varnum:DWORD
|
||||
|
||||
.if varnum < 0 || varnum >= __INST_LAST
|
||||
xor eax, eax
|
||||
.else
|
||||
mov eax, varnum
|
||||
imul eax, g_stringsize
|
||||
add eax, g_variables
|
||||
.endif
|
||||
ret
|
||||
|
||||
getuservariable endp
|
||||
|
||||
setuservariable proc varnum:DWORD, var:DWORD
|
||||
|
||||
.if (var != NULL && varnum >= 0 && varnum < __INST_LAST)
|
||||
mov eax, varnum
|
||||
imul eax, g_stringsize
|
||||
add eax, g_variables
|
||||
invoke lstrcpy, eax, var
|
||||
.endif
|
||||
ret
|
||||
|
||||
setuservariable endp
|
209
KattekerCreator/nsis/Examples/Plugin/nsis.pas
Normal file
209
KattekerCreator/nsis/Examples/Plugin/nsis.pas
Normal file
@ -0,0 +1,209 @@
|
||||
{
|
||||
Original Code from
|
||||
(C) 2001 - Peter Windridge
|
||||
|
||||
Code in separate unit and some changes
|
||||
2003 by Bernhard Mayer
|
||||
|
||||
Fixed and formatted by Brett Dever
|
||||
http://editor.nfscheats.com/
|
||||
|
||||
simply include this unit in your plugin project and export
|
||||
functions as needed
|
||||
}
|
||||
|
||||
unit nsis;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
windows, CommCtrl, SysUtils;
|
||||
|
||||
type
|
||||
VarConstants = (
|
||||
INST_0, // $0
|
||||
INST_1, // $1
|
||||
INST_2, // $2
|
||||
INST_3, // $3
|
||||
INST_4, // $4
|
||||
INST_5, // $5
|
||||
INST_6, // $6
|
||||
INST_7, // $7
|
||||
INST_8, // $8
|
||||
INST_9, // $9
|
||||
INST_R0, // $R0
|
||||
INST_R1, // $R1
|
||||
INST_R2, // $R2
|
||||
INST_R3, // $R3
|
||||
INST_R4, // $R4
|
||||
INST_R5, // $R5
|
||||
INST_R6, // $R6
|
||||
INST_R7, // $R7
|
||||
INST_R8, // $R8
|
||||
INST_R9, // $R9
|
||||
INST_CMDLINE, // $CMDLINE
|
||||
INST_INSTDIR, // $INSTDIR
|
||||
INST_OUTDIR, // $OUTDIR
|
||||
INST_EXEDIR, // $EXEDIR
|
||||
INST_LANG, // $LANGUAGE
|
||||
__INST_LAST
|
||||
);
|
||||
TVariableList = INST_0..__INST_LAST;
|
||||
|
||||
type
|
||||
PluginCallbackMessages = (
|
||||
NSPIM_UNLOAD, // This is the last message a plugin gets, do final cleanup
|
||||
NSPIM_GUIUNLOAD // Called after .onGUIEnd
|
||||
);
|
||||
TNSPIM = NSPIM_UNLOAD..NSPIM_GUIUNLOAD;
|
||||
|
||||
//TPluginCallback = function (const NSPIM: Integer): Pointer; cdecl;
|
||||
|
||||
TExecuteCodeSegment = function (const funct_id: Integer; const parent: HWND): Integer; stdcall;
|
||||
Tvalidate_filename = procedure (const filename: PChar); stdcall;
|
||||
TRegisterPluginCallback = function (const DllInstance: HMODULE; const CallbackFunction: Pointer): Integer; stdcall;
|
||||
|
||||
pexec_flags_t = ^exec_flags_t;
|
||||
exec_flags_t = record
|
||||
autoclose: Integer;
|
||||
all_user_var: Integer;
|
||||
exec_error: Integer;
|
||||
abort: Integer;
|
||||
exec_reboot: Integer;
|
||||
reboot_called: Integer;
|
||||
XXX_cur_insttype: Integer;
|
||||
plugin_api_version: Integer;
|
||||
silent: Integer;
|
||||
instdir_error: Integer;
|
||||
rtl: Integer;
|
||||
errlvl: Integer;
|
||||
alter_reg_view: Integer;
|
||||
status_update: Integer;
|
||||
end;
|
||||
|
||||
pextrap_t = ^extrap_t;
|
||||
extrap_t = record
|
||||
exec_flags: Pointer; // exec_flags_t;
|
||||
exec_code_segment: TExecuteCodeSegment; // TFarProc;
|
||||
validate_filename: Pointer; // Tvalidate_filename;
|
||||
RegisterPluginCallback: Pointer; //TRegisterPluginCallback;
|
||||
end;
|
||||
|
||||
pstack_t = ^stack_t;
|
||||
stack_t = record
|
||||
next: pstack_t;
|
||||
text: PChar;
|
||||
end;
|
||||
|
||||
var
|
||||
g_stringsize: integer;
|
||||
g_stacktop: ^pstack_t;
|
||||
g_variables: PChar;
|
||||
g_hwndParent: HWND;
|
||||
g_hwndList: HWND;
|
||||
g_hwndLogList: HWND;
|
||||
g_extraparameters: pextrap_t;
|
||||
|
||||
procedure Init(const hwndParent: HWND; const string_size: integer; const variables: PChar; const stacktop: pointer; const extraparameters: pointer = nil);
|
||||
|
||||
function LogMessage(Msg : String): BOOL;
|
||||
function Call(NSIS_func : String) : Integer;
|
||||
function PopString(): string;
|
||||
procedure PushString(const str: string='');
|
||||
function GetUserVariable(const varnum: TVariableList): string;
|
||||
procedure SetUserVariable(const varnum: TVariableList; const value: string);
|
||||
procedure NSISDialog(const text, caption: string; const buttons: integer);
|
||||
|
||||
implementation
|
||||
|
||||
procedure Init(const hwndParent: HWND; const string_size: integer; const variables: PChar; const stacktop: pointer; const extraparameters: pointer = nil);
|
||||
begin
|
||||
g_stringsize := string_size;
|
||||
g_hwndParent := hwndParent;
|
||||
g_stacktop := stacktop;
|
||||
g_variables := variables;
|
||||
g_hwndList := FindWindowEx(FindWindowEx(g_hwndParent, 0, '#32770', nil), 0,'SysListView32', nil);
|
||||
g_extraparameters := extraparameters;
|
||||
end;
|
||||
|
||||
|
||||
function Call(NSIS_func : String) : Integer;
|
||||
var
|
||||
codeoffset: Integer; //The ID of nsis function
|
||||
begin
|
||||
Result := 0;
|
||||
codeoffset := StrToIntDef(NSIS_func, 0);
|
||||
if (codeoffset <> 0) and (g_extraparameters <> nil) then
|
||||
begin
|
||||
codeoffset := codeoffset - 1;
|
||||
Result := g_extraparameters.exec_code_segment(codeoffset, g_hwndParent);
|
||||
end;
|
||||
end;
|
||||
|
||||
function LogMessage(Msg : String): BOOL;
|
||||
var
|
||||
ItemCount : Integer;
|
||||
item: TLVItem;
|
||||
begin
|
||||
Result := FAlse;
|
||||
if g_hwndList = 0 then exit;
|
||||
FillChar( item, sizeof(item), 0 );
|
||||
ItemCount := SendMessage(g_hwndList, LVM_GETITEMCOUNT, 0, 0);
|
||||
item.iItem := ItemCount;
|
||||
item.mask := LVIF_TEXT;
|
||||
item.pszText := PChar(Msg);
|
||||
ListView_InsertItem(g_hwndList, item);
|
||||
ListView_EnsureVisible(g_hwndList, ItemCount, TRUE);
|
||||
end;
|
||||
|
||||
function PopString(): string;
|
||||
var
|
||||
th: pstack_t;
|
||||
begin
|
||||
if integer(g_stacktop^) <> 0 then begin
|
||||
th := g_stacktop^;
|
||||
Result := PChar(@th.text);
|
||||
g_stacktop^ := th.next;
|
||||
GlobalFree(HGLOBAL(th));
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure PushString(const str: string='');
|
||||
var
|
||||
th: pstack_t;
|
||||
begin
|
||||
if integer(g_stacktop) <> 0 then begin
|
||||
th := pstack_t(GlobalAlloc(GPTR, SizeOf(stack_t) + g_stringsize));
|
||||
lstrcpyn(@th.text, PChar(str), g_stringsize);
|
||||
th.next := g_stacktop^;
|
||||
g_stacktop^ := th;
|
||||
end;
|
||||
end;
|
||||
|
||||
function GetUserVariable(const varnum: TVariableList): string;
|
||||
begin
|
||||
if (integer(varnum) >= 0) and (integer(varnum) < integer(__INST_LAST)) then
|
||||
Result := g_variables + integer(varnum) * g_stringsize
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
|
||||
procedure SetUserVariable(const varnum: TVariableList; const value: string);
|
||||
begin
|
||||
if (value <> '') and (integer(varnum) >= 0) and (integer(varnum) < integer(__INST_LAST)) then
|
||||
lstrcpy(g_variables + integer(varnum) * g_stringsize, PChar(value))
|
||||
end;
|
||||
|
||||
procedure NSISDialog(const text, caption: string; const buttons: integer);
|
||||
var
|
||||
hwndOwner: HWND;
|
||||
begin
|
||||
hwndOwner := g_hwndParent;
|
||||
if not IsWindow(g_hwndParent) then hwndOwner := 0; // g_hwndParent is not valid in NSPIM_[GUI]UNLOAD
|
||||
MessageBox(hwndOwner, PChar(text), PChar(caption), buttons);
|
||||
end;
|
||||
|
||||
begin
|
||||
|
||||
end.
|
||||
|
85
KattekerCreator/nsis/Examples/Plugin/nsis/api.h
Normal file
85
KattekerCreator/nsis/Examples/Plugin/nsis/api.h
Normal file
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* apih
|
||||
*
|
||||
* This file is a part of NSIS.
|
||||
*
|
||||
* Copyright (C) 1999-2018 Nullsoft and Contributors
|
||||
*
|
||||
* Licensed under the zlib/libpng license (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
*
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*/
|
||||
|
||||
#ifndef _NSIS_EXEHEAD_API_H_
|
||||
#define _NSIS_EXEHEAD_API_H_
|
||||
|
||||
// Starting with NSIS 2.42, you can check the version of the plugin API in exec_flags->plugin_api_version
|
||||
// The format is 0xXXXXYYYY where X is the major version and Y is the minor version (MAKELONG(y,x))
|
||||
// When doing version checks, always remember to use >=, ex: if (pX->exec_flags->plugin_api_version >= NSISPIAPIVER_1_0) {}
|
||||
|
||||
#define NSISPIAPIVER_1_0 0x00010000
|
||||
#define NSISPIAPIVER_CURR NSISPIAPIVER_1_0
|
||||
|
||||
// NSIS Plug-In Callback Messages
|
||||
enum NSPIM
|
||||
{
|
||||
NSPIM_UNLOAD, // This is the last message a plugin gets, do final cleanup
|
||||
NSPIM_GUIUNLOAD, // Called after .onGUIEnd
|
||||
};
|
||||
|
||||
// Prototype for callbacks registered with extra_parameters->RegisterPluginCallback()
|
||||
// Return NULL for unknown messages
|
||||
// Should always be __cdecl for future expansion possibilities
|
||||
typedef UINT_PTR (*NSISPLUGINCALLBACK)(enum NSPIM);
|
||||
|
||||
// extra_parameters data structure containing other interesting stuff
|
||||
// besides the stack, variables and HWND passed on to plug-ins.
|
||||
typedef struct
|
||||
{
|
||||
int autoclose; // SetAutoClose
|
||||
int all_user_var; // SetShellVarContext: User context = 0, Machine context = 1
|
||||
int exec_error; // IfErrors
|
||||
int abort; // IfAbort
|
||||
int exec_reboot; // IfRebootFlag (NSIS_SUPPORT_REBOOT)
|
||||
int reboot_called; // NSIS_SUPPORT_REBOOT
|
||||
int XXX_cur_insttype; // Deprecated
|
||||
int plugin_api_version; // Plug-in ABI. See NSISPIAPIVER_CURR (Note: used to be XXX_insttype_changed)
|
||||
int silent; // IfSilent (NSIS_CONFIG_SILENT_SUPPORT)
|
||||
int instdir_error; // GetInstDirError
|
||||
int rtl; // 1 if $LANGUAGE is a RTL language
|
||||
int errlvl; // SetErrorLevel
|
||||
int alter_reg_view; // SetRegView: Default View = 0, Alternative View = (sizeof(void*) > 4 ? KEY_WOW64_32KEY : KEY_WOW64_64KEY)
|
||||
int status_update; // SetDetailsPrint
|
||||
} exec_flags_t;
|
||||
|
||||
#ifndef NSISCALL
|
||||
# define NSISCALL __stdcall
|
||||
#endif
|
||||
#if !defined(_WIN32) && !defined(LPTSTR)
|
||||
# define LPTSTR TCHAR*
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
exec_flags_t *exec_flags;
|
||||
int (NSISCALL *ExecuteCodeSegment)(int, HWND);
|
||||
void (NSISCALL *validate_filename)(LPTSTR);
|
||||
int (NSISCALL *RegisterPluginCallback)(HMODULE, NSISPLUGINCALLBACK); // returns 0 on success, 1 if already registered and < 0 on errors
|
||||
} extra_parameters;
|
||||
|
||||
// Definitions for page showing plug-ins
|
||||
// See Ui.c to understand better how they're used
|
||||
|
||||
// sent to the outer window to tell it to go to the next inner window
|
||||
#define WM_NOTIFY_OUTER_NEXT (WM_USER+0x8)
|
||||
|
||||
// custom pages should send this message to let NSIS know they're ready
|
||||
#define WM_NOTIFY_CUSTOM_READY (WM_USER+0xd)
|
||||
|
||||
// sent as wParam with WM_NOTIFY_OUTER_NEXT when user cancels - heed its warning
|
||||
#define NOTIFY_BYE_BYE 'x'
|
||||
|
||||
#endif /* _NSIS_EXEHEAD_API_H_ */
|
229
KattekerCreator/nsis/Examples/Plugin/nsis/nsis_tchar.h
Normal file
229
KattekerCreator/nsis/Examples/Plugin/nsis/nsis_tchar.h
Normal file
@ -0,0 +1,229 @@
|
||||
/*
|
||||
* nsis_tchar.h
|
||||
*
|
||||
* This file is a part of NSIS.
|
||||
*
|
||||
* Copyright (C) 1999-2018 Nullsoft and Contributors
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* For Unicode support by Jim Park -- 08/30/2007
|
||||
*/
|
||||
|
||||
// Jim Park: Only those we use are listed here.
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef _UNICODE
|
||||
|
||||
#ifndef _T
|
||||
#define __T(x) L ## x
|
||||
#define _T(x) __T(x)
|
||||
#define _TEXT(x) __T(x)
|
||||
#endif
|
||||
|
||||
#ifndef _TCHAR_DEFINED
|
||||
#define _TCHAR_DEFINED
|
||||
#if !defined(_NATIVE_WCHAR_T_DEFINED) && !defined(_WCHAR_T_DEFINED)
|
||||
typedef unsigned short TCHAR;
|
||||
#else
|
||||
typedef wchar_t TCHAR;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// program
|
||||
#define _tenviron _wenviron
|
||||
#define __targv __wargv
|
||||
|
||||
// printfs
|
||||
#define _ftprintf fwprintf
|
||||
#define _sntprintf _snwprintf
|
||||
#if (defined(_MSC_VER) && (_MSC_VER<=1310||_MSC_FULL_VER<=140040310)) || defined(__MINGW32__)
|
||||
# define _stprintf swprintf
|
||||
#else
|
||||
# define _stprintf _swprintf
|
||||
#endif
|
||||
#define _tprintf wprintf
|
||||
#define _vftprintf vfwprintf
|
||||
#define _vsntprintf _vsnwprintf
|
||||
#if defined(_MSC_VER) && (_MSC_VER<=1310)
|
||||
# define _vstprintf vswprintf
|
||||
#else
|
||||
# define _vstprintf _vswprintf
|
||||
#endif
|
||||
|
||||
// scanfs
|
||||
#define _tscanf wscanf
|
||||
#define _stscanf swscanf
|
||||
|
||||
// string manipulations
|
||||
#define _tcscat wcscat
|
||||
#define _tcschr wcschr
|
||||
#define _tcsclen wcslen
|
||||
#define _tcscpy wcscpy
|
||||
#define _tcsdup _wcsdup
|
||||
#define _tcslen wcslen
|
||||
#define _tcsnccpy wcsncpy
|
||||
#define _tcsncpy wcsncpy
|
||||
#define _tcsrchr wcsrchr
|
||||
#define _tcsstr wcsstr
|
||||
#define _tcstok wcstok
|
||||
|
||||
// string comparisons
|
||||
#define _tcscmp wcscmp
|
||||
#define _tcsicmp _wcsicmp
|
||||
#define _tcsncicmp _wcsnicmp
|
||||
#define _tcsncmp wcsncmp
|
||||
#define _tcsnicmp _wcsnicmp
|
||||
|
||||
// upper / lower
|
||||
#define _tcslwr _wcslwr
|
||||
#define _tcsupr _wcsupr
|
||||
#define _totlower towlower
|
||||
#define _totupper towupper
|
||||
|
||||
// conversions to numbers
|
||||
#define _tcstoi64 _wcstoi64
|
||||
#define _tcstol wcstol
|
||||
#define _tcstoul wcstoul
|
||||
#define _tstof _wtof
|
||||
#define _tstoi _wtoi
|
||||
#define _tstoi64 _wtoi64
|
||||
#define _ttoi _wtoi
|
||||
#define _ttoi64 _wtoi64
|
||||
#define _ttol _wtol
|
||||
|
||||
// conversion from numbers to strings
|
||||
#define _itot _itow
|
||||
#define _ltot _ltow
|
||||
#define _i64tot _i64tow
|
||||
#define _ui64tot _ui64tow
|
||||
|
||||
// file manipulations
|
||||
#define _tfopen _wfopen
|
||||
#define _topen _wopen
|
||||
#define _tremove _wremove
|
||||
#define _tunlink _wunlink
|
||||
|
||||
// reading and writing to i/o
|
||||
#define _fgettc fgetwc
|
||||
#define _fgetts fgetws
|
||||
#define _fputts fputws
|
||||
#define _gettchar getwchar
|
||||
|
||||
// directory
|
||||
#define _tchdir _wchdir
|
||||
|
||||
// environment
|
||||
#define _tgetenv _wgetenv
|
||||
#define _tsystem _wsystem
|
||||
|
||||
// time
|
||||
#define _tcsftime wcsftime
|
||||
|
||||
#else // ANSI
|
||||
|
||||
#ifndef _T
|
||||
#define _T(x) x
|
||||
#define _TEXT(x) x
|
||||
#endif
|
||||
|
||||
#ifndef _TCHAR_DEFINED
|
||||
#define _TCHAR_DEFINED
|
||||
typedef char TCHAR;
|
||||
#endif
|
||||
|
||||
// program
|
||||
#define _tenviron environ
|
||||
#define __targv __argv
|
||||
|
||||
// printfs
|
||||
#define _ftprintf fprintf
|
||||
#define _sntprintf _snprintf
|
||||
#define _stprintf sprintf
|
||||
#define _tprintf printf
|
||||
#define _vftprintf vfprintf
|
||||
#define _vsntprintf _vsnprintf
|
||||
#define _vstprintf vsprintf
|
||||
|
||||
// scanfs
|
||||
#define _tscanf scanf
|
||||
#define _stscanf sscanf
|
||||
|
||||
// string manipulations
|
||||
#define _tcscat strcat
|
||||
#define _tcschr strchr
|
||||
#define _tcsclen strlen
|
||||
#define _tcscnlen strnlen
|
||||
#define _tcscpy strcpy
|
||||
#define _tcsdup _strdup
|
||||
#define _tcslen strlen
|
||||
#define _tcsnccpy strncpy
|
||||
#define _tcsrchr strrchr
|
||||
#define _tcsstr strstr
|
||||
#define _tcstok strtok
|
||||
|
||||
// string comparisons
|
||||
#define _tcscmp strcmp
|
||||
#define _tcsicmp _stricmp
|
||||
#define _tcsncmp strncmp
|
||||
#define _tcsncicmp _strnicmp
|
||||
#define _tcsnicmp _strnicmp
|
||||
|
||||
// upper / lower
|
||||
#define _tcslwr _strlwr
|
||||
#define _tcsupr _strupr
|
||||
|
||||
#define _totupper toupper
|
||||
#define _totlower tolower
|
||||
|
||||
// conversions to numbers
|
||||
#define _tcstol strtol
|
||||
#define _tcstoul strtoul
|
||||
#define _tstof atof
|
||||
#define _tstoi atoi
|
||||
#define _tstoi64 _atoi64
|
||||
#define _tstoi64 _atoi64
|
||||
#define _ttoi atoi
|
||||
#define _ttoi64 _atoi64
|
||||
#define _ttol atol
|
||||
|
||||
// conversion from numbers to strings
|
||||
#define _i64tot _i64toa
|
||||
#define _itot _itoa
|
||||
#define _ltot _ltoa
|
||||
#define _ui64tot _ui64toa
|
||||
|
||||
// file manipulations
|
||||
#define _tfopen fopen
|
||||
#define _topen _open
|
||||
#define _tremove remove
|
||||
#define _tunlink _unlink
|
||||
|
||||
// reading and writing to i/o
|
||||
#define _fgettc fgetc
|
||||
#define _fgetts fgets
|
||||
#define _fputts fputs
|
||||
#define _gettchar getchar
|
||||
|
||||
// directory
|
||||
#define _tchdir _chdir
|
||||
|
||||
// environment
|
||||
#define _tgetenv getenv
|
||||
#define _tsystem system
|
||||
|
||||
// time
|
||||
#define _tcsftime strftime
|
||||
|
||||
#endif
|
||||
|
||||
// is functions (the same in Unicode / ANSI)
|
||||
#define _istgraph isgraph
|
||||
#define _istascii __isascii
|
||||
|
||||
#define __TFILE__ _T(__FILE__)
|
||||
#define __TDATE__ _T(__DATE__)
|
||||
#define __TTIME__ _T(__TIME__)
|
BIN
KattekerCreator/nsis/Examples/Plugin/nsis/pluginapi-x86-ansi.lib
Normal file
BIN
KattekerCreator/nsis/Examples/Plugin/nsis/pluginapi-x86-ansi.lib
Normal file
Binary file not shown.
Binary file not shown.
108
KattekerCreator/nsis/Examples/Plugin/nsis/pluginapi.h
Normal file
108
KattekerCreator/nsis/Examples/Plugin/nsis/pluginapi.h
Normal file
@ -0,0 +1,108 @@
|
||||
#ifndef ___NSIS_PLUGIN__H___
|
||||
#define ___NSIS_PLUGIN__H___
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "api.h"
|
||||
#include "nsis_tchar.h" // BUGBUG: Why cannot our plugins use the compilers tchar.h?
|
||||
|
||||
#ifndef NSISCALL
|
||||
# define NSISCALL WINAPI
|
||||
#endif
|
||||
|
||||
#define EXDLL_INIT() { \
|
||||
g_stringsize=string_size; \
|
||||
g_stacktop=stacktop; \
|
||||
g_variables=variables; }
|
||||
|
||||
typedef struct _stack_t {
|
||||
struct _stack_t *next;
|
||||
#ifdef UNICODE
|
||||
WCHAR text[1]; // this should be the length of g_stringsize when allocating
|
||||
#else
|
||||
char text[1];
|
||||
#endif
|
||||
} stack_t;
|
||||
|
||||
enum
|
||||
{
|
||||
INST_0, // $0
|
||||
INST_1, // $1
|
||||
INST_2, // $2
|
||||
INST_3, // $3
|
||||
INST_4, // $4
|
||||
INST_5, // $5
|
||||
INST_6, // $6
|
||||
INST_7, // $7
|
||||
INST_8, // $8
|
||||
INST_9, // $9
|
||||
INST_R0, // $R0
|
||||
INST_R1, // $R1
|
||||
INST_R2, // $R2
|
||||
INST_R3, // $R3
|
||||
INST_R4, // $R4
|
||||
INST_R5, // $R5
|
||||
INST_R6, // $R6
|
||||
INST_R7, // $R7
|
||||
INST_R8, // $R8
|
||||
INST_R9, // $R9
|
||||
INST_CMDLINE, // $CMDLINE
|
||||
INST_INSTDIR, // $INSTDIR
|
||||
INST_OUTDIR, // $OUTDIR
|
||||
INST_EXEDIR, // $EXEDIR
|
||||
INST_LANG, // $LANGUAGE
|
||||
__INST_LAST
|
||||
};
|
||||
|
||||
extern unsigned int g_stringsize;
|
||||
extern stack_t **g_stacktop;
|
||||
extern LPTSTR g_variables;
|
||||
|
||||
void NSISCALL pushstring(LPCTSTR str);
|
||||
void NSISCALL pushintptr(INT_PTR value);
|
||||
#define pushint(v) pushintptr((INT_PTR)(v))
|
||||
int NSISCALL popstring(LPTSTR str); // 0 on success, 1 on empty stack
|
||||
int NSISCALL popstringn(LPTSTR str, int maxlen); // with length limit, pass 0 for g_stringsize
|
||||
INT_PTR NSISCALL popintptr();
|
||||
#define popint() ( (int) popintptr() )
|
||||
int NSISCALL popint_or(); // with support for or'ing (2|4|8)
|
||||
INT_PTR NSISCALL nsishelper_str_to_ptr(LPCTSTR s);
|
||||
#define myatoi(s) ( (int) nsishelper_str_to_ptr(s) ) // converts a string to an integer
|
||||
unsigned int NSISCALL myatou(LPCTSTR s); // converts a string to an unsigned integer, decimal only
|
||||
int NSISCALL myatoi_or(LPCTSTR s); // with support for or'ing (2|4|8)
|
||||
LPTSTR NSISCALL getuservariable(const int varnum);
|
||||
void NSISCALL setuservariable(const int varnum, LPCTSTR var);
|
||||
|
||||
#ifdef UNICODE
|
||||
#define PopStringW(x) popstring(x)
|
||||
#define PushStringW(x) pushstring(x)
|
||||
#define SetUserVariableW(x,y) setuservariable(x,y)
|
||||
|
||||
int NSISCALL PopStringA(LPSTR ansiStr);
|
||||
void NSISCALL PushStringA(LPCSTR ansiStr);
|
||||
void NSISCALL GetUserVariableW(const int varnum, LPWSTR wideStr);
|
||||
void NSISCALL GetUserVariableA(const int varnum, LPSTR ansiStr);
|
||||
void NSISCALL SetUserVariableA(const int varnum, LPCSTR ansiStr);
|
||||
|
||||
#else
|
||||
// ANSI defs
|
||||
|
||||
#define PopStringA(x) popstring(x)
|
||||
#define PushStringA(x) pushstring(x)
|
||||
#define SetUserVariableA(x,y) setuservariable(x,y)
|
||||
|
||||
int NSISCALL PopStringW(LPWSTR wideStr);
|
||||
void NSISCALL PushStringW(LPWSTR wideStr);
|
||||
void NSISCALL GetUserVariableW(const int varnum, LPWSTR wideStr);
|
||||
void NSISCALL GetUserVariableA(const int varnum, LPSTR ansiStr);
|
||||
void NSISCALL SetUserVariableW(const int varnum, LPCWSTR wideStr);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif//!___NSIS_PLUGIN__H___
|
21
KattekerCreator/nsis/Examples/Splash/Example.nsi
Normal file
21
KattekerCreator/nsis/Examples/Splash/Example.nsi
Normal file
@ -0,0 +1,21 @@
|
||||
Name "Splash.dll test"
|
||||
|
||||
OutFile "Splash Test.exe"
|
||||
|
||||
XPStyle on
|
||||
|
||||
Function .onInit
|
||||
# the plugins dir is automatically deleted when the installer exits
|
||||
InitPluginsDir
|
||||
File /oname=$PLUGINSDIR\splash.bmp "${NSISDIR}\Contrib\Graphics\Wizard\orange-nsis.bmp"
|
||||
#optional
|
||||
#File /oname=$PLUGINSDIR\splash.wav "C:\myprog\sound.wav"
|
||||
|
||||
splash::show 1000 $PLUGINSDIR\splash
|
||||
|
||||
Pop $0 ; $0 has '1' if the user closed the splash screen early,
|
||||
; '0' if everything closed normally, and '-1' if some error occurred.
|
||||
FunctionEnd
|
||||
|
||||
Section
|
||||
SectionEnd
|
50
KattekerCreator/nsis/Examples/StartMenu/Example.nsi
Normal file
50
KattekerCreator/nsis/Examples/StartMenu/Example.nsi
Normal file
@ -0,0 +1,50 @@
|
||||
Name "StartMenu.dll test"
|
||||
|
||||
OutFile "StartMenu Test.exe"
|
||||
|
||||
XPStyle on
|
||||
|
||||
Page directory
|
||||
DirText "This installer will create some shortcuts to MakeNSIS in the start menu.$\nFor this it needs NSIS's path." \
|
||||
"Please specify the path in which you have installed NSIS:"
|
||||
InstallDir "${NSISDIR}"
|
||||
Function .onVerifyInstDir
|
||||
IfFileExists $INSTDIR\makensis.exe +2
|
||||
Abort
|
||||
FunctionEnd
|
||||
|
||||
Page custom StartMenuGroupSelect "" ": Start Menu Folder"
|
||||
Function StartMenuGroupSelect
|
||||
Push $R1
|
||||
|
||||
StartMenu::Select /checknoshortcuts "Don't create a start menu folder" /autoadd /lastused $R0 "StartMenu.dll test"
|
||||
Pop $R1
|
||||
|
||||
StrCmp $R1 "success" success
|
||||
StrCmp $R1 "cancel" done
|
||||
; error
|
||||
MessageBox MB_OK $R1
|
||||
StrCpy $R0 "StartMenu.dll test" # use default
|
||||
Return
|
||||
success:
|
||||
Pop $R0
|
||||
|
||||
done:
|
||||
Pop $R1
|
||||
FunctionEnd
|
||||
|
||||
Page instfiles
|
||||
Section
|
||||
# this part is only necessary if you used /checknoshortcuts
|
||||
StrCpy $R1 $R0 1
|
||||
StrCmp $R1 ">" skip
|
||||
|
||||
CreateDirectory $SMPROGRAMS\$R0
|
||||
CreateShortcut $SMPROGRAMS\$R0\MakeNSISw.lnk $INSTDIR\makensisw.exe
|
||||
|
||||
SetShellVarContext All
|
||||
CreateDirectory $SMPROGRAMS\$R0
|
||||
CreateShortcut "$SMPROGRAMS\$R0\All users MakeNSISw.lnk" $INSTDIR\makensisw.exe
|
||||
|
||||
skip:
|
||||
SectionEnd
|
635
KattekerCreator/nsis/Examples/StrFunc.nsi
Normal file
635
KattekerCreator/nsis/Examples/StrFunc.nsi
Normal file
@ -0,0 +1,635 @@
|
||||
Name "NSIS StrFunc Example"
|
||||
OutFile "StrFunc.exe"
|
||||
ShowInstDetails show
|
||||
ShowUninstDetails show
|
||||
XPStyle on
|
||||
RequestExecutionLevel user
|
||||
|
||||
!include "StrFunc.nsh"
|
||||
|
||||
# Declare used functions
|
||||
${StrCase}
|
||||
${StrClb}
|
||||
${StrIOToNSIS}
|
||||
${StrLoc}
|
||||
${StrNSISToIO}
|
||||
${StrRep}
|
||||
${StrStr}
|
||||
${StrStrAdv}
|
||||
${StrTok}
|
||||
${StrTrimNewLines}
|
||||
${StrSort}
|
||||
|
||||
${UnStrCase}
|
||||
${UnStrClb}
|
||||
${UnStrIOToNSIS}
|
||||
${UnStrLoc}
|
||||
${UnStrNSISToIO}
|
||||
${UnStrRep}
|
||||
${UnStrStr}
|
||||
${UnStrStrAdv}
|
||||
${UnStrTok}
|
||||
${UnStrTrimNewLines}
|
||||
${UnStrSort}
|
||||
|
||||
!macro StackVerificationStart
|
||||
StrCpy $0 S0
|
||||
StrCpy $1 S1
|
||||
StrCpy $2 S2
|
||||
StrCpy $3 S3
|
||||
StrCpy $4 S4
|
||||
StrCpy $5 S5
|
||||
StrCpy $6 S6
|
||||
StrCpy $7 S7
|
||||
StrCpy $8 S8
|
||||
StrCpy $9 S9
|
||||
StrCpy $R0 SR0
|
||||
StrCpy $R1 SR1
|
||||
StrCpy $R2 SR2
|
||||
StrCpy $R3 SR3
|
||||
StrCpy $R4 SR4
|
||||
StrCpy $R5 SR5
|
||||
StrCpy $R6 SR6
|
||||
StrCpy $R7 SR7
|
||||
StrCpy $R8 SR8
|
||||
StrCpy $R9 SR9
|
||||
!macroend
|
||||
|
||||
!macro StackVerificationEnd
|
||||
ClearErrors
|
||||
${If} $1 != "S1"
|
||||
${OrIf} $2 != "S2"
|
||||
${OrIf} $3 != "S3"
|
||||
${OrIf} $4 != "S4"
|
||||
${OrIf} $5 != "S5"
|
||||
${OrIf} $6 != "S6"
|
||||
${OrIf} $7 != "S7"
|
||||
${OrIf} $8 != "S8"
|
||||
${OrIf} $9 != "S9"
|
||||
${OrIf} $R0 != "SR0"
|
||||
${OrIf} $R1 != "SR1"
|
||||
${OrIf} $R2 != "SR2"
|
||||
${OrIf} $R3 != "SR3"
|
||||
${OrIf} $R4 != "SR4"
|
||||
${OrIf} $R5 != "SR5"
|
||||
${OrIf} $R6 != "SR6"
|
||||
${OrIf} $R7 != "SR7"
|
||||
${OrIf} $R8 != "SR8"
|
||||
${OrIf} $R9 != "SR9"
|
||||
SetErrors
|
||||
${EndIf}
|
||||
!macroend
|
||||
|
||||
Section
|
||||
|
||||
# Test case conversion
|
||||
!insertmacro StackVerificationStart
|
||||
${StrCase} $0 "This is just an example. A very simple one." ""
|
||||
StrCmp $0 "This is just an example. A very simple one." 0 strcaseerror
|
||||
${StrCase} $0 "THIS IS JUST AN EXAMPLE. A VERY SIMPLE ONE." "S"
|
||||
StrCmp $0 "This is just an example. A very simple one." 0 strcaseerror
|
||||
${StrCase} $0 "This is just an example. A very simple one." "L"
|
||||
StrCmp $0 "this is just an example. a very simple one." 0 strcaseerror
|
||||
${StrCase} $0 "This is just an example. A very simple one." "U"
|
||||
StrCmp $0 "THIS IS JUST AN EXAMPLE. A VERY SIMPLE ONE." 0 strcaseerror
|
||||
${StrCase} $0 "This is just an example. A very simple one." "T"
|
||||
StrCmp $0 "This Is Just An Example. A Very Simple One." 0 strcaseerror
|
||||
${StrCase} $0 "This is just an example. A very simple one." "<>"
|
||||
StrCmp $0 "tHIS IS JUST AN EXAMPLE. a VERY SIMPLE ONE." 0 strcaseerror
|
||||
${StrCase} $0 "123456789!@#%^&*()-_=+[]{};:,./<>?" "S"
|
||||
StrCmp $0 "123456789!@#%^&*()-_=+[]{};:,./<>?" 0 strcaseerror
|
||||
${StrCase} $0 "123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#%^&*()abcdefghijklmnopqrstuvwxyz-_=+[]{};:,./<>?" "<>"
|
||||
StrCmp $0 "123456789abcdefghijklmnopqrstuvwxyz!@#%^&*()ABCDEFGHIJKLMNOPQRSTUVWXYZ-_=+[]{};:,./<>?" 0 strcaseerror
|
||||
${StrCase} $0 "what about taking a shower tomorrow? it's late to do so now! try to sleep now. Good Night!" "S"
|
||||
StrCmp $0 "What about taking a shower tomorrow? It's late to do so now! Try to sleep now. Good night!" 0 strcaseerror
|
||||
!insertmacro StackVerificationEnd
|
||||
IfErrors strcaseerror
|
||||
|
||||
DetailPrint "PASSED StrCase test"
|
||||
Goto +2
|
||||
strcaseerror:
|
||||
DetailPrint "FAILED StrCase test"
|
||||
|
||||
# Test clipboard function
|
||||
!insertmacro StackVerificationStart
|
||||
${StrClb} $0 "StrFunc clipboard test" ">"
|
||||
StrCmp $0 "" 0 strclberror
|
||||
${StrClb} $0 "StrFunc clipboard test #2" "<>"
|
||||
StrCmp $0 "StrFunc clipboard test" 0 strclberror
|
||||
${StrClb} $0 "" "<"
|
||||
StrCmp $0 "StrFunc clipboard test #2" 0 strclberror
|
||||
${StrClb} $0 "" ""
|
||||
StrCmp $0 "" 0 strclberror
|
||||
!insertmacro StackVerificationEnd
|
||||
IfErrors strclberror
|
||||
|
||||
DetailPrint "PASSED StrClb test"
|
||||
Goto +2
|
||||
strclberror:
|
||||
DetailPrint "FAILED StrClb test"
|
||||
|
||||
# Test IO functions
|
||||
!insertmacro StackVerificationStart
|
||||
!macro testio str
|
||||
${StrNSISToIO} $0 "${str}"
|
||||
${StrIOToNSIS} $0 $0
|
||||
StrCmp $0 "${str}" 0 ioerror
|
||||
!macroend
|
||||
!insertmacro testio "$\rtest$\n"
|
||||
!insertmacro testio "test$\n"
|
||||
!insertmacro testio "$\rtest"
|
||||
!insertmacro testio "test"
|
||||
!insertmacro testio "$\r\$\t$\n"
|
||||
!insertmacro testio "$\r \ $\t $\n $$"
|
||||
!insertmacro testio ""
|
||||
!insertmacro testio " "
|
||||
!insertmacro StackVerificationEnd
|
||||
IfErrors ioerror
|
||||
|
||||
DetailPrint "PASSED StrNSISToIO/StrIOToNSIS test"
|
||||
Goto +2
|
||||
ioerror:
|
||||
DetailPrint "FAILED StrNSISToIO/StrIOToNSIS test"
|
||||
|
||||
# Test string search functions
|
||||
!insertmacro StackVerificationStart
|
||||
${StrLoc} $0 "This is just an example" "just" "<"
|
||||
StrCmp $0 "11" 0 strlocerror
|
||||
${StrLoc} $0 a abc <
|
||||
StrCmp $0 "" 0 strlocerror
|
||||
${StrLoc} $0 a abc >
|
||||
StrCmp $0 "" 0 strlocerror
|
||||
${StrLoc} $0 abc a >
|
||||
StrCmp $0 "0" 0 strlocerror
|
||||
${StrLoc} $0 abc b >
|
||||
StrCmp $0 "1" 0 strlocerror
|
||||
${StrLoc} $0 abc c >
|
||||
StrCmp $0 "2" 0 strlocerror
|
||||
${StrLoc} $0 abc a <
|
||||
StrCmp $0 "2" 0 strlocerror
|
||||
${StrLoc} $0 abc b <
|
||||
StrCmp $0 "1" 0 strlocerror
|
||||
${StrLoc} $0 abc c <
|
||||
StrCmp $0 "0" 0 strlocerror
|
||||
${StrLoc} $0 abc d <
|
||||
StrCmp $0 "" 0 strlocerror
|
||||
!insertmacro StackVerificationEnd
|
||||
IfErrors strlocerror
|
||||
|
||||
DetailPrint "PASSED StrLoc test"
|
||||
Goto +2
|
||||
strlocerror:
|
||||
DetailPrint "FAILED StrLoc test"
|
||||
|
||||
# Test string replacement
|
||||
!insertmacro StackVerificationStart
|
||||
${StrRep} $0 "This is just an example" "an" "one"
|
||||
StrCmp $0 "This is just one example" 0 strreperror
|
||||
${StrRep} $0 "test... test... 1 2 3..." "test" "testing"
|
||||
StrCmp $0 "testing... testing... 1 2 3..." 0 strreperror
|
||||
${StrRep} $0 "" "test" "testing"
|
||||
StrCmp $0 "" 0 strreperror
|
||||
${StrRep} $0 "test" "test" "testing"
|
||||
StrCmp $0 "testing" 0 strreperror
|
||||
${StrRep} $0 "test" "test" ""
|
||||
StrCmp $0 "" 0 strreperror
|
||||
${StrRep} $0 "test" "" "abc"
|
||||
StrCmp $0 "test" 0 strreperror
|
||||
${StrRep} $0 "test" "" ""
|
||||
StrCmp $0 "test" 0 strreperror
|
||||
!insertmacro StackVerificationEnd
|
||||
IfErrors strreperror
|
||||
|
||||
DetailPrint "PASSED StrRep test"
|
||||
Goto +2
|
||||
strreperror:
|
||||
DetailPrint "FAILED StrRep test"
|
||||
|
||||
# Test sorting
|
||||
!insertmacro StackVerificationStart
|
||||
${StrSort} $0 "This is just an example" "" " just" "ple" "0" "0" "0"
|
||||
StrCmp $0 "This is an exam" 0 strsorterror
|
||||
${StrSort} $0 "This is just an example" " " "j" " " "0" "" "0"
|
||||
StrCmp $0 "just" 0 strsorterror
|
||||
${StrSort} $0 "This is just an example" "" "j" "" "0" "1" "0"
|
||||
StrCmp $0 "This is just an example" 0 strsorterror
|
||||
${StrSort} $0 "This is just an example" " " "us" "" "0" "1" "0"
|
||||
StrCmp $0 "just an example" 0 strsorterror
|
||||
${StrSort} $0 "This is just an example" "" "u" " " "0" "1" "0"
|
||||
StrCmp $0 "This is just" 0 strsorterror
|
||||
${StrSort} $0 "This is just an example" " " "just" " " "0" "1" "0"
|
||||
StrCmp $0 "just" 0 strsorterror
|
||||
${StrSort} $0 "This is just an example" " " "t" " " "0" "1" "0"
|
||||
StrCmp $0 "This" 0 strsorterror
|
||||
${StrSort} $0 "This is just an example" " " "le" " " "0" "1" "0"
|
||||
StrCmp $0 "example" 0 strsorterror
|
||||
${StrSort} $0 "This is just an example" " " "le" " " "1" "0" "0"
|
||||
StrCmp $0 " examp" 0 strsorterror
|
||||
${StrSort} $0 "an error has occurred" " " "e" " " "0" "1" "0"
|
||||
StrCmp $0 "error" 0 strsorterror
|
||||
${StrSort} $0 "" " " "something" " " "0" "1" "0"
|
||||
StrCmp $0 "" 0 strsorterror
|
||||
${StrSort} $0 "This is just an example" " " "j" " " "" "" ""
|
||||
StrCmp $0 " just " 0 strsorterror
|
||||
${StrSort} $0 "This is just an example" " " "j" " " "1" "0" "1"
|
||||
StrCmp $0 " ust " 0 strsorterror
|
||||
${StrSort} $0 "This is just an example" "" "j" "" "0" "0" "1"
|
||||
StrCmp $0 "This is ust an example" 0 strsorterror
|
||||
${StrSort} $0 "This is just an example" " " "us" "" "1" "0" "0"
|
||||
StrCmp $0 " jt an example" 0 strsorterror
|
||||
${StrSort} $0 "This is just an example" "" "u" " " "0" "0" "1"
|
||||
StrCmp $0 "This is jst " 0 strsorterror
|
||||
${StrSort} $0 "This is just an example" " " "just" " " "1" "0" "1"
|
||||
StrCmp $0 " " 0 strsorterror
|
||||
${StrSort} $0 "an error has occurred" " " "e" "h" "1" "0" "0"
|
||||
StrCmp $0 " rror " 0 strsorterror
|
||||
${StrSort} $0 "" " " "something" " " "1" "0" "1"
|
||||
StrCmp $0 "" 0 strsorterror
|
||||
!insertmacro StackVerificationEnd
|
||||
IfErrors strsorterror
|
||||
|
||||
DetailPrint "PASSED StrSort test"
|
||||
Goto +2
|
||||
strsorterror:
|
||||
DetailPrint "FAILED StrSort test"
|
||||
|
||||
!insertmacro StackVerificationStart
|
||||
${StrStr} $0 "abcefghijklmnopqrstuvwxyz" "g"
|
||||
StrCmp $0 "ghijklmnopqrstuvwxyz" 0 strstrerror
|
||||
${StrStr} $0 "abcefghijklmnopqrstuvwxyz" "ga"
|
||||
StrCmp $0 "" 0 strstrerror
|
||||
${StrStr} $0 "abcefghijklmnopqrstuvwxyz" ""
|
||||
StrCmp $0 "abcefghijklmnopqrstuvwxyz" 0 strstrerror
|
||||
${StrStr} $0 "a" "abcefghijklmnopqrstuvwxyz"
|
||||
StrCmp $0 "" 0 strstrerror
|
||||
!insertmacro StackVerificationEnd
|
||||
IfErrors strstrerror
|
||||
|
||||
DetailPrint "PASSED StrStr test"
|
||||
Goto +2
|
||||
strstrerror:
|
||||
DetailPrint "FAILED StrStr test"
|
||||
|
||||
!insertmacro StackVerificationStart
|
||||
${StrStrAdv} $0 "abcabcabc" "a" ">" ">" "1" "0" "0"
|
||||
StrCmp $0 "abcabcabc" 0 strstradverror
|
||||
${StrStrAdv} $0 "abcabcabc" "a" ">" ">" "1" "1" "0"
|
||||
StrCmp $0 "abcabc" 0 strstradverror
|
||||
${StrStrAdv} $0 "abcabcabc" "a" ">" ">" "1" "2" "0"
|
||||
StrCmp $0 "abc" 0 strstradverror
|
||||
${StrStrAdv} $0 "abcabcabc" "a" ">" ">" "1" "3" "0"
|
||||
StrCmp $0 "" 0 strstradverror
|
||||
${StrStrAdv} $0 "abcabcabc" "abc" ">" "<" "1" "1" "0"
|
||||
StrCmp $0 "abcabc" 0 strstradverror
|
||||
${StrStrAdv} $0 "abcabcabc" "abc" ">" "<" "0" "1" "0"
|
||||
StrCmp $0 "abc" 0 strstradverror
|
||||
${StrStrAdv} $0 "abcabcabc" "abc" "<" "<" "1" "0" "0"
|
||||
StrCmp $0 "abcabcabc" 0 strstradverror
|
||||
${StrStrAdv} $0 "abcabcabc" "abc" "<" "<" "0" "0" "0"
|
||||
StrCmp $0 "abcabc" 0 strstradverror
|
||||
${StrStrAdv} $0 "abcabcabc" "abc" "<" ">" "0" "0" "0"
|
||||
StrCmp $0 "" 0 strstradverror
|
||||
${StrStrAdv} $0 "abcabcabc" "abc" "<" ">" "0" "1" "0"
|
||||
StrCmp $0 "abc" 0 strstradverror
|
||||
${StrStrAdv} $0 "ABCabcabc" "a" ">" ">" "1" "0" "1"
|
||||
StrCmp $0 "abcabc" 0 strstradverror
|
||||
${StrStrAdv} $0 "ABCabcabc" "a" ">" ">" "1" "1" "1"
|
||||
StrCmp $0 "abc" 0 strstradverror
|
||||
${StrStrAdv} $0 "ABCabcabc" "a" ">" ">" "1" "2" "1"
|
||||
StrCmp $0 "" 0 strstradverror
|
||||
${StrStrAdv} $0 "ABCabcabc" "a" ">" ">" "1" "3" "1"
|
||||
StrCmp $0 "" 0 strstradverror
|
||||
${StrStrAdv} $0 "ABCabcabc" "abc" ">" "<" "1" "1" "1"
|
||||
StrCmp $0 "ABCabcabc" 0 strstradverror
|
||||
${StrStrAdv} $0 "ABCabcabc" "abc" ">" "<" "0" "1" "1"
|
||||
StrCmp $0 "ABCabc" 0 strstradverror
|
||||
${StrStrAdv} $0 "ABCabcabc" "abc" "<" "<" "1" "0" "1"
|
||||
StrCmp $0 "ABCabcabc" 0 strstradverror
|
||||
${StrStrAdv} $0 "ABCabcabc" "abc" "<" "<" "0" "0" "1"
|
||||
StrCmp $0 "ABCabc" 0 strstradverror
|
||||
${StrStrAdv} $0 "ABCabcabc" "abc" "<" ">" "0" "0" "1"
|
||||
StrCmp $0 "" 0 strstradverror
|
||||
${StrStrAdv} $0 "ABCabcabc" "abc" "<" ">" "0" "1" "1"
|
||||
StrCmp $0 "abc" 0 strstradverror
|
||||
!insertmacro StackVerificationEnd
|
||||
IfErrors strstradverror
|
||||
|
||||
DetailPrint "PASSED StrStrAdv test"
|
||||
Goto +2
|
||||
strstradverror:
|
||||
DetailPrint "FAILED StrStrAdv test"
|
||||
|
||||
# Test tokenizer
|
||||
!insertmacro StackVerificationStart
|
||||
${StrTok} $0 "This is, or is not, just an example" " ," "4" "1"
|
||||
StrCmp $0 "not" 0 strtokerror
|
||||
${StrTok} $0 "This is, or is not, just an example" " ," "4" "0"
|
||||
StrCmp $0 "is" 0 strtokerror
|
||||
${StrTok} $0 "This is, or is not, just an example" " ," "152" "0"
|
||||
StrCmp $0 "" 0 strtokerror
|
||||
${StrTok} $0 "This is, or is not, just an example" " ," "" "0"
|
||||
StrCmp $0 "example" 0 strtokerror
|
||||
${StrTok} $0 "This is, or is not, just an example" " ," "L" "0"
|
||||
StrCmp $0 "example" 0 strtokerror
|
||||
${StrTok} $0 "This is, or is not, just an example" " ," "0" "0"
|
||||
StrCmp $0 "This" 0 strtokerror
|
||||
!insertmacro StackVerificationEnd
|
||||
IfErrors strtokerror
|
||||
|
||||
DetailPrint "PASSED StrTok test"
|
||||
Goto +2
|
||||
strtokerror:
|
||||
DetailPrint "FAILED StrTok test"
|
||||
|
||||
# Test trim new lines
|
||||
!insertmacro StackVerificationStart
|
||||
${StrTrimNewLines} $0 "$\r$\ntest$\r$\ntest$\r$\n"
|
||||
StrCmp $0 "$\r$\ntest$\r$\ntest" 0 strtrimnewlineserror
|
||||
!insertmacro StackVerificationEnd
|
||||
IfErrors strtrimnewlineserror
|
||||
|
||||
DetailPrint "PASSED StrTrimNewLines test"
|
||||
Goto +2
|
||||
strtrimnewlineserror:
|
||||
DetailPrint "FAILED StrTrimNewLines test"
|
||||
|
||||
WriteUninstaller $EXEDIR\UnStrFunc.exe
|
||||
|
||||
Exec $EXEDIR\UnStrFunc.exe
|
||||
|
||||
SectionEnd
|
||||
|
||||
Section Uninstall
|
||||
|
||||
# Test case conversion
|
||||
!insertmacro StackVerificationStart
|
||||
${UnStrCase} $0 "This is just an example. A very simple one." ""
|
||||
StrCmp $0 "This is just an example. A very simple one." 0 strcaseerror
|
||||
${UnStrCase} $0 "THIS IS JUST AN EXAMPLE. A VERY SIMPLE ONE." "S"
|
||||
StrCmp $0 "This is just an example. A very simple one." 0 strcaseerror
|
||||
${UnStrCase} $0 "This is just an example. A very simple one." "L"
|
||||
StrCmp $0 "this is just an example. a very simple one." 0 strcaseerror
|
||||
${UnStrCase} $0 "This is just an example. A very simple one." "U"
|
||||
StrCmp $0 "THIS IS JUST AN EXAMPLE. A VERY SIMPLE ONE." 0 strcaseerror
|
||||
${UnStrCase} $0 "This is just an example. A very simple one." "T"
|
||||
StrCmp $0 "This Is Just An Example. A Very Simple One." 0 strcaseerror
|
||||
${UnStrCase} $0 "This is just an example. A very simple one." "<>"
|
||||
StrCmp $0 "tHIS IS JUST AN EXAMPLE. a VERY SIMPLE ONE." 0 strcaseerror
|
||||
${UnStrCase} $0 "123456789!@#%^&*()-_=+[]{};:,./<>?" "S"
|
||||
StrCmp $0 "123456789!@#%^&*()-_=+[]{};:,./<>?" 0 strcaseerror
|
||||
${UnStrCase} $0 "123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#%^&*()abcdefghijklmnopqrstuvwxyz-_=+[]{};:,./<>?" "<>"
|
||||
StrCmp $0 "123456789abcdefghijklmnopqrstuvwxyz!@#%^&*()ABCDEFGHIJKLMNOPQRSTUVWXYZ-_=+[]{};:,./<>?" 0 strcaseerror
|
||||
${UnStrCase} $0 "what about taking a shower tomorrow? it's late to do so now! try to sleep now. Good Night!" "S"
|
||||
StrCmp $0 "What about taking a shower tomorrow? It's late to do so now! Try to sleep now. Good night!" 0 strcaseerror
|
||||
!insertmacro StackVerificationEnd
|
||||
IfErrors strcaseerror
|
||||
|
||||
DetailPrint "PASSED StrCase test"
|
||||
Goto +2
|
||||
strcaseerror:
|
||||
DetailPrint "FAILED StrCase test"
|
||||
|
||||
# Test clipboard function
|
||||
!insertmacro StackVerificationStart
|
||||
${UnStrClb} $0 "StrFunc clipboard test" ">"
|
||||
StrCmp $0 "" 0 strclberror
|
||||
${UnStrClb} $0 "StrFunc clipboard test #2" "<>"
|
||||
StrCmp $0 "StrFunc clipboard test" 0 strclberror
|
||||
${UnStrClb} $0 "" "<"
|
||||
StrCmp $0 "StrFunc clipboard test #2" 0 strclberror
|
||||
${UnStrClb} $0 "" ""
|
||||
StrCmp $0 "" 0 strclberror
|
||||
!insertmacro StackVerificationEnd
|
||||
IfErrors strclberror
|
||||
|
||||
DetailPrint "PASSED StrClb test"
|
||||
Goto +2
|
||||
strclberror:
|
||||
DetailPrint "FAILED StrClb test"
|
||||
|
||||
# Test IO functions
|
||||
!insertmacro StackVerificationStart
|
||||
!macro untestio str
|
||||
${UnStrNSISToIO} $0 "${str}"
|
||||
${UnStrIOToNSIS} $0 $0
|
||||
StrCmp $0 "${str}" 0 ioerror
|
||||
!macroend
|
||||
!insertmacro untestio "$\rtest$\n"
|
||||
!insertmacro untestio "test$\n"
|
||||
!insertmacro untestio "$\rtest"
|
||||
!insertmacro untestio "test"
|
||||
!insertmacro untestio "$\r\$\t$\n"
|
||||
!insertmacro untestio "$\r \ $\t $\n $$"
|
||||
!insertmacro untestio ""
|
||||
!insertmacro untestio " "
|
||||
!insertmacro StackVerificationEnd
|
||||
IfErrors ioerror
|
||||
|
||||
DetailPrint "PASSED StrNSISToIO/StrIOToNSIS test"
|
||||
Goto +2
|
||||
ioerror:
|
||||
DetailPrint "FAILED StrNSISToIO/StrIOToNSIS test"
|
||||
|
||||
# Test string search functions
|
||||
!insertmacro StackVerificationStart
|
||||
${UnStrLoc} $0 "This is just an example" "just" "<"
|
||||
StrCmp $0 "11" 0 strlocerror
|
||||
${UnStrLoc} $0 a abc <
|
||||
StrCmp $0 "" 0 strlocerror
|
||||
${UnStrLoc} $0 a abc >
|
||||
StrCmp $0 "" 0 strlocerror
|
||||
${UnStrLoc} $0 abc a >
|
||||
StrCmp $0 "0" 0 strlocerror
|
||||
${UnStrLoc} $0 abc b >
|
||||
StrCmp $0 "1" 0 strlocerror
|
||||
${UnStrLoc} $0 abc c >
|
||||
StrCmp $0 "2" 0 strlocerror
|
||||
${UnStrLoc} $0 abc a <
|
||||
StrCmp $0 "2" 0 strlocerror
|
||||
${UnStrLoc} $0 abc b <
|
||||
StrCmp $0 "1" 0 strlocerror
|
||||
${UnStrLoc} $0 abc c <
|
||||
StrCmp $0 "0" 0 strlocerror
|
||||
${UnStrLoc} $0 abc d <
|
||||
StrCmp $0 "" 0 strlocerror
|
||||
!insertmacro StackVerificationEnd
|
||||
IfErrors strlocerror
|
||||
|
||||
DetailPrint "PASSED StrLoc test"
|
||||
Goto +2
|
||||
strlocerror:
|
||||
DetailPrint "FAILED StrLoc test"
|
||||
|
||||
# Test string replacement
|
||||
!insertmacro StackVerificationStart
|
||||
${UnStrRep} $0 "This is just an example" "an" "one"
|
||||
StrCmp $0 "This is just one example" 0 strreperror
|
||||
${UnStrRep} $0 "test... test... 1 2 3..." "test" "testing"
|
||||
StrCmp $0 "testing... testing... 1 2 3..." 0 strreperror
|
||||
${UnStrRep} $0 "" "test" "testing"
|
||||
StrCmp $0 "" 0 strreperror
|
||||
${UnStrRep} $0 "test" "test" "testing"
|
||||
StrCmp $0 "testing" 0 strreperror
|
||||
${UnStrRep} $0 "test" "test" ""
|
||||
StrCmp $0 "" 0 strreperror
|
||||
${UnStrRep} $0 "test" "" "abc"
|
||||
StrCmp $0 "test" 0 strreperror
|
||||
${UnStrRep} $0 "test" "" ""
|
||||
StrCmp $0 "test" 0 strreperror
|
||||
!insertmacro StackVerificationEnd
|
||||
IfErrors strreperror
|
||||
|
||||
DetailPrint "PASSED StrRep test"
|
||||
Goto +2
|
||||
strreperror:
|
||||
DetailPrint "FAILED StrRep test"
|
||||
|
||||
# Test sorting
|
||||
!insertmacro StackVerificationStart
|
||||
${UnStrSort} $0 "This is just an example" "" " just" "ple" "0" "0" "0"
|
||||
StrCmp $0 "This is an exam" 0 strsorterror
|
||||
${UnStrSort} $0 "This is just an example" " " "j" " " "0" "" "0"
|
||||
StrCmp $0 "just" 0 strsorterror
|
||||
${UnStrSort} $0 "This is just an example" "" "j" "" "0" "1" "0"
|
||||
StrCmp $0 "This is just an example" 0 strsorterror
|
||||
${UnStrSort} $0 "This is just an example" " " "us" "" "0" "1" "0"
|
||||
StrCmp $0 "just an example" 0 strsorterror
|
||||
${UnStrSort} $0 "This is just an example" "" "u" " " "0" "1" "0"
|
||||
StrCmp $0 "This is just" 0 strsorterror
|
||||
${UnStrSort} $0 "This is just an example" " " "just" " " "0" "1" "0"
|
||||
StrCmp $0 "just" 0 strsorterror
|
||||
${UnStrSort} $0 "This is just an example" " " "t" " " "0" "1" "0"
|
||||
StrCmp $0 "This" 0 strsorterror
|
||||
${UnStrSort} $0 "This is just an example" " " "le" " " "0" "1" "0"
|
||||
StrCmp $0 "example" 0 strsorterror
|
||||
${UnStrSort} $0 "This is just an example" " " "le" " " "1" "0" "0"
|
||||
StrCmp $0 " examp" 0 strsorterror
|
||||
${UnStrSort} $0 "an error has occurred" " " "e" " " "0" "1" "0"
|
||||
StrCmp $0 "error" 0 strsorterror
|
||||
${UnStrSort} $0 "" " " "something" " " "0" "1" "0"
|
||||
StrCmp $0 "" 0 strsorterror
|
||||
${UnStrSort} $0 "This is just an example" " " "j" " " "" "" ""
|
||||
StrCmp $0 " just " 0 strsorterror
|
||||
${UnStrSort} $0 "This is just an example" " " "j" " " "1" "0" "1"
|
||||
StrCmp $0 " ust " 0 strsorterror
|
||||
${UnStrSort} $0 "This is just an example" "" "j" "" "0" "0" "1"
|
||||
StrCmp $0 "This is ust an example" 0 strsorterror
|
||||
${UnStrSort} $0 "This is just an example" " " "us" "" "1" "0" "0"
|
||||
StrCmp $0 " jt an example" 0 strsorterror
|
||||
${UnStrSort} $0 "This is just an example" "" "u" " " "0" "0" "1"
|
||||
StrCmp $0 "This is jst " 0 strsorterror
|
||||
${UnStrSort} $0 "This is just an example" " " "just" " " "1" "0" "1"
|
||||
StrCmp $0 " " 0 strsorterror
|
||||
${UnStrSort} $0 "an error has occurred" " " "e" "h" "1" "0" "0"
|
||||
StrCmp $0 " rror " 0 strsorterror
|
||||
${UnStrSort} $0 "" " " "something" " " "1" "0" "1"
|
||||
StrCmp $0 "" 0 strsorterror
|
||||
!insertmacro StackVerificationEnd
|
||||
IfErrors strsorterror
|
||||
|
||||
DetailPrint "PASSED StrSort test"
|
||||
Goto +2
|
||||
strsorterror:
|
||||
DetailPrint "FAILED StrSort test"
|
||||
|
||||
!insertmacro StackVerificationStart
|
||||
${UnStrStr} $0 "abcefghijklmnopqrstuvwxyz" "g"
|
||||
StrCmp $0 "ghijklmnopqrstuvwxyz" 0 strstrerror
|
||||
${UnStrStr} $0 "abcefghijklmnopqrstuvwxyz" "ga"
|
||||
StrCmp $0 "" 0 strstrerror
|
||||
${UnStrStr} $0 "abcefghijklmnopqrstuvwxyz" ""
|
||||
StrCmp $0 "abcefghijklmnopqrstuvwxyz" 0 strstrerror
|
||||
${UnStrStr} $0 "a" "abcefghijklmnopqrstuvwxyz"
|
||||
StrCmp $0 "" 0 strstrerror
|
||||
!insertmacro StackVerificationEnd
|
||||
IfErrors strstrerror
|
||||
|
||||
DetailPrint "PASSED StrStr test"
|
||||
Goto +2
|
||||
strstrerror:
|
||||
DetailPrint "FAILED StrStr test"
|
||||
|
||||
!insertmacro StackVerificationStart
|
||||
${UnStrStrAdv} $0 "abcabcabc" "a" ">" ">" "1" "0" "0"
|
||||
StrCmp $0 "abcabcabc" 0 strstradverror
|
||||
${UnStrStrAdv} $0 "abcabcabc" "a" ">" ">" "1" "1" "0"
|
||||
StrCmp $0 "abcabc" 0 strstradverror
|
||||
${UnStrStrAdv} $0 "abcabcabc" "a" ">" ">" "1" "2" "0"
|
||||
StrCmp $0 "abc" 0 strstradverror
|
||||
${UnStrStrAdv} $0 "abcabcabc" "a" ">" ">" "1" "3" "0"
|
||||
StrCmp $0 "" 0 strstradverror
|
||||
${UnStrStrAdv} $0 "abcabcabc" "abc" ">" "<" "1" "1" "0"
|
||||
StrCmp $0 "abcabc" 0 strstradverror
|
||||
${UnStrStrAdv} $0 "abcabcabc" "abc" ">" "<" "0" "1" "0"
|
||||
StrCmp $0 "abc" 0 strstradverror
|
||||
${UnStrStrAdv} $0 "abcabcabc" "abc" "<" "<" "1" "0" "0"
|
||||
StrCmp $0 "abcabcabc" 0 strstradverror
|
||||
${UnStrStrAdv} $0 "abcabcabc" "abc" "<" "<" "0" "0" "0"
|
||||
StrCmp $0 "abcabc" 0 strstradverror
|
||||
${UnStrStrAdv} $0 "abcabcabc" "abc" "<" ">" "0" "0" "0"
|
||||
StrCmp $0 "" 0 strstradverror
|
||||
${UnStrStrAdv} $0 "abcabcabc" "abc" "<" ">" "0" "1" "0"
|
||||
StrCmp $0 "abc" 0 strstradverror
|
||||
${UnStrStrAdv} $0 "ABCabcabc" "a" ">" ">" "1" "0" "1"
|
||||
StrCmp $0 "abcabc" 0 strstradverror
|
||||
${UnStrStrAdv} $0 "ABCabcabc" "a" ">" ">" "1" "1" "1"
|
||||
StrCmp $0 "abc" 0 strstradverror
|
||||
${UnStrStrAdv} $0 "ABCabcabc" "a" ">" ">" "1" "2" "1"
|
||||
StrCmp $0 "" 0 strstradverror
|
||||
${UnStrStrAdv} $0 "ABCabcabc" "a" ">" ">" "1" "3" "1"
|
||||
StrCmp $0 "" 0 strstradverror
|
||||
${UnStrStrAdv} $0 "ABCabcabc" "abc" ">" "<" "1" "1" "1"
|
||||
StrCmp $0 "ABCabcabc" 0 strstradverror
|
||||
${UnStrStrAdv} $0 "ABCabcabc" "abc" ">" "<" "0" "1" "1"
|
||||
StrCmp $0 "ABCabc" 0 strstradverror
|
||||
${UnStrStrAdv} $0 "ABCabcabc" "abc" "<" "<" "1" "0" "1"
|
||||
StrCmp $0 "ABCabcabc" 0 strstradverror
|
||||
${UnStrStrAdv} $0 "ABCabcabc" "abc" "<" "<" "0" "0" "1"
|
||||
StrCmp $0 "ABCabc" 0 strstradverror
|
||||
${UnStrStrAdv} $0 "ABCabcabc" "abc" "<" ">" "0" "0" "1"
|
||||
StrCmp $0 "" 0 strstradverror
|
||||
${UnStrStrAdv} $0 "ABCabcabc" "abc" "<" ">" "0" "1" "1"
|
||||
StrCmp $0 "abc" 0 strstradverror
|
||||
!insertmacro StackVerificationEnd
|
||||
IfErrors strstradverror
|
||||
|
||||
DetailPrint "PASSED StrStrAdv test"
|
||||
Goto +2
|
||||
strstradverror:
|
||||
DetailPrint "FAILED StrStrAdv test"
|
||||
|
||||
# Test tokenizer
|
||||
!insertmacro StackVerificationStart
|
||||
${UnStrTok} $0 "This is, or is not, just an example" " ," "4" "1"
|
||||
StrCmp $0 "not" 0 strtokerror
|
||||
${UnStrTok} $0 "This is, or is not, just an example" " ," "4" "0"
|
||||
StrCmp $0 "is" 0 strtokerror
|
||||
${UnStrTok} $0 "This is, or is not, just an example" " ," "152" "0"
|
||||
StrCmp $0 "" 0 strtokerror
|
||||
${UnStrTok} $0 "This is, or is not, just an example" " ," "" "0"
|
||||
StrCmp $0 "example" 0 strtokerror
|
||||
${UnStrTok} $0 "This is, or is not, just an example" " ," "L" "0"
|
||||
StrCmp $0 "example" 0 strtokerror
|
||||
${UnStrTok} $0 "This is, or is not, just an example" " ," "0" "0"
|
||||
StrCmp $0 "This" 0 strtokerror
|
||||
!insertmacro StackVerificationEnd
|
||||
IfErrors strtokerror
|
||||
|
||||
DetailPrint "PASSED StrTok test"
|
||||
Goto +2
|
||||
strtokerror:
|
||||
DetailPrint "FAILED StrTok test"
|
||||
|
||||
# Test trim new lines
|
||||
!insertmacro StackVerificationStart
|
||||
${UnStrTrimNewLines} $0 "$\r$\ntest$\r$\ntest$\r$\n"
|
||||
StrCmp $0 "$\r$\ntest$\r$\ntest" 0 strtrimnewlineserror
|
||||
!insertmacro StackVerificationEnd
|
||||
IfErrors strtrimnewlineserror
|
||||
|
||||
DetailPrint "PASSED StrTrimNewLines test"
|
||||
Goto +2
|
||||
strtrimnewlineserror:
|
||||
DetailPrint "FAILED StrTrimNewLines test"
|
||||
|
||||
SectionEnd
|
BIN
KattekerCreator/nsis/Examples/System/Resource.dll
Normal file
BIN
KattekerCreator/nsis/Examples/System/Resource.dll
Normal file
Binary file not shown.
395
KattekerCreator/nsis/Examples/System/SysFunc.nsh
Normal file
395
KattekerCreator/nsis/Examples/System/SysFunc.nsh
Normal file
@ -0,0 +1,395 @@
|
||||
; Some useful functions based on System plugin
|
||||
;
|
||||
; (c) brainsucker, 2002
|
||||
; (r) BSForce
|
||||
|
||||
|
||||
!verbose push 3
|
||||
!ifndef SysFunc.NSH.Included
|
||||
!define SysFunc.NSH.Included
|
||||
|
||||
!include "System.nsh"
|
||||
!include "WinMessages.nsh"
|
||||
|
||||
; ================= GetInstallerExeName implementation =================
|
||||
|
||||
; Adopted Get Parameter function -> now it gets full installer.exe path
|
||||
; input - nothing, output -> full path at the top of the stack
|
||||
Function GetInstallerExeName
|
||||
Push $R0
|
||||
Push $R1
|
||||
Push $R2
|
||||
StrCpy $R0 $CMDLINE 1
|
||||
StrCpy $R1 '"'
|
||||
StrCpy $R2 1
|
||||
StrCmp $R0 '"' loop
|
||||
StrCpy $R1 ' ' ; we're scanning for a space instead of a quote
|
||||
loop:
|
||||
StrCpy $R0 $CMDLINE 1 $R2
|
||||
StrCmp $R0 $R1 loop2
|
||||
StrCmp $R0 "" loop2
|
||||
IntOp $R2 $R2 + 1
|
||||
Goto loop
|
||||
loop2:
|
||||
|
||||
; Ok, have we found last exename character or string end?
|
||||
StrCmp $R0 "" "" +2
|
||||
IntOp $R2 $R2 - 1 ; last exename char
|
||||
StrCmp $R1 ' ' +3 ; was first character the '"', or something other?
|
||||
StrCpy $R1 1 ; it was quote
|
||||
Goto +2
|
||||
StrCpy $R1 0
|
||||
IntOp $R2 $R2 - $R1
|
||||
StrCpy $R0 $CMDLINE $R2 $R1
|
||||
|
||||
SearchPath $R0 $R0 ; expand file name to full path
|
||||
|
||||
Pop $R2
|
||||
Pop $R1
|
||||
Exch $R0
|
||||
FunctionEnd
|
||||
|
||||
; ================= systemGetFileSysTime implementation =================
|
||||
|
||||
!macro smGetFileSysTime FILENAME
|
||||
Push ${FILENAME}
|
||||
Call systemGetFileSysTime
|
||||
Pop $R0
|
||||
!macroend
|
||||
|
||||
; -----------------------------------------------------------------
|
||||
; systemGetFileSysTime (params on stack):
|
||||
; FILENAME - name of file to get file time
|
||||
; returns to stack (SYSTEMTIME struct addr)
|
||||
; -----------------------------------------------------------------
|
||||
|
||||
; uses original method from NSIS
|
||||
Function systemGetFileSysTime
|
||||
System::Store "s r1"
|
||||
|
||||
StrCpy $R0 0
|
||||
|
||||
; create WIN32_FIND_DATA struct
|
||||
System::Call '*${stWIN32_FIND_DATA} .r2'
|
||||
|
||||
; Find file info
|
||||
System::Call '${sysFindFirstFile}(r1, r2) .r3'
|
||||
|
||||
; ok?
|
||||
IntCmp $3 ${INVALID_HANDLE_VALUE} sgfst_exit
|
||||
|
||||
; close file search
|
||||
System::Call '${sysFindClose}(r3)'
|
||||
|
||||
; Create systemtime struct for local time
|
||||
System::Call '*${stSYSTEMTIME} .R0'
|
||||
|
||||
; Get File time
|
||||
System::Call '*$2${stWIN32_FIND_DATA} (,,, .r3)'
|
||||
|
||||
; Convert file time (UTC) to local file time
|
||||
System::Call '${sysFileTimeToLocalFileTime}(r3, .r1)'
|
||||
|
||||
; Convert file time to system time
|
||||
System::Call '${sysFileTimeToSystemTime}(r1, R0)'
|
||||
|
||||
sgfst_exit:
|
||||
; free used memory for WIN32_FIND_DATA struct
|
||||
System::Free $2
|
||||
|
||||
System::Store "P0 l"
|
||||
FunctionEnd
|
||||
|
||||
; ================= systemMessageBox implementation =================
|
||||
|
||||
; return to $R0
|
||||
!macro smMessageBox MODULE MSG CAPTION STYLE ICON
|
||||
Push "${ICON}"
|
||||
Push "${STYLE}"
|
||||
Push "${CAPTION}"
|
||||
Push "${MSG}"
|
||||
Push "${MODULE}"
|
||||
Call systemMessageBox
|
||||
Pop $R0
|
||||
!macroend
|
||||
|
||||
; -----------------------------------------------------------------
|
||||
; systemMessageBox (params on stack):
|
||||
; Module: either handle ("i HANDLE", HANDLE could be 0) or "modulename"
|
||||
; Msg: text of message
|
||||
; Caption: caption of message box window
|
||||
; Style: style, buttons etc
|
||||
; Icon: either icon handle ("i HANDLE") or resource name
|
||||
; returns to stack
|
||||
; -----------------------------------------------------------------
|
||||
Function systemMessageBox
|
||||
System::Store "s r2r3r4r5r6"
|
||||
|
||||
; may be Module is module handle?
|
||||
StrCpy $1 $2
|
||||
IntCmp $1 0 0 smbnext smbnext
|
||||
|
||||
; Get module handle
|
||||
System::Call '${sysGetModuleHandle}($2) .r1'
|
||||
IntCmp $1 0 loadlib libnotloaded libnotloaded
|
||||
|
||||
loadlib:
|
||||
; Load module and get handle
|
||||
System::Call '${sysLoadLibrary}($2) .r1'
|
||||
IntCmp $1 0 0 smbnext smbnext
|
||||
|
||||
libnotloaded:
|
||||
; Indicate that LoadLibrary wasn't used
|
||||
StrCpy $2 1
|
||||
|
||||
smbnext:
|
||||
; Create MSGBOXPARAMS structure
|
||||
System::Call '*${stMSGBOXPARAMS}(, $HWNDPARENT, r1, r3, r4, "$5|${MB_USERICON}", $6, _) .r0'
|
||||
; call MessageBoxIndirect
|
||||
System::Call '${sysMessageBoxIndirect}(r0) .R0'
|
||||
; free MSGBOXPARAMS structure
|
||||
|
||||
System::Free $0
|
||||
|
||||
; have we used load library at start?
|
||||
IntCmp $2 0 0 smbskipfree smbskipfree
|
||||
; No, then free the module
|
||||
System::Call '${sysFreeLibrary}(r1)'
|
||||
|
||||
smbskipfree:
|
||||
System::Store "P0 l"
|
||||
FunctionEnd
|
||||
|
||||
; ================= systemSplash implementation =================
|
||||
|
||||
; returns to $R0
|
||||
!macro smSystemSplash DELAY FILE
|
||||
Push ${FILE}
|
||||
Push ${DELAY}
|
||||
call systemSplash
|
||||
Pop $R0
|
||||
!macroend
|
||||
|
||||
; -----------------------------------------------------------------
|
||||
; systemSplash (params on stack):
|
||||
; Delay - time in ms to show the splash
|
||||
; File - bitmap (& audio) file name (without extension)
|
||||
; returns to stack
|
||||
; -----------------------------------------------------------------
|
||||
|
||||
Function _systemSplashWndCB
|
||||
; Callback receives 4 values
|
||||
System::Store "s r2r5r7r9"
|
||||
|
||||
; Message branching
|
||||
IntCmp $5 ${WM_CLOSE} m_Close
|
||||
IntCmp $5 ${WM_TIMER} m_Timer
|
||||
IntCmp $5 ${WM_LBUTTONDOWN} m_Lbtn
|
||||
IntCmp $5 ${WM_CREATE} m_Create
|
||||
IntCmp $5 ${WM_PAINT} m_Paint
|
||||
goto default
|
||||
|
||||
m_Create:
|
||||
; Create structures
|
||||
System::Call "*${stRECT} (_) .R8"
|
||||
System::Call "*${stBITMAP} (_, &l0 .R7) .R9"
|
||||
|
||||
; Get bitmap info
|
||||
System::Call "${sysGetObject} (r6, R7, R9)"
|
||||
|
||||
; Get desktop info
|
||||
System::Call "${sysSystemParametersInfo} (${SPI_GETWORKAREA}, 0, R8, 0)"
|
||||
|
||||
; Style (callbacked)
|
||||
System::Call "${sysSetWindowLong} (r2, ${GWL_STYLE}, 0) .s"
|
||||
!insertmacro SINGLE_CALLBACK 5 $R7 1 _systemSplashWndCB
|
||||
|
||||
; Calculate and set window pos
|
||||
|
||||
; Get bmWidth(R2) and bmHeight(R3)
|
||||
System::Call "*$R9${stBITMAP} (,.R2,.R3)"
|
||||
; Get left(R4), top(R5), right(R6), bottom(R7)
|
||||
System::Call "*$R8${stRECT} (.R4,.R5,.R6,.R7)"
|
||||
|
||||
; Left pos
|
||||
IntOp $R0 $R6 - $R4
|
||||
IntOp $R0 $R0 - $R2
|
||||
IntOp $R0 $R0 / 2
|
||||
IntOp $R0 $R0 + $R4
|
||||
|
||||
; Top pos
|
||||
IntOp $R1 $R7 - $R5
|
||||
IntOp $R1 $R1 - $R3
|
||||
IntOp $R1 $R1 / 2
|
||||
IntOp $R1 $R1 + $R5
|
||||
|
||||
System::Call "${sysSetWindowPos} (r2, 0, R0, R1, R2, R3, ${SWP_NOZORDER}) .s"
|
||||
!insertmacro SINGLE_CALLBACK 6 $R7 1 _systemSplashWndCB
|
||||
|
||||
; Show window
|
||||
System::Call "${sysShowWindow} (r2, ${SW_SHOW}) .s"
|
||||
!insertmacro SINGLE_CALLBACK 7 $R7 1 _systemSplashWndCB
|
||||
|
||||
; Set Timer
|
||||
System::Call "${sysSetTimer} (r2, 1, r8,)"
|
||||
|
||||
; Free used memory
|
||||
System::Free $R8
|
||||
System::Free $R9
|
||||
|
||||
StrCpy $R0 0
|
||||
goto exit
|
||||
|
||||
m_Paint:
|
||||
; Create structures
|
||||
System::Call "*${stRECT} (_) .R8"
|
||||
System::Call "*${stPAINTSTRUCT} (_) .R9"
|
||||
|
||||
; Begin Paint
|
||||
System::Call "${sysBeginPaint} (r2, R9) .R7"
|
||||
|
||||
; CreateCompatibleDC
|
||||
System::Call "${sysCreateCompatibleDC} (R7) .R6"
|
||||
|
||||
; GetClientRect
|
||||
System::Call "${sysGetClientRect} (r2, R8)"
|
||||
|
||||
; Select new bitmap
|
||||
System::Call "${sysSelectObject} (R6, r6) .R5"
|
||||
|
||||
; Get left(R0), top(R1), right(R2), bottom(R3)
|
||||
System::Call "*$R8${stRECT} (.R0,.R1,.R2,.R3)"
|
||||
|
||||
; width=right-left
|
||||
IntOp $R2 $R2 - $R0
|
||||
; height=bottom-top
|
||||
IntOp $R3 $R3 - $R1
|
||||
|
||||
System::Call "${sysBitBlt} (R7, R0, R1, R2, R3, R6, 0, 0, ${SRCCOPY})"
|
||||
|
||||
; Select old bitmap
|
||||
System::Call "${sysSelectObject} (R6, R5)"
|
||||
|
||||
; Delete compatible DC
|
||||
System::Call "${sysDeleteDC} (R6)"
|
||||
|
||||
; End Paint
|
||||
System::Call "${sysEndPaint} (r2, R9)"
|
||||
|
||||
; Free used memory
|
||||
System::Free $R8
|
||||
System::Free $R9
|
||||
|
||||
StrCpy $R0 0
|
||||
goto exit
|
||||
|
||||
m_Timer:
|
||||
m_Lbtn:
|
||||
StrCpy $4 0
|
||||
IntCmp $5 ${WM_TIMER} destroy
|
||||
StrCpy $4 1
|
||||
|
||||
destroy:
|
||||
System::Call "${sysDestroyWindow} (r2) .s"
|
||||
!insertmacro SINGLE_CALLBACK 12 $R4 1 _systemSplashWndCB
|
||||
|
||||
default:
|
||||
; Default
|
||||
System::Call "${sysDefWindowProc} (r2, r5, r7, r9) .s"
|
||||
!insertmacro SINGLE_CALLBACK 14 $R0 1 _systemSplashWndCB
|
||||
goto exit
|
||||
|
||||
m_Close:
|
||||
StrCpy $R0 0
|
||||
goto exit
|
||||
|
||||
exit:
|
||||
; Restore
|
||||
System::Store "p4P0 l R0r4"
|
||||
|
||||
; Return from callback
|
||||
System::Call "$3" $R0
|
||||
FunctionEnd
|
||||
|
||||
Function systemSplash
|
||||
|
||||
; Save registers and get input
|
||||
System::Store "s r8r9"
|
||||
|
||||
; Get module instance
|
||||
System::Call "${sysGetModuleHandle} (p) .r7"
|
||||
|
||||
; Get arrow cursor
|
||||
System::Call "${sysLoadCursor} (0, p ${IDC_ARROW}) .R9"
|
||||
|
||||
; Get callback
|
||||
System::Get "${sysWNDPROC}"
|
||||
Pop $3
|
||||
|
||||
; Create window class
|
||||
System::Call "*${stWNDCLASS} (0,r3,0,0,r7,0,R9,0,p 0,'_sp') .R9"
|
||||
|
||||
; Register window class
|
||||
System::Call "${sysRegisterClass} (R9) .R9"
|
||||
IntCmp $R9 0 errorexit ; Class registered ok?
|
||||
|
||||
; Load Image (LR_CREATEDIBSECTION|LR_LOADFROMFILE = 0x2010)
|
||||
System::Call '${sysLoadImage} (, s, ${IMAGE_BITMAP}, 0, 0, ${LR_CREATEDIBSECTION}|${LR_LOADFROMFILE}) .r6' "$9.bmp"
|
||||
IntCmp $6 0 errorexit ; Image loaded ok?
|
||||
|
||||
; Start the sound (SND_ASYNC|SND_FILENAME|SND_NODEFAULT = 0x20003)
|
||||
System::Call "${sysPlaySound} (s,,${SND_ASYNC}|${SND_FILENAME}|${SND_NODEFAULT})" "$9.wav"
|
||||
|
||||
; Create window
|
||||
System::Call "${sysCreateWindowEx} (${WS_EX_TOOLWINDOW}, s, s,,,,,, $HWNDPARENT,,r7,) .s" "_sp" "_sp"
|
||||
!insertmacro SINGLE_CALLBACK 1 $5 1 _systemSplashWndCB
|
||||
|
||||
; Create MSG struct
|
||||
System::Call "*${stMSG} (_) p.R9"
|
||||
|
||||
; -------------------------
|
||||
repeat:
|
||||
; Check for window
|
||||
System::Call "${sysIsWindow} (r5) .s"
|
||||
!insertmacro SINGLE_CALLBACK 2 $R8 1 _systemSplashWndCB
|
||||
IntCmp $R8 0 finish
|
||||
|
||||
; Get message
|
||||
System::Call "${sysGetMessage} (R9, r5,_) .s"
|
||||
!insertmacro SINGLE_CALLBACK 3 $R8 1 _systemSplashWndCB
|
||||
IntCmp $R8 0 finish
|
||||
|
||||
; Dispatch message
|
||||
System::Call "${sysDispatchMessage} (R9) .s"
|
||||
!insertmacro SINGLE_CALLBACK 4 $R8 1 _systemSplashWndCB
|
||||
|
||||
; Repeat dispatch cycle
|
||||
goto repeat
|
||||
; -------------------------
|
||||
|
||||
finish:
|
||||
; Stop the sound
|
||||
System::Call "${sysPlaySound} (p 0, p 0, i 0)"
|
||||
|
||||
; Delete bitmap object
|
||||
System::Call "${sysDeleteObject} (r6)"
|
||||
|
||||
; Delete the callback queue
|
||||
System::Free $3
|
||||
|
||||
; Dialog return
|
||||
StrCpy $R0 $4
|
||||
goto exit
|
||||
|
||||
; Exit in case of error
|
||||
errorexit:
|
||||
StrCpy $R0 -1
|
||||
goto exit
|
||||
|
||||
exit:
|
||||
; Restore register and put output
|
||||
System::Store "P0 l"
|
||||
FunctionEnd
|
||||
|
||||
!endif
|
||||
!verbose pop
|
413
KattekerCreator/nsis/Examples/System/System.nsh
Normal file
413
KattekerCreator/nsis/Examples/System/System.nsh
Normal file
@ -0,0 +1,413 @@
|
||||
; Some useful functions, structures, constants
|
||||
;
|
||||
; (c) brainsucker, 2002
|
||||
; (r) BSForce
|
||||
|
||||
!verbose push 3
|
||||
!ifndef System.NSH.Included
|
||||
!define System.NSH.Included
|
||||
|
||||
!include WinCore.nsh
|
||||
|
||||
; ------------- Functions --------------
|
||||
|
||||
; LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
!define sysWNDPROC "(p.s, i.s, p.s, p.s) pss"
|
||||
|
||||
; LRESULT DefWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||
!define sysDefWindowProc "user32::DefWindowProc(p, i, p, p) p"
|
||||
|
||||
!define sysMessageBox "user32::MessageBox(p, t, t, i) i"
|
||||
|
||||
!define sysMessageBeep "user32::MessageBeep(i) i"
|
||||
|
||||
!define sysMessageBoxIndirect 'user32::MessageBoxIndirect(p) i'
|
||||
|
||||
; HMODULE GetModuleHandle(LPCTSTR lpModuleName);
|
||||
!define sysGetModuleHandle "kernel32::GetModuleHandle(t) i"
|
||||
|
||||
; HMODULE LoadLibrary(LPCTSTR lpFileName);
|
||||
!define sysLoadLibrary "kernel32::LoadLibrary(t) p"
|
||||
|
||||
; BOOL FreeLibrary(HMODULE hModule);
|
||||
!define sysFreeLibrary "kernel32::FreeLibrary(p) i"
|
||||
|
||||
; HCURSOR LoadCursor(HINSTANCE hInstance, LPCTSTR lpCursorName);
|
||||
!define sysLoadCursor "user32::LoadCursor(p, t) p"
|
||||
|
||||
; ATOM RegisterClass(CONST WNDCLASS *lpWndClass);
|
||||
!define sysRegisterClass "user32::RegisterClass(p) i"
|
||||
|
||||
; HANDLE LoadImage(HINSTANCE hinst, LPCTSTR lpszName, UINT uType,
|
||||
; int cxDesired, int cyDesired, UINT fuLoad);
|
||||
!define sysLoadImage "user32::LoadImage(p, t, i, i, i, i) p"
|
||||
|
||||
; BOOL PlaySound(LPCSTR pszSound, HMODULE hmod, DWORD fdwSound);
|
||||
!define sysPlaySound "winmm.dll::PlaySound(t, p, i) i"
|
||||
|
||||
; HWND CreateWindowEx(DWORD dwExStyle, LPCTSTR lpClassName, LPCTSTR lpWindowName,
|
||||
; DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent,
|
||||
; HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam);
|
||||
!define sysCreateWindowEx "user32::CreateWindowEx(i, t, t, i, i, i, i, i, p, p, p, p) p"
|
||||
|
||||
; BOOL IsWindow(HWND hWnd);
|
||||
!define sysIsWindow "user32::IsWindow(p) i"
|
||||
|
||||
; LONG SetWindowLong(HWND hWnd, int nIndex, LONG dwNewLong);
|
||||
!define sysSetWindowLong "user32::SetWindowLong(p, i, p) p"
|
||||
|
||||
; BOOL SetWindowPos(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags);
|
||||
!define sysSetWindowPos "user32::SetWindowPos(p, p, i, i, i, i, i) i"
|
||||
|
||||
; BOOL ShowWindow(HWND hWnd, int nCmdShow);
|
||||
!define sysShowWindow "user32::ShowWindow(p, i) i"
|
||||
|
||||
; BOOL DestroyWindow(HWND hWnd);
|
||||
!define sysDestroyWindow "user32::DestroyWindow(p) i"
|
||||
|
||||
; BOOL GetClientRect(HWND hWnd, LPRECT lpRect);
|
||||
!define sysGetClientRect "user32::GetClientRect(p, p) i"
|
||||
|
||||
; BOOL GetMessage(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax);
|
||||
!define sysGetMessage "user32::GetMessage(p, p, i, i) i"
|
||||
|
||||
; LRESULT DispatchMessage(CONST MSG *lpmsg);
|
||||
!define sysDispatchMessage "user32::DispatchMessage(p) p"
|
||||
|
||||
; BOOL DeleteObject(HGDIOBJ hObject);
|
||||
!define sysDeleteObject "gdi32::DeleteObject(p) i"
|
||||
|
||||
; int GetObject(HGDIOBJ hgdiobj, int cbBuffer, LPVOID lpvObject);
|
||||
!define sysGetObject "gdi32::GetObject(p, i, p) i"
|
||||
|
||||
; HGDIOBJ SelectObject(HDC hdc, HGDIOBJ hgdiobj);
|
||||
!define sysSelectObject "gdi32::SelectObject(p, p) p"
|
||||
|
||||
; HDC CreateCompatibleDC(HDC hdc);
|
||||
!define sysCreateCompatibleDC "gdi32::CreateCompatibleDC(p) p"
|
||||
|
||||
; BOOL DeleteDC(HDC hdc);
|
||||
!define sysDeleteDC "gdi32::DeleteDC(p) i"
|
||||
|
||||
; BOOL BitBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight,
|
||||
; HDC hdcSrc, int nXSrc, int nYSrc, DWORD dwRop);
|
||||
!define sysBitBlt "gdi32::BitBlt(p, i, i, i, i, p, i, i, i) i"
|
||||
|
||||
; proposed by abgandar
|
||||
; int AddFontResource(LPCTSTR lpszFilename);
|
||||
!define sysAddFontResource "gdi32::AddFontResource(t) i"
|
||||
|
||||
; HDC BeginPaint(HWND hwnd, LPPAINTSTRUCT lpPaint);
|
||||
!define sysBeginPaint "user32::BeginPaint(p, p) p"
|
||||
|
||||
; BOOL EndPaint(HWND hWnd, CONST PAINTSTRUCT *lpPaint);
|
||||
!define sysEndPaint "user32::EndPaint(p, p) i"
|
||||
|
||||
; BOOL SystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni);
|
||||
!define sysSystemParametersInfo "user32::SystemParametersInfo(i, i, p, i) i"
|
||||
|
||||
; UINT_PTR SetTimer(HWND hWnd, UINT_PTR nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc);
|
||||
!define sysSetTimer "user32::SetTimer(p, p, i, k) i"
|
||||
|
||||
; DWORD GetLogicalDriveStrings(DWORD nBufferLength, LPTSTR LpBuffer);
|
||||
!define sysGetLogicalDriveStrings 'kernel32::GetLogicalDriveStrings(i, p) i'
|
||||
|
||||
!define sysGetDiskFreeSpaceEx 'kernel32::GetDiskFreeSpaceEx(t, *l, *l, *l) i'
|
||||
|
||||
; UINT GetDriveType(LPCTSTR lpRootPathName);
|
||||
!define sysGetDriveType 'kernel32::GetDriveType(t) i'
|
||||
|
||||
; HANDLE FindFirstFile(LPCTSTR lpFileName,LPWIN32_FIND_DATA lpFindFileData);
|
||||
!define sysFindFirstFile 'kernel32::FindFirstFile(t, p) p'
|
||||
|
||||
; BOOL FindClose(HANDLE hFindFile);
|
||||
!define sysFindClose 'kernel32::FindClose(p) i'
|
||||
|
||||
; BOOL FileTimeToSystemTime(CONST FILETIME *lpFileTime,
|
||||
; LPSYSTEMTIME lpSystemTime);
|
||||
!define sysFileTimeToSystemTime 'kernel32::FileTimeToSystemTime(*l, p) i'
|
||||
|
||||
; BOOL FileTimeToLocalFileTime(
|
||||
; CONST FILETIME *lpFileTime,
|
||||
; LPFILETIME lpLocalFileTime);
|
||||
!define sysFileTimeToLocalFileTime 'kernel32::FileTimeToLocalFileTime(*l, *l) i'
|
||||
|
||||
; BOOL SystemTimeToTzSpecificLocalTime(LPTIME_ZONE_INFORMATION lpTimeZone,
|
||||
; LPSYSTEMTIME lpUniversalTime, LPSYSTEMTIME lpLocalTime);
|
||||
!define sysSystemTimeToTzSpecificLocalTime 'kernel32::SystemTimeToTzSpecificLocalTime(p, p, p) i'
|
||||
|
||||
!define syslstrlen 'kernel32::lstrlen(t) i'
|
||||
|
||||
; int wsprintf(LPTSTR lpOut, LPCTSTR lpFmt, ...);
|
||||
!define syswsprintf "user32::wsprintf(t, t) i ? c"
|
||||
|
||||
; ------------- Structures --------------
|
||||
|
||||
; typedef struct _WNDCLASS {
|
||||
; UINT style;
|
||||
; WNDPROC lpfnWndProc;
|
||||
; int cbClsExtra;
|
||||
; int cbWndExtra;
|
||||
; HINSTANCE hInstance;
|
||||
; HICON hIcon;
|
||||
; HCURSOR hCursor;
|
||||
; HBRUSH hbrBackground;
|
||||
; LPCTSTR lpszMenuName;
|
||||
; LPCTSTR lpszClassName;
|
||||
; } WNDCLASS, *PWNDCLASS;
|
||||
!define stWNDCLASS "(i, k, i, i, p, p, p, p, t, t) p"
|
||||
|
||||
; typedef struct tagMSG {
|
||||
; HWND hwnd;
|
||||
; UINT message;
|
||||
; WPARAM wParam;
|
||||
; LPARAM lParam;
|
||||
; DWORD time;
|
||||
; POINT pt; -> will be presented as two separate px and py
|
||||
; } MSG, *PMSG;
|
||||
!define stMSG "(p, i, p, p, i, i, i) p"
|
||||
|
||||
; typedef struct tagBITMAP {
|
||||
; LONG bmType;
|
||||
; LONG bmWidth;
|
||||
; LONG bmHeight;
|
||||
; LONG bmWidthBytes;
|
||||
; WORD bmPlanes;
|
||||
; WORD bmBitsPixel;
|
||||
; LPVOID bmBits;
|
||||
; } BITMAP, *PBITMAP;
|
||||
!define stBITMAP "(i, i, i, i, i, i, p) p"
|
||||
|
||||
; typedef struct _RECT {
|
||||
; LONG left;
|
||||
; LONG top;
|
||||
; LONG right;
|
||||
; LONG bottom;
|
||||
; } RECT, *PRECT;
|
||||
!define stRECT "(i, i, i, i) p"
|
||||
|
||||
; typedef struct tagPAINTSTRUCT {
|
||||
; HDC hdc;
|
||||
; BOOL fErase;
|
||||
; RECT rcPaint; (rcl, rct, rcr, rcb)
|
||||
; BOOL fRestore;
|
||||
; BOOL fIncUpdate;
|
||||
; BYTE rgbReserved[32];
|
||||
; } PAINTSTRUCT, *PPAINTSTRUCT;
|
||||
!define stPAINTSTRUCT "(p, i, i, i, i, i, i, i, &v32) p"
|
||||
|
||||
; typedef struct {
|
||||
; UINT cbSize;
|
||||
; HWND hwndOwner;
|
||||
; HINSTANCE hInstance;
|
||||
; LPCTSTR lpszText;
|
||||
; LPCTSTR lpszCaption;
|
||||
; DWORD dwStyle;
|
||||
; LPCTSTR lpszIcon;
|
||||
; DWORD_PTR dwContextHelpId;
|
||||
; MSGBOXCALLBACK lpfnMsgBoxCallback;
|
||||
; DWORD dwLanguageId;
|
||||
; } MSGBOXPARAMS, *PMSGBOXPARAMS;
|
||||
!define stMSGBOXPARAMS '(&l4, p, p, t, t, i, t, p, k, i) p'
|
||||
|
||||
; typedef struct _SYSTEMTIME {
|
||||
; WORD wYear;
|
||||
; WORD wMonth;
|
||||
; WORD wDayOfWeek;
|
||||
; WORD wDay;
|
||||
; WORD wHour;
|
||||
; WORD wMinute;
|
||||
; WORD wSecond;
|
||||
; WORD wMilliseconds;
|
||||
; } SYSTEMTIME, *PSYSTEMTIME;
|
||||
!define stSYSTEMTIME '(&i2, &i2, &i2, &i2, &i2, &i2, &i2, &i2) p'
|
||||
|
||||
; Maximal windows path
|
||||
!define /ifndef MAX_PATH 260
|
||||
|
||||
; typedef struct _WIN32_FIND_DATA {
|
||||
; DWORD dwFileAttributes;
|
||||
; FILETIME ftCreationTime;
|
||||
; FILETIME ftLastAccessTime;
|
||||
; FILETIME ftLastWriteTime;
|
||||
; DWORD nFileSizeHigh;
|
||||
; DWORD nFileSizeLow;
|
||||
; DWORD dwReserved0;
|
||||
; DWORD dwReserved1;
|
||||
; TCHAR cFileName[ MAX_PATH ];
|
||||
; TCHAR cAlternateFileName[ 14 ];
|
||||
; } WIN32_FIND_DATA, *PWIN32_FIND_DATA;
|
||||
!define stWIN32_FIND_DATA '(i, l, l, l, i, i, i, i, &t${MAX_PATH}, &t14) p'
|
||||
|
||||
; ------------- Constants --------------
|
||||
|
||||
; == Other ==
|
||||
!define /ifndef INVALID_HANDLE_VALUE -1
|
||||
|
||||
; == Sounds ==
|
||||
|
||||
!define SND_SYNC 0x0000
|
||||
!define SND_ASYNC 0x0001
|
||||
!define SND_NODEFAULT 0x0002
|
||||
!define SND_MEMORY 0x0004
|
||||
!define SND_LOOP 0x0008
|
||||
!define SND_NOSTOP 0x0010
|
||||
|
||||
!define SND_NOWAIT 0x00002000
|
||||
!define SND_ALIAS 0x00010000
|
||||
!define SND_ALIAS_ID 0x00110000
|
||||
!define SND_FILENAME 0x00020000
|
||||
!define SND_RESOURCE 0x00040004
|
||||
!define SND_PURGE 0x0040
|
||||
!define SND_APPLICATION 0x0080
|
||||
|
||||
; == Windows ==
|
||||
|
||||
!define /ifndef WS_OVERLAPPED 0x00000000
|
||||
!define /ifndef WS_POPUP 0x80000000
|
||||
!define /ifndef WS_CHILD 0x40000000
|
||||
!define /ifndef WS_MINIMIZE 0x20000000
|
||||
!define /ifndef WS_VISIBLE 0x10000000
|
||||
!define /ifndef WS_DISABLED 0x08000000
|
||||
!define /ifndef WS_CLIPSIBLINGS 0x04000000
|
||||
!define /ifndef WS_CLIPCHILDREN 0x02000000
|
||||
!define /ifndef WS_MAXIMIZE 0x01000000
|
||||
!define /ifndef WS_CAPTION 0x00C00000
|
||||
!define /ifndef WS_BORDER 0x00800000
|
||||
!define /ifndef WS_DLGFRAME 0x00400000
|
||||
!define /ifndef WS_VSCROLL 0x00200000
|
||||
!define /ifndef WS_HSCROLL 0x00100000
|
||||
!define /ifndef WS_SYSMENU 0x00080000
|
||||
!define /ifndef WS_THICKFRAME 0x00040000
|
||||
!define /ifndef WS_GROUP 0x00020000
|
||||
!define /ifndef WS_TABSTOP 0x00010000
|
||||
!define /ifndef WS_MINIMIZEBOX 0x00020000
|
||||
!define /ifndef WS_MAXIMIZEBOX 0x00010000
|
||||
!define /ifndef WS_TILED ${WS_OVERLAPPED}
|
||||
!define /ifndef WS_ICONIC ${WS_MINIMIZE}
|
||||
!define /ifndef WS_SIZEBOX ${WS_THICKFRAME}
|
||||
!define /ifndef WS_OVERLAPPEDWINDOW 0x00CF0000
|
||||
!define /ifndef WS_TILEDWINDOW ${WS_OVERLAPPEDWINDOW}
|
||||
!define /ifndef WS_POPUPWINDOW 0x80880000
|
||||
!define /ifndef WS_CHILDWINDOW ${WS_CHILD}
|
||||
!define /ifndef WS_EX_DLGMODALFRAME 0x00000001
|
||||
!define /ifndef WS_EX_NOPARENTNOTIFY 0x00000004
|
||||
!define /ifndef WS_EX_TOPMOST 0x00000008
|
||||
!define /ifndef WS_EX_ACCEPTFILES 0x00000010
|
||||
!define /ifndef WS_EX_TRANSPARENT 0x00000020
|
||||
!define /ifndef WS_EX_MDICHILD 0x00000040
|
||||
!define /ifndef WS_EX_TOOLWINDOW 0x00000080
|
||||
!define /ifndef WS_EX_WINDOWEDGE 0x00000100
|
||||
!define /ifndef WS_EX_CLIENTEDGE 0x00000200
|
||||
!define /ifndef WS_EX_CONTEXTHELP 0x00000400
|
||||
!define /ifndef WS_EX_RIGHT 0x00001000
|
||||
!define /ifndef WS_EX_LEFT 0x00000000
|
||||
!define /ifndef WS_EX_RTLREADING 0x00002000
|
||||
!define /ifndef WS_EX_LTRREADING 0x00000000
|
||||
!define /ifndef WS_EX_LEFTSCROLLBAR 0x00004000
|
||||
!define /ifndef WS_EX_RIGHTSCROLLBAR 0x00000000
|
||||
!define /ifndef WS_EX_CONTROLPARENT 0x00010000
|
||||
!define /ifndef WS_EX_STATICEDGE 0x00020000
|
||||
!define /ifndef WS_EX_APPWINDOW 0x00040000
|
||||
!define /ifndef WS_EX_OVERLAPPEDWINDOW 0x00000300
|
||||
!define /ifndef WS_EX_PALETTEWINDOW 0x00000188
|
||||
!define /ifndef WS_EX_LAYERED 0x00080000
|
||||
!define /ifndef WS_EX_NOINHERITLAYOUT 0x00100000
|
||||
!define /ifndef WS_EX_LAYOUTRTL 0x00400000
|
||||
!define /ifndef WS_EX_COMPOSITED 0x02000000
|
||||
!define /ifndef WS_EX_NOACTIVATE 0x08000000
|
||||
|
||||
|
||||
; == System Parameters Info ==
|
||||
|
||||
!define SPI_GETWORKAREA 0x0030
|
||||
|
||||
; == Window swap ==
|
||||
|
||||
!define SWP_NOSIZE 0x0001
|
||||
!define SWP_NOMOVE 0x0002
|
||||
!define SWP_NOZORDER 0x0004
|
||||
!define SWP_NOREDRAW 0x0008
|
||||
!define SWP_NOACTIVATE 0x0010
|
||||
!define SWP_FRAMECHANGED 0x0020
|
||||
!define SWP_SHOWWINDOW 0x0040
|
||||
!define SWP_HIDEWINDOW 0x0080
|
||||
!define SWP_NOCOPYBITS 0x0100
|
||||
!define SWP_NOOWNERZORDER 0x0200
|
||||
!define SWP_NOSENDCHANGING 0x0400
|
||||
|
||||
!define SWP_DRAWFRAME ${SWP_FRAMECHANGED}
|
||||
!define SWP_NOREPOSITION ${SWP_NOOWNERZORDER}
|
||||
!define SWP_DEFERERASE 0x2000
|
||||
!define SWP_ASYNCWINDOWPOS 0x4000
|
||||
|
||||
; == Bit Copy ==
|
||||
|
||||
!define SRCCOPY 0x00CC0020
|
||||
!define SRCPAINT 0x00EE0086
|
||||
!define SRCAND 0x008800C6
|
||||
!define SRCINVERT 0x00660046
|
||||
!define SRCERASE 0x00440328
|
||||
!define NOTSRCCOPY 0x00330008
|
||||
!define NOTSRCERASE 0x001100A6
|
||||
!define MERGECOPY 0x00C000CA
|
||||
!define MERGEPAINT 0x00BB0226
|
||||
!define PATCOPY 0x00F00021
|
||||
!define PATPAINT 0x00FB0A09
|
||||
!define PATINVERT 0x005A0049
|
||||
!define DSTINVERT 0x00550009
|
||||
!define BLACKNESS 0x00000042
|
||||
!define WHITENESS 0x00FF0062
|
||||
|
||||
; == Message Box ==
|
||||
|
||||
!define MB_OK 0x00000000
|
||||
!define MB_OKCANCEL 0x00000001
|
||||
!define MB_ABORTRETRYIGNORE 0x00000002
|
||||
!define MB_YESNOCANCEL 0x00000003
|
||||
!define MB_YESNO 0x00000004
|
||||
!define MB_RETRYCANCEL 0x00000005
|
||||
!define MB_CANCELTRYCONTINUE 0x00000006
|
||||
!define MB_ICONHAND 0x00000010
|
||||
!define MB_ICONQUESTION 0x00000020
|
||||
!define MB_ICONEXCLAMATION 0x00000030
|
||||
!define MB_ICONASTERISK 0x00000040
|
||||
!define MB_USERICON 0x00000080
|
||||
!define MB_ICONWARNING ${MB_ICONEXCLAMATION}
|
||||
!define MB_ICONERROR ${MB_ICONHAND}
|
||||
|
||||
!define MB_ICONINFORMATION ${MB_ICONASTERISK}
|
||||
!define MB_ICONSTOP ${MB_ICONHAND}
|
||||
|
||||
!define MB_DEFBUTTON1 0x00000000
|
||||
!define MB_DEFBUTTON2 0x00000100
|
||||
!define MB_DEFBUTTON3 0x00000200
|
||||
!define MB_DEFBUTTON4 0x00000300
|
||||
|
||||
!define MB_APPLMODAL 0x00000000
|
||||
!define MB_SYSTEMMODAL 0x00001000
|
||||
!define MB_TASKMODAL 0x00002000
|
||||
!define MB_HELP 0x00004000
|
||||
|
||||
!define MB_NOFOCUS 0x00008000
|
||||
!define MB_SETFOREGROUND 0x00010000
|
||||
!define MB_DEFAULT_DESKTOP_ONLY 0x00020000
|
||||
|
||||
!define MB_TOPMOST 0x00040000
|
||||
!define MB_RIGHT 0x00080000
|
||||
!define MB_RTLREADING 0x00100000
|
||||
|
||||
|
||||
; == Callbacks ==
|
||||
|
||||
!macro SINGLE_CALLBACK CHKN RES INDEX FUNC
|
||||
CheckCB_${CHKN}:
|
||||
Pop ${RES}
|
||||
StrCmp ${RES} "callback${INDEX}" 0 ExitCB_${CHKN}
|
||||
Call ${FUNC}
|
||||
Goto CheckCB_${CHKN}
|
||||
ExitCB_${CHKN}:
|
||||
!macroend
|
||||
|
||||
!endif
|
||||
!verbose pop
|
137
KattekerCreator/nsis/Examples/System/System.nsi
Normal file
137
KattekerCreator/nsis/Examples/System/System.nsi
Normal file
@ -0,0 +1,137 @@
|
||||
; This is just an example of System Plugin
|
||||
;
|
||||
; (c) brainsucker, 2002
|
||||
; (r) BSForce
|
||||
|
||||
Name "System Plugin Example"
|
||||
OutFile "System.exe"
|
||||
|
||||
!include "SysFunc.nsh"
|
||||
|
||||
Section "ThisNameIsIgnoredSoWhyBother?"
|
||||
SetOutPath $TEMP
|
||||
|
||||
; ----- Sample 1 ----- Message box with custom icon -----
|
||||
|
||||
; there are no default beeps for custom message boxes, use sysMessageBeep
|
||||
; in case you need it (see next message box example)
|
||||
!insertmacro smMessageBox "i 0" "Message box with custom icon!" "System Example 1a" ${MB_OK} "i 103"
|
||||
; i 0 - installer exe as module
|
||||
; i 103 - icon ID
|
||||
|
||||
; The same example but using icon from resource.dll.
|
||||
; You could use this dll for storing your resources, just replace FAR icon
|
||||
; with something you really need.
|
||||
File "Resource.dll"
|
||||
System::Call '${sysMessageBeep} (${MB_ICONHAND})' ; custom beep
|
||||
!insertmacro smMessageBox "`$TEMP\resource.dll`" "Message box with custom icon from resource.dll!" "System Example 1b" ${MB_OKCANCEL} "i 103"
|
||||
Delete $TEMP\resource.dll
|
||||
|
||||
; ----- Sample 2 ----- Fixed disks size/space -----
|
||||
|
||||
StrCpy $7 ' Disk, Size, Free, Free for user:$\n$\n'
|
||||
|
||||
; Memory for paths
|
||||
System::StrAlloc 1024
|
||||
Pop $1
|
||||
; Get drives
|
||||
System::Call '${sysGetLogicalDriveStrings}(1024, r1)'
|
||||
enumok:
|
||||
; One more drive?
|
||||
System::Call '${syslstrlen}(i r1) .r2'
|
||||
IntCmp $2 0 enumex
|
||||
|
||||
; Is it DRIVE_FIXED?
|
||||
System::Call '${sysGetDriveType} (i r1) .r3'
|
||||
StrCmp $3 ${DRIVE_FIXED} 0 enumnext
|
||||
|
||||
; Drive space
|
||||
System::Call '${sysGetDiskFreeSpaceEx}(i r1, .r3, .r4, .r5)'
|
||||
|
||||
; Pretty KBs will be saved on stack
|
||||
System::Int64Op $3 / 1048576
|
||||
System::Int64Op $5 / 1048576
|
||||
System::Int64Op $4 / 1048576
|
||||
|
||||
; Get pretty drive path string
|
||||
System::Call '*$1(&t1024 .r6)'
|
||||
System::Call '${syswsprintf} (.r7, "%s%20s %20s mb %20s mb %20s mb$\n", tr7, tr6, ts, ts, ts)'
|
||||
|
||||
enumnext:
|
||||
; Next drive path
|
||||
IntOp $2 $2 * ${NSIS_CHAR_SIZE}
|
||||
IntOp $1 $1 + $2
|
||||
IntOp $1 $1 + ${NSIS_CHAR_SIZE}
|
||||
goto enumok
|
||||
enumex: ; End of drives or user cancel
|
||||
; Free memory for paths
|
||||
System::Free $1
|
||||
|
||||
; Message box
|
||||
System::Call '${sysMessageBox}($HWNDPARENT, s, "System Example 2", ${MB_OKCANCEL})' "$7"
|
||||
|
||||
; ----- Sample 3 ----- Direct proc defenition -----
|
||||
|
||||
; Direct specification demo
|
||||
System::Call 'user32::MessageBox(p $HWNDPARENT, t "Just direct MessageBox specification demo ;)", t "System Example 3", i ${MB_OK}) i.s'
|
||||
Pop $0
|
||||
|
||||
; ----- Sample 4 ----- Int64, mixed definition demo -----
|
||||
|
||||
; Long int demo
|
||||
StrCpy $2 "12312312"
|
||||
StrCpy $3 "12345678903"
|
||||
System::Int64Op $2 "*" $3
|
||||
Pop $4
|
||||
|
||||
; Cdecl demo (uses 3 defenitions (simple example))
|
||||
System::Call "${syswsprintf}(.R1, s,,, t, ir0) .R0 (,,tr2,tr3,$4_)" "Int64 ops and strange defenition demo, %s x %s == %s, and previous msgbox result = %d"
|
||||
MessageBox MB_OKCANCEL "Cool: '$R1'"
|
||||
|
||||
; ----- Sample 5 ----- Small structure example -----
|
||||
|
||||
; Create & Fill structure
|
||||
System::Call "*(i 123123123, &t10 'Hello', &i1 0x123dd, &i2 0xffeeddccaa) i.s"
|
||||
Pop $1
|
||||
; Read data from structure
|
||||
System::Call "*$1(i .r2, &t10 .r3, &i1 .r4, &i2 .r5, &l0 .r6)"
|
||||
; Show data and delete structure
|
||||
MessageBox MB_OK "Structure example: $\nint == $2 $\nstring == $3 $\nbyte == $4 $\nshort == $5 $\nsize == $6"
|
||||
System::Free $1
|
||||
|
||||
; ----- Sample 6 ----- systemGetFileSysTime demo -----
|
||||
Call GetInstallerExeName
|
||||
pop $0
|
||||
|
||||
!insertmacro smGetFileSysTime $0
|
||||
System::Call '*$R0${stSYSTEMTIME}(.r1, .r2, .r3, .r4, .r5, .r6, .r7, .r8)'
|
||||
|
||||
MessageBox MB_OK "GetFileSysTime example: file '$0', year $1, month $2, dow $3, day $4, hour $5, min $6, sec $7, ms $8"
|
||||
|
||||
; free memory from SYSTEMTIME
|
||||
System::Free $R0
|
||||
|
||||
; ----- Sample 7 ----- systemSplash -> Callbacks demonstration -----
|
||||
|
||||
; Logo
|
||||
File /oname=spltmp.bmp "${NSISDIR}\Contrib\Graphics\Header\orange-nsis.bmp"
|
||||
; File /oname=spltmp.wav "d:\Windows\Media\tada.wav"
|
||||
|
||||
; I. systemSplash variant
|
||||
!insertmacro smSystemSplash 2000 "$TEMP\spltmp"
|
||||
|
||||
; II. Splash Plugin variant
|
||||
; splash::show 2000 $TEMP\spltmp
|
||||
; Pop $R0 ; $R0 has '1' if the user closed the splash screen early,
|
||||
|
||||
; remove logo
|
||||
Delete $TEMP\spltmp.bmp
|
||||
; Delete $TEMP\spltmp.wav
|
||||
|
||||
; Display splash result
|
||||
pop $0
|
||||
MessageBox MB_OK "Splash (callbacks) demo result $R0"
|
||||
|
||||
SectionEnd
|
||||
|
||||
; eof
|
130
KattekerCreator/nsis/Examples/TextFunc.ini
Normal file
130
KattekerCreator/nsis/Examples/TextFunc.ini
Normal file
@ -0,0 +1,130 @@
|
||||
[Settings]
|
||||
NumFields=15
|
||||
NextButtonText=&Enter
|
||||
|
||||
[Field 1]
|
||||
Type=Droplist
|
||||
Flags=NOTIFY
|
||||
State=1. LineFind
|
||||
ListItems=1. LineFind|2. LineRead|3. FileReadFromEnd|4. LineSum|5. FileJoin|6. TextCompare|7. ConfigRead|8. ConfigWrite|9. FileRecode
|
||||
Left=44
|
||||
Right=139
|
||||
Top=9
|
||||
Bottom=100
|
||||
|
||||
[Field 2]
|
||||
Type=FileRequest
|
||||
Left=44
|
||||
Right=-17
|
||||
Top=30
|
||||
Bottom=41
|
||||
|
||||
[Field 3]
|
||||
Type=FileRequest
|
||||
Left=44
|
||||
Right=-17
|
||||
Top=46
|
||||
Bottom=57
|
||||
|
||||
[Field 4]
|
||||
Type=FileRequest
|
||||
State=3:-1
|
||||
Left=44
|
||||
Right=-17
|
||||
Top=62
|
||||
Bottom=75
|
||||
|
||||
[Field 5]
|
||||
Type=Droplist
|
||||
Flags=NOTIFY
|
||||
State=Example1 (delete first two symbols)
|
||||
ListItems=Example1 (delete first two symbols)|Example2 (show changed lines)|Example3 (delete lines)|Example4 (insert lines)|Example5 (replace in file - WordFunc.nsh required)|Example6 (line string to cut or delete)|Example7 (read lines)
|
||||
Left=44
|
||||
Right=-36
|
||||
Top=81
|
||||
Bottom=155
|
||||
|
||||
[Field 6]
|
||||
Type=Droplist
|
||||
Flags=NOTIFY
|
||||
State=Example1 (Different or Equal)
|
||||
ListItems=Example1 (Different or Equal)|Example2 (Compare line-by-line - Different)|Example3 (Compare line-by-line - Equal)|Example4 (Compare all lines - Different)|Example5 (Compare all lines - Equal)
|
||||
Left=44
|
||||
Right=-36
|
||||
Top=81
|
||||
Bottom=140
|
||||
|
||||
[Field 7]
|
||||
Type=Droplist
|
||||
State=FileReadFromEndCallback
|
||||
ListItems=FileReadFromEndCallback
|
||||
Left=44
|
||||
Right=-36
|
||||
Top=81
|
||||
Bottom=92
|
||||
|
||||
[Field 8]
|
||||
Type=Text
|
||||
Flags=READONLY
|
||||
Left=9
|
||||
Right=-36
|
||||
Top=108
|
||||
Bottom=120
|
||||
|
||||
[Field 9]
|
||||
Type=Button
|
||||
Text=Edit
|
||||
Flags=NOTIFY
|
||||
Left=234
|
||||
Right=256
|
||||
Top=81
|
||||
Bottom=92
|
||||
|
||||
[Field 10]
|
||||
Type=Button
|
||||
Text=Log
|
||||
Flags=NOTIFY|DISABLED
|
||||
Left=234
|
||||
Right=256
|
||||
Top=108
|
||||
Bottom=120
|
||||
|
||||
[Field 11]
|
||||
Type=Label
|
||||
Text=InputFile
|
||||
Left=10
|
||||
Right=43
|
||||
Top=32
|
||||
Bottom=44
|
||||
|
||||
[Field 12]
|
||||
Type=Label
|
||||
Text=OutputFile
|
||||
Left=10
|
||||
Right=43
|
||||
Top=48
|
||||
Bottom=60
|
||||
|
||||
[Field 13]
|
||||
Type=Label
|
||||
Text=Range
|
||||
Left=10
|
||||
Right=44
|
||||
Top=65
|
||||
Bottom=75
|
||||
|
||||
[Field 14]
|
||||
Type=Label
|
||||
Text=Function
|
||||
Left=10
|
||||
Right=43
|
||||
Top=81
|
||||
Bottom=92
|
||||
|
||||
[Field 15]
|
||||
Type=Label
|
||||
Text=Result:
|
||||
Left=10
|
||||
Right=229
|
||||
Top=97
|
||||
Bottom=105
|
834
KattekerCreator/nsis/Examples/TextFunc.nsi
Normal file
834
KattekerCreator/nsis/Examples/TextFunc.nsi
Normal file
@ -0,0 +1,834 @@
|
||||
;_____________________________________________________________________________
|
||||
;
|
||||
; Text Functions
|
||||
;_____________________________________________________________________________
|
||||
;
|
||||
; 2006 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)
|
||||
|
||||
Name "Text Functions"
|
||||
OutFile "TextFunc.exe"
|
||||
Caption "$(^Name)"
|
||||
XPStyle on
|
||||
RequestExecutionLevel user
|
||||
|
||||
!include "WinMessages.nsh"
|
||||
!include "TextFunc.nsh"
|
||||
|
||||
Var HWND
|
||||
Var INI
|
||||
Var LOG
|
||||
Var PROJECT
|
||||
Var CALLBACK
|
||||
Var VIEW
|
||||
Var FUNCTION
|
||||
Var LINEFIND1
|
||||
Var LINEFIND2
|
||||
Var LINEFIND3
|
||||
Var LINEREAD1
|
||||
Var LINEREAD2
|
||||
Var FILEREADFROMEND1
|
||||
Var LINESUM1
|
||||
Var FILEJOIN1
|
||||
Var FILEJOIN2
|
||||
Var FILEJOIN3
|
||||
Var TEXTCOMPARE1
|
||||
Var TEXTCOMPARE2
|
||||
Var TEXTCOMPARE3
|
||||
Var CONFIGREAD1
|
||||
Var CONFIGREAD2
|
||||
Var CONFIGWRITE1
|
||||
Var CONFIGWRITE2
|
||||
Var CONFIGWRITE3
|
||||
Var FILERECODE1
|
||||
Var FILERECODE2
|
||||
|
||||
Page Custom ShowCustom LeaveCustom
|
||||
|
||||
Function ShowCustom
|
||||
InstallOptions::initDialog "$INI"
|
||||
Pop $hwnd
|
||||
GetDlgItem $0 $HWND 1206
|
||||
ShowWindow $0 0
|
||||
GetDlgItem $0 $HWND 1208
|
||||
ShowWindow $0 0
|
||||
GetDlgItem $0 $HWND 1209
|
||||
ShowWindow $0 0
|
||||
StrCpy $FUNCTION LineFind
|
||||
StrCpy $LINEREAD2 10
|
||||
StrCpy $TEXTCOMPARE3 FastDiff
|
||||
StrCpy $CONFIGREAD1 "$WINDIR\system.ini"
|
||||
StrCpy $CONFIGREAD2 "shell="
|
||||
StrCpy $FILERECODE2 CharToOem
|
||||
InstallOptions::show
|
||||
Pop $0
|
||||
FunctionEnd
|
||||
|
||||
Function LeaveCustom
|
||||
ReadINIStr $0 $INI "Settings" "State"
|
||||
ReadINIStr $R0 $INI "Field 1" "State"
|
||||
ReadINIStr $R1 $INI "Field 2" "State"
|
||||
ReadINIStr $R2 $INI "Field 3" "State"
|
||||
ReadINIStr $R3 $INI "Field 4" "State"
|
||||
ReadINIStr $R4 $INI "Field 5" "State"
|
||||
ReadINIStr $R5 $INI "Field 6" "State"
|
||||
StrCpy $R4 $R4 8
|
||||
StrCpy $R5 $R5 8
|
||||
StrCpy $6 0
|
||||
StrCpy $7 '$${'
|
||||
StrCpy $8 'r'
|
||||
StrCpy $9 'n'
|
||||
|
||||
StrCmp $0 10 Log
|
||||
StrCmp $0 9 ViewOrEdit
|
||||
StrCmp $0 0 Enter
|
||||
goto MainSend
|
||||
|
||||
Log:
|
||||
Exec 'notepad.exe $LOG'
|
||||
Abort
|
||||
|
||||
ViewOrEdit:
|
||||
StrCmp $FUNCTION FileReadFromEnd 0 Edit
|
||||
StrCmp $VIEW '' 0 ViewFileReadFromEndCallback
|
||||
GetTempFileName $VIEW $PLUGINSDIR
|
||||
StrCpy $7 '$$'
|
||||
FileOpen $0 $VIEW w
|
||||
FileWrite $0 `Function FileReadFromEndCallback$\r$\n`
|
||||
FileWrite $0 ` MessageBox MB_OKCANCEL '$7$$9 "Line"=[$$9]$7\$9$7$$8 "#"=[$$8]$7\$9$7$$7 "-#"=[$$7]' IDOK +2$\r$\n`
|
||||
FileWrite $0 ` StrCpy $$R0 StopFileReadFromEnd$\r$\n$\r$\n`
|
||||
FileWrite $0 ` Push $$R0$\r$\n`
|
||||
FileWrite $0 `FunctionEnd$\r$\n`
|
||||
FileClose $0
|
||||
StrCpy $7 '$${'
|
||||
SetFileAttributes $VIEW READONLY
|
||||
ViewFileReadFromEndCallback:
|
||||
Exec 'notepad.exe $VIEW'
|
||||
Abort
|
||||
|
||||
Edit:
|
||||
StrCmp $CALLBACK '' +5
|
||||
StrCmp $6$R6 '0$R0$R4$R5' showproject
|
||||
StrCmp $R6 '$R0$R4$R5' +3
|
||||
Delete $CALLBACK
|
||||
StrCpy $CALLBACK ''
|
||||
StrCpy $R6 '$R0$R4$R5'
|
||||
|
||||
#Project#
|
||||
StrCmp $6$R0 "01. LineFind" 0 +5
|
||||
IfFileExists $CALLBACK +2
|
||||
GetTempFileName $CALLBACK $PLUGINSDIR
|
||||
FileOpen $0 $CALLBACK w
|
||||
goto function
|
||||
IfFileExists $PROJECT +2
|
||||
GetTempFileName $PROJECT $PLUGINSDIR
|
||||
FileOpen $0 $PROJECT w
|
||||
|
||||
#Name#
|
||||
FileWrite $0 'Name "$FUNCTION"$\r$\n'
|
||||
FileWrite $0 'OutFile "$PROJECT.exe"$\r$\n$\r$\n'
|
||||
|
||||
#!include#
|
||||
StrCmp $R0$R4 '1. LineFindExample5' 0 TextFuncInclude
|
||||
IfFileExists '$EXEDIR\WordFunc.nsh' 0 +3
|
||||
FileWrite $0 '!include "$EXEDIR\WordFunc.nsh"$\r$\n'
|
||||
goto +2
|
||||
FileWrite $0 '!include "WordFunc.nsh"$\r$\n'
|
||||
FileWrite $0 '!insertmacro WordFind$\r$\n'
|
||||
FileWrite $0 '!insertmacro WordFindS$\r$\n'
|
||||
FileWrite $0 '!insertmacro WordFind2X$\r$\n'
|
||||
FileWrite $0 '!insertmacro WordFind2XS$\r$\n'
|
||||
FileWrite $0 '!insertmacro WordFind3X$\r$\n'
|
||||
FileWrite $0 '!insertmacro WordFind3XS$\r$\n'
|
||||
FileWrite $0 '!insertmacro WordReplace$\r$\n'
|
||||
FileWrite $0 '!insertmacro WordReplaceS$\r$\n'
|
||||
FileWrite $0 '!insertmacro WordAdd$\r$\n'
|
||||
FileWrite $0 '!insertmacro WordAddS$\r$\n'
|
||||
FileWrite $0 '!insertmacro WordInsert$\r$\n'
|
||||
FileWrite $0 '!insertmacro WordInsertS$\r$\n'
|
||||
FileWrite $0 '!insertmacro StrFilter$\r$\n'
|
||||
FileWrite $0 '!insertmacro StrFilterS$\r$\n'
|
||||
TextFuncInclude:
|
||||
IfFileExists '$EXEDIR\TextFunc.nsh' 0 +3
|
||||
FileWrite $0 '!include "$EXEDIR\TextFunc.nsh"$\r$\n'
|
||||
goto +2
|
||||
FileWrite $0 '!include "TextFunc.nsh"$\r$\n'
|
||||
FileWrite $0 '!insertmacro $FUNCTION$\r$\n'
|
||||
StrCmp $FUNCTION TextCompare +2
|
||||
FileWrite $0 '!insertmacro TrimNewLines$\r$\n'
|
||||
|
||||
#Section#
|
||||
FileWrite $0 '$\r$\nSection -empty$\r$\n'
|
||||
FileWrite $0 'SectionEnd$\r$\n$\r$\n'
|
||||
|
||||
#Function .onInit#
|
||||
FileWrite $0 'Function .onInit$\r$\n'
|
||||
StrCmp $R0$R5 "6. TextCompareExample1" 0 TextCompareExample235
|
||||
FileWrite $0 ' StrCpy $$R0 ""$\r$\n'
|
||||
FileWrite $0 ' $7TextCompare} "$R1" "$R2" "$R3" "$R5"$\r$\n'
|
||||
FileWrite $0 ' IfErrors error$\r$\n'
|
||||
FileWrite $0 ' StrCmp $$R0 NotEqual 0 +2$\r$\n'
|
||||
FileWrite $0 ' MessageBox MB_OK " Files differ" IDOK +2$\r$\n'
|
||||
FileWrite $0 ' MessageBox MB_OK " Files identical"$\r$\n'
|
||||
FileWrite $0 ' goto end$\r$\n$\r$\n'
|
||||
goto endoninit
|
||||
TextCompareExample235:
|
||||
StrCmp $R0$R5 "6. TextCompareExample2" +3
|
||||
StrCmp $R0$R5 "6. TextCompareExample3" +2
|
||||
StrCmp $R0$R5 "6. TextCompareExample5" 0 TextCompareExample4
|
||||
FileWrite $0 ' StrCpy $$R0 "$R1"$\r$\n'
|
||||
FileWrite $0 ' StrCpy $$R1 "$R2"$\r$\n$\r$\n'
|
||||
FileWrite $0 ' GetTempFileName $$R2$\r$\n'
|
||||
FileWrite $0 ' FileOpen $$R3 $$R2 w$\r$\n'
|
||||
FileWrite $0 ' FileWrite $$R3 "$$R0 | $$R1$$\$8$$\$9"$\r$\n'
|
||||
FileWrite $0 ' $7TextCompare} "$$R0" "$$R1" "$R3" "$R5"$\r$\n'
|
||||
FileWrite $0 ' IfErrors error$\r$\n'
|
||||
FileWrite $0 ' Exec "notepad.exe $$R2"$\r$\n'
|
||||
FileWrite $0 ' goto end$\r$\n$\r$\n'
|
||||
goto endoninit
|
||||
TextCompareExample4:
|
||||
StrCmp $R0$R5 "6. TextCompareExample4" 0 LineFindExample123456
|
||||
FileWrite $0 ' StrCpy $$R0 "$R1"$\r$\n'
|
||||
FileWrite $0 ' StrCpy $$R1 "$R2"$\r$\n$\r$\n'
|
||||
FileWrite $0 ' GetTempFileName $$R2$\r$\n'
|
||||
FileWrite $0 ' FileOpen $$R3 $$R2 w$\r$\n'
|
||||
FileWrite $0 ' FileWrite $$R3 "$$R0 | $$R1$$\$8$$\$9"$\r$\n'
|
||||
FileWrite $0 ' $7TextCompare} "$$R0" "$$R1" "$R3" "$R5"$\r$\n'
|
||||
FileWrite $0 ' IfErrors error$\r$\n'
|
||||
FileWrite $0 ' FileWrite $$R3 "$$\$8$$\$9$$R1 | $$R0$$\$8$$\$9"$\r$\n'
|
||||
FileWrite $0 ' $7TextCompare} "$$R1" "$$R0" "$R3" "$R5"$\r$\n'
|
||||
FileWrite $0 ' FileClose $$R3$\r$\n'
|
||||
FileWrite $0 ' IfErrors error$\r$\n'
|
||||
FileWrite $0 ' Exec "notepad.exe $$R2"$\r$\n$\r$\n'
|
||||
FileWrite $0 ' goto end$\r$\n$\r$\n'
|
||||
goto endoninit
|
||||
LineFindExample123456:
|
||||
FileWrite $0 ' $7$FUNCTION} "$R1" "$R2" "$R3" "$R4"$\r$\n'
|
||||
FileWrite $0 ' IfErrors error$\r$\n'
|
||||
FileWrite $0 ' MessageBox MB_YESNO " Open output file?" IDNO end$\r$\n'
|
||||
FileWrite $0 ' StrCmp "$R2" "" 0 +3$\r$\n'
|
||||
FileWrite $0 ` Exec 'notepad.exe "$R1"'$\r$\n`
|
||||
FileWrite $0 ' goto end$\r$\n'
|
||||
FileWrite $0 ' SearchPath $$R2 "$R2"$\r$\n'
|
||||
FileWrite $0 ` Exec 'notepad.exe "$$R2"'$\r$\n`
|
||||
FileWrite $0 ' goto end$\r$\n$\r$\n'
|
||||
endoninit:
|
||||
FileWrite $0 ' error:$\r$\n'
|
||||
FileWrite $0 ' MessageBox MB_OK "Error"$\r$\n$\r$\n'
|
||||
FileWrite $0 ' end:$\r$\n'
|
||||
FileWrite $0 ' Quit$\r$\n'
|
||||
FileWrite $0 'FunctionEnd$\r$\n$\r$\n'
|
||||
#FunctionEnd#
|
||||
|
||||
|
||||
#Function CallBack#
|
||||
StrCmp $CALLBACK '' 0 close
|
||||
function:
|
||||
StrCmp $R0 '1. LineFind' 0 +8
|
||||
FileWrite $0 'Function $R4$\r$\n'
|
||||
StrCmp $R4 "Example1" Example1LF
|
||||
StrCmp $R4 "Example2" Example2LF
|
||||
StrCmp $R4 "Example3" Example3LF
|
||||
StrCmp $R4 "Example4" Example4LF
|
||||
StrCmp $R4 "Example5" Example5LF
|
||||
StrCmp $R4 "Example6" Example6LF
|
||||
|
||||
FileWrite $0 'Function $R5$\r$\n'
|
||||
StrCmp $R5 "Example1" Example1TC
|
||||
StrCmp $R5 "Example2" Example2TC
|
||||
StrCmp $R5 "Example3" Example3TC
|
||||
StrCmp $R5 "Example4" Example4TC
|
||||
StrCmp $R5 "Example5" Example3TC
|
||||
|
||||
Example1LF:
|
||||
FileWrite $0 " $7TrimNewLines} '$$R9' $$R9$\r$\n"
|
||||
FileWrite $0 " StrCpy $$R9 $$R9 '' 2 ;delete first two symbols$\r$\n"
|
||||
FileWrite $0 " StrCpy $$R9 '$$R9$$\$8$$\$9'$\r$\n$\r$\n"
|
||||
goto endwrite
|
||||
Example2LF:
|
||||
FileWrite $0 " $7TrimNewLines} '$$R9' $$R9$\r$\n"
|
||||
FileWrite $0 " StrCpy $$R9 '$$R9 ~Changed line ($$R8)~$$\$8$$\$9'$\r$\n$\r$\n"
|
||||
goto endwrite
|
||||
Example3LF:
|
||||
FileWrite $0 " StrCpy $$0 SkipWrite$\r$\n$\r$\n"
|
||||
goto endwrite
|
||||
Example4LF:
|
||||
FileWrite $0 " FileWrite $$R4 '---First Line---$$\$8$$\$9'$\r$\n"
|
||||
FileWrite $0 " FileWrite $$R4 '---Second Line ...---$$\$8$$\$9'$\r$\n$\r$\n"
|
||||
goto endwrite
|
||||
Example5LF:
|
||||
FileWrite $0 " ; You can use:$\r$\n"
|
||||
FileWrite $0 " ; $7WordFind}|$7WordFindS}|$7WordFind2X}|$7WordFind2XS}|$\r$\n"
|
||||
FileWrite $0 " ; $7WordFind3X}|$7WordFind3XS}|$7WordReplace}|$7WordReplaceS}|$\r$\n"
|
||||
FileWrite $0 " ; $7WordAdd}|$7WordAddS}|$7WordInsert}|$7WordInsertS}|$\r$\n"
|
||||
FileWrite $0 " ; $7StrFilter}|$7StrFilterS}$\r$\n$\r$\n"
|
||||
FileWrite $0 " $7WordReplace} '$$R9' ' ' '_' '+*' $$R9$\r$\n$\r$\n"
|
||||
goto endwrite
|
||||
Example6LF:
|
||||
FileWrite $0 ' ;(Cut lines from a line to another line (also including that line))$\r$\n'
|
||||
FileWrite $0 ' StrCmp $$R0 finish stop$\r$\n'
|
||||
FileWrite $0 ' StrCmp $$R0 start finish$\r$\n'
|
||||
FileWrite $0 ' StrCmp $$R9 "Start Line$$\$8$$\$9" 0 skip$\r$\n'
|
||||
FileWrite $0 ' StrCpy $$R0 start$\r$\n'
|
||||
FileWrite $0 ' StrCpy $$R1 $$R9$\r$\n'
|
||||
FileWrite $0 ' goto code$\r$\n'
|
||||
FileWrite $0 ' finish:$\r$\n'
|
||||
FileWrite $0 ' StrCmp $$R9 "Finish Line$$\$8$$\$9" 0 code$\r$\n'
|
||||
FileWrite $0 ' StrCpy $$R0 finish$\r$\n'
|
||||
FileWrite $0 ' StrCpy $$R2 $$R8$\r$\n'
|
||||
FileWrite $0 ' goto code$\r$\n'
|
||||
FileWrite $0 ' skip:$\r$\n'
|
||||
FileWrite $0 ' StrCpy $$0 SkipWrite$\r$\n'
|
||||
FileWrite $0 ' goto output$\r$\n'
|
||||
FileWrite $0 ' stop:$\r$\n'
|
||||
FileWrite $0 ' StrCpy $$0 StopLineFind$\r$\n'
|
||||
FileWrite $0 ' goto output$\r$\n$\r$\n'
|
||||
FileWrite $0 ' ;;(Delete lines from a line to another line (also including that line))$\r$\n'
|
||||
FileWrite $0 ' ; StrCmp $$R0 finish code$\r$\n'
|
||||
FileWrite $0 ' ; StrCmp $$R0 start finish$\r$\n'
|
||||
FileWrite $0 ' ; StrCmp $$R9 "Start Line$$\$8$$\$9" 0 code$\r$\n'
|
||||
FileWrite $0 ' ; StrCpy $$R0 start$\r$\n'
|
||||
FileWrite $0 ' ; StrCpy $$R1 $$R8$\r$\n'
|
||||
FileWrite $0 ' ; goto skip$\r$\n'
|
||||
FileWrite $0 ' ; finish:$\r$\n'
|
||||
FileWrite $0 ' ; StrCmp $$R9 "Finish Line$$\$8$$\$9" 0 skip$\r$\n'
|
||||
FileWrite $0 ' ; StrCpy $$R0 finish$\r$\n'
|
||||
FileWrite $0 ' ; StrCpy $$R2 $$R8$\r$\n'
|
||||
FileWrite $0 ' ; skip:$\r$\n'
|
||||
FileWrite $0 ' ; StrCpy $$0 SkipWrite$\r$\n'
|
||||
FileWrite $0 ' ; goto output$\r$\n$\r$\n'
|
||||
FileWrite $0 ' code:$\r$\n'
|
||||
FileWrite $0 ' ;...$\r$\n$\r$\n'
|
||||
FileWrite $0 ' output:$\r$\n'
|
||||
goto endwrite
|
||||
Example1TC:
|
||||
FileWrite $0 " StrCpy $$R0 NotEqual$\r$\n"
|
||||
FileWrite $0 " StrCpy $$0 StopTextCompare$\r$\n$\r$\n"
|
||||
goto endwrite
|
||||
Example2TC:
|
||||
FileWrite $0 " FileWrite $$R3 '$$8=$$9'$\r$\n"
|
||||
FileWrite $0 " FileWrite $$R3 '$$6=$$7$$\$8$$\$9'$\r$\n$\r$\n"
|
||||
goto endwrite
|
||||
Example3TC:
|
||||
FileWrite $0 " FileWrite $$R3 '$$8|$$6=$$9'$\r$\n$\r$\n"
|
||||
goto endwrite
|
||||
Example4TC:
|
||||
FileWrite $0 " FileWrite $$R3 '$$8=$$9'$\r$\n$\r$\n"
|
||||
goto endwrite
|
||||
endwrite:
|
||||
FileWrite $0 ' Push $$0$\r$\n'
|
||||
FileWrite $0 'FunctionEnd$\r$\n'
|
||||
close:
|
||||
FileClose $0
|
||||
goto $6
|
||||
#FunctionEnd#
|
||||
|
||||
showproject:
|
||||
StrCmp $R0 '1. LineFind' 0 +3
|
||||
ExecWait 'notepad.exe $CALLBACK'
|
||||
goto +4
|
||||
SetFileAttributes $PROJECT READONLY
|
||||
ExecWait 'notepad.exe $PROJECT'
|
||||
SetFileAttributes $PROJECT NORMAL
|
||||
Abort
|
||||
|
||||
MainSend:
|
||||
GetDlgItem $0 $HWND 1210
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:"
|
||||
GetDlgItem $0 $HWND 1203
|
||||
ShowWindow $0 1
|
||||
EnableWindow $0 1
|
||||
GetDlgItem $0 $HWND 1204
|
||||
ShowWindow $0 1
|
||||
EnableWindow $0 1
|
||||
GetDlgItem $0 $HWND 1205
|
||||
EnableWindow $0 1
|
||||
GetDlgItem $0 $HWND 1206
|
||||
ShowWindow $0 0
|
||||
GetDlgItem $0 $HWND 1207
|
||||
ShowWindow $0 0
|
||||
GetDlgItem $0 $HWND 1208
|
||||
ShowWindow $0 0
|
||||
GetDlgItem $0 $HWND 1209
|
||||
ShowWindow $0 0
|
||||
GetDlgItem $0 $HWND 1211
|
||||
EnableWindow $0 1
|
||||
|
||||
StrCmp $FUNCTION LineFind 0 +5
|
||||
StrCpy $LINEFIND1 $R1
|
||||
StrCpy $LINEFIND2 $R2
|
||||
StrCpy $LINEFIND3 $R3
|
||||
goto LineFindSend
|
||||
StrCmp $FUNCTION LineRead 0 +4
|
||||
StrCpy $LINEREAD1 $R1
|
||||
StrCpy $LINEREAD2 $R2
|
||||
goto LineFindSend
|
||||
StrCmp $FUNCTION FileReadFromEnd 0 +3
|
||||
StrCpy $FILEREADFROMEND1 $R1
|
||||
goto LineFindSend
|
||||
StrCmp $FUNCTION LineSum 0 +3
|
||||
StrCpy $LINESUM1 $R1
|
||||
goto LineFindSend
|
||||
StrCmp $FUNCTION FileJoin 0 +5
|
||||
StrCpy $FILEJOIN1 $R1
|
||||
StrCpy $FILEJOIN2 $R2
|
||||
StrCpy $FILEJOIN3 $R3
|
||||
goto LineFindSend
|
||||
StrCmp $FUNCTION TextCompare 0 +5
|
||||
StrCpy $TEXTCOMPARE1 $R1
|
||||
StrCpy $TEXTCOMPARE2 $R2
|
||||
StrCpy $TEXTCOMPARE3 $R3
|
||||
goto LineFindSend
|
||||
StrCmp $FUNCTION ConfigRead 0 +4
|
||||
StrCpy $CONFIGREAD1 $R1
|
||||
StrCpy $CONFIGREAD2 $R2
|
||||
goto LineFindSend
|
||||
StrCmp $FUNCTION ConfigWrite 0 +5
|
||||
StrCpy $CONFIGWRITE1 $R1
|
||||
StrCpy $CONFIGWRITE2 $R2
|
||||
StrCpy $CONFIGWRITE3 $R3
|
||||
goto LineFindSend
|
||||
StrCmp $FUNCTION FileRecode 0 +3
|
||||
StrCpy $FILERECODE1 $R1
|
||||
StrCpy $FILERECODE2 $R2
|
||||
|
||||
LineFindSend:
|
||||
StrCmp $R0 "1. LineFind" 0 LineReadSend
|
||||
StrCmp $FUNCTION LineFind 0 LineFindSend2
|
||||
StrCmp $R4 "Example1" 0 +3
|
||||
StrCpy $LINEFIND3 "3:-1"
|
||||
goto LineFindSend2
|
||||
StrCmp $R4 "Example2" 0 +3
|
||||
StrCpy $LINEFIND3 "{5:12 15 -6:-5 -1}"
|
||||
goto LineFindSend2
|
||||
StrCmp $R4 "Example3" 0 +3
|
||||
StrCpy $LINEFIND3 "2:3 10:-5 -3:-2"
|
||||
goto LineFindSend2
|
||||
StrCmp $R4 "Example4" 0 +3
|
||||
StrCpy $LINEFIND3 "10"
|
||||
goto LineFindSend2
|
||||
StrCmp $R4 "Example5" 0 +3
|
||||
StrCpy $LINEFIND3 "1:-1"
|
||||
goto LineFindSend2
|
||||
StrCmp $R4 "Example6" 0 +3
|
||||
StrCpy $LINEFIND3 ""
|
||||
goto LineFindSend2
|
||||
StrCmp $R4 "Example7" 0 +2
|
||||
StrCpy $LINEFIND3 "1:-1"
|
||||
|
||||
LineFindSend2:
|
||||
StrCpy $FUNCTION LineFind
|
||||
StrCmp $LINEFIND2 '/NUL' 0 +2
|
||||
StrCpy $LINEFIND2 ''
|
||||
GetDlgItem $0 $HWND 1201
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:$LINEFIND1"
|
||||
GetDlgItem $0 $HWND 1203
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:$LINEFIND2"
|
||||
GetDlgItem $0 $HWND 1205
|
||||
ShowWindow $0 1
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:$LINEFIND3"
|
||||
GetDlgItem $0 $HWND 1207
|
||||
ShowWindow $0 1
|
||||
GetDlgItem $0 $HWND 1211
|
||||
ShowWindow $0 1
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:Edit"
|
||||
GetDlgItem $0 $HWND 1212
|
||||
ShowWindow $0 1
|
||||
StrCmp $LOG '' +2
|
||||
EnableWindow $0 1
|
||||
GetDlgItem $0 $HWND 1213
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:InputFile"
|
||||
GetDlgItem $0 $HWND 1214
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:OutputFile"
|
||||
GetDlgItem $0 $HWND 1215
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:Range"
|
||||
GetDlgItem $0 $HWND 1216
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:Function"
|
||||
|
||||
StrCmp $R4 "Example7" 0 +9
|
||||
GetDlgItem $0 $HWND 1203
|
||||
EnableWindow $0 0
|
||||
SendMessage $0 ${WM_ENABLE} 1 0
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:/NUL"
|
||||
GetDlgItem $0 $HWND 1204
|
||||
EnableWindow $0 0
|
||||
GetDlgItem $0 $HWND 1211
|
||||
EnableWindow $0 0
|
||||
abort
|
||||
|
||||
|
||||
LineReadSend:
|
||||
StrCmp $R0 "2. LineRead" 0 FileReadFromEndSend
|
||||
StrCpy $FUNCTION LineRead
|
||||
GetDlgItem $0 $HWND 1201
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:$LINEREAD1"
|
||||
GetDlgItem $0 $HWND 1203
|
||||
ShowWindow $0 1
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:$LINEREAD2"
|
||||
GetDlgItem $0 $HWND 1204
|
||||
ShowWindow $0 0
|
||||
GetDlgItem $0 $HWND 1205
|
||||
ShowWindow $0 0
|
||||
GetDlgItem $0 $HWND 1211
|
||||
ShowWindow $0 0
|
||||
GetDlgItem $0 $HWND 1212
|
||||
ShowWindow $0 0
|
||||
GetDlgItem $0 $HWND 1213
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:InputFile"
|
||||
GetDlgItem $0 $HWND 1214
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:Line #"
|
||||
GetDlgItem $0 $HWND 1215
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:"
|
||||
GetDlgItem $0 $HWND 1216
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:"
|
||||
Abort
|
||||
|
||||
FileReadFromEndSend:
|
||||
StrCmp $R0 "3. FileReadFromEnd" 0 LineSumSend
|
||||
StrCpy $FUNCTION FileReadFromEnd
|
||||
GetDlgItem $0 $HWND 1201
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:$FILEREADFROMEND1"
|
||||
GetDlgItem $0 $HWND 1203
|
||||
ShowWindow $0 0
|
||||
GetDlgItem $0 $HWND 1204
|
||||
ShowWindow $0 0
|
||||
GetDlgItem $0 $HWND 1205
|
||||
ShowWindow $0 0
|
||||
GetDlgItem $0 $HWND 1209
|
||||
ShowWindow $0 1
|
||||
GetDlgItem $0 $HWND 1211
|
||||
ShowWindow $0 1
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:View"
|
||||
GetDlgItem $0 $HWND 1212
|
||||
ShowWindow $0 0
|
||||
GetDlgItem $0 $HWND 1213
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:InputFile"
|
||||
GetDlgItem $0 $HWND 1214
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:"
|
||||
GetDlgItem $0 $HWND 1215
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:"
|
||||
GetDlgItem $0 $HWND 1216
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:Function"
|
||||
Abort
|
||||
|
||||
LineSumSend:
|
||||
StrCmp $R0 "4. LineSum" 0 FileJoinSend
|
||||
StrCpy $FUNCTION LineSum
|
||||
GetDlgItem $0 $HWND 1201
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:$LINESUM1"
|
||||
GetDlgItem $0 $HWND 1203
|
||||
ShowWindow $0 0
|
||||
GetDlgItem $0 $HWND 1204
|
||||
ShowWindow $0 0
|
||||
GetDlgItem $0 $HWND 1205
|
||||
ShowWindow $0 0
|
||||
GetDlgItem $0 $HWND 1211
|
||||
ShowWindow $0 0
|
||||
GetDlgItem $0 $HWND 1212
|
||||
ShowWindow $0 0
|
||||
GetDlgItem $0 $HWND 1213
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:InputFile"
|
||||
GetDlgItem $0 $HWND 1214
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:"
|
||||
GetDlgItem $0 $HWND 1215
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:"
|
||||
GetDlgItem $0 $HWND 1216
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:"
|
||||
Abort
|
||||
|
||||
FileJoinSend:
|
||||
StrCmp $R0 "5. FileJoin" 0 TextCompareSend
|
||||
StrCpy $FUNCTION FileJoin
|
||||
GetDlgItem $0 $HWND 1201
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:$FILEJOIN1"
|
||||
GetDlgItem $0 $HWND 1203
|
||||
ShowWindow $0 1
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:$FILEJOIN2"
|
||||
GetDlgItem $0 $HWND 1204
|
||||
ShowWindow $0 1
|
||||
GetDlgItem $0 $HWND 1205
|
||||
ShowWindow $0 1
|
||||
EnableWindow $0 1
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:$FILEJOIN3"
|
||||
GetDlgItem $0 $HWND 1206
|
||||
ShowWindow $0 1
|
||||
GetDlgItem $0 $HWND 1211
|
||||
ShowWindow $0 0
|
||||
GetDlgItem $0 $HWND 1212
|
||||
ShowWindow $0 0
|
||||
GetDlgItem $0 $HWND 1213
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:InputFile1"
|
||||
GetDlgItem $0 $HWND 1214
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:InputFile2"
|
||||
GetDlgItem $0 $HWND 1215
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:OutputFile"
|
||||
GetDlgItem $0 $HWND 1216
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:"
|
||||
Abort
|
||||
|
||||
TextCompareSend:
|
||||
StrCmp $R0 "6. TextCompare" 0 ConfigReadSend
|
||||
StrCmp $FUNCTION TextCompare 0 TextCompareSend2
|
||||
StrCmp $R5 "Example1" 0 +3
|
||||
StrCpy $TEXTCOMPARE3 "FastDiff"
|
||||
goto TextCompareSend2
|
||||
StrCmp $R5 "Example2" 0 +3
|
||||
StrCpy $TEXTCOMPARE3 "FastDiff"
|
||||
goto TextCompareSend2
|
||||
StrCmp $R5 "Example3" 0 +3
|
||||
StrCpy $TEXTCOMPARE3 "FastEqual"
|
||||
goto TextCompareSend2
|
||||
StrCmp $R5 "Example4" 0 +3
|
||||
StrCpy $TEXTCOMPARE3 "SlowDiff"
|
||||
goto TextCompareSend2
|
||||
StrCmp $R5 "Example5" 0 +2
|
||||
StrCpy $TEXTCOMPARE3 "SlowEqual"
|
||||
|
||||
TextCompareSend2:
|
||||
StrCpy $FUNCTION TextCompare
|
||||
GetDlgItem $0 $HWND 1201
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:$TEXTCOMPARE1"
|
||||
GetDlgItem $0 $HWND 1203
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:$TEXTCOMPARE2"
|
||||
GetDlgItem $0 $HWND 1204
|
||||
ShowWindow $0 1
|
||||
GetDlgItem $0 $HWND 1205
|
||||
ShowWindow $0 1
|
||||
EnableWindow $0 0
|
||||
SendMessage $0 ${WM_ENABLE} 1 0
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:$TEXTCOMPARE3"
|
||||
GetDlgItem $0 $HWND 1208
|
||||
ShowWindow $0 1
|
||||
GetDlgItem $0 $HWND 1211
|
||||
ShowWindow $0 1
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:View"
|
||||
GetDlgItem $0 $HWND 1212
|
||||
ShowWindow $0 1
|
||||
GetDlgItem $0 $HWND 1213
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:TextFile1"
|
||||
GetDlgItem $0 $HWND 1214
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:TextFile2"
|
||||
GetDlgItem $0 $HWND 1215
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:Option"
|
||||
GetDlgItem $0 $HWND 1216
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:Function"
|
||||
abort
|
||||
|
||||
ConfigReadSend:
|
||||
StrCmp $R0 "7. ConfigRead" 0 ConfigWriteSend
|
||||
StrCpy $FUNCTION ConfigRead
|
||||
GetDlgItem $0 $HWND 1201
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:$CONFIGREAD1"
|
||||
GetDlgItem $0 $HWND 1203
|
||||
ShowWindow $0 1
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:$CONFIGREAD2"
|
||||
GetDlgItem $0 $HWND 1204
|
||||
ShowWindow $0 0
|
||||
GetDlgItem $0 $HWND 1205
|
||||
ShowWindow $0 0
|
||||
GetDlgItem $0 $HWND 1211
|
||||
ShowWindow $0 0
|
||||
GetDlgItem $0 $HWND 1212
|
||||
ShowWindow $0 0
|
||||
GetDlgItem $0 $HWND 1213
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:InputFile"
|
||||
GetDlgItem $0 $HWND 1214
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:Entry"
|
||||
GetDlgItem $0 $HWND 1215
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:"
|
||||
GetDlgItem $0 $HWND 1216
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:"
|
||||
Abort
|
||||
|
||||
ConfigWriteSend:
|
||||
StrCmp $R0 "8. ConfigWrite" 0 FileRecodeSend
|
||||
StrCpy $FUNCTION ConfigWrite
|
||||
GetDlgItem $0 $HWND 1201
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:$CONFIGWRITE1"
|
||||
GetDlgItem $0 $HWND 1203
|
||||
ShowWindow $0 1
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:$CONFIGWRITE2"
|
||||
GetDlgItem $0 $HWND 1204
|
||||
ShowWindow $0 0
|
||||
GetDlgItem $0 $HWND 1205
|
||||
ShowWindow $0 1
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:$CONFIGWRITE3"
|
||||
GetDlgItem $0 $HWND 1211
|
||||
ShowWindow $0 0
|
||||
GetDlgItem $0 $HWND 1212
|
||||
ShowWindow $0 0
|
||||
GetDlgItem $0 $HWND 1213
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:InputFile"
|
||||
GetDlgItem $0 $HWND 1214
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:Entry"
|
||||
GetDlgItem $0 $HWND 1215
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:Value"
|
||||
GetDlgItem $0 $HWND 1216
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:"
|
||||
Abort
|
||||
|
||||
FileRecodeSend:
|
||||
StrCmp $R0 "9. FileRecode" 0 Abort
|
||||
StrCpy $FUNCTION FileRecode
|
||||
GetDlgItem $0 $HWND 1201
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:$FILERECODE1"
|
||||
GetDlgItem $0 $HWND 1203
|
||||
ShowWindow $0 1
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:$FILERECODE2"
|
||||
GetDlgItem $0 $HWND 1204
|
||||
ShowWindow $0 0
|
||||
GetDlgItem $0 $HWND 1205
|
||||
ShowWindow $0 0
|
||||
GetDlgItem $0 $HWND 1211
|
||||
ShowWindow $0 0
|
||||
GetDlgItem $0 $HWND 1212
|
||||
ShowWindow $0 0
|
||||
GetDlgItem $0 $HWND 1213
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:InputFile"
|
||||
GetDlgItem $0 $HWND 1214
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:Format"
|
||||
GetDlgItem $0 $HWND 1215
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:"
|
||||
GetDlgItem $0 $HWND 1216
|
||||
SendMessage $0 ${WM_SETTEXT} 1 "STR:"
|
||||
Abort
|
||||
|
||||
;=Enter=
|
||||
Enter:
|
||||
StrCmp $R1 '' 0 +3
|
||||
StrCpy $0 'Choose InputFile'
|
||||
goto send
|
||||
IfFileExists $R1 +3
|
||||
StrCpy $0 'InputFile is not exist'
|
||||
goto send
|
||||
|
||||
StrCmp $R0 "1. LineFind" LineFindRead
|
||||
StrCmp $R0 "2. LineRead" LineRead
|
||||
StrCmp $R0 "3. FileReadFromEnd" FileReadFromEnd
|
||||
StrCmp $R0 "4. LineSum" LineSum
|
||||
StrCmp $R0 "5. FileJoin" FileJoin
|
||||
StrCmp $R0 "6. TextCompare" LineFind-TextCompare
|
||||
StrCmp $R0 "7. ConfigRead" ConfigRead
|
||||
StrCmp $R0 "8. ConfigWrite" ConfigWrite
|
||||
StrCmp $R0 "9. FileRecode" FileRecode
|
||||
Abort
|
||||
|
||||
LineFindRead:
|
||||
StrCmp $R4 "Example7" 0 LineFind-TextCompare
|
||||
${LineFind} '$R1' '/NUL' '$R3' LineFindCallback
|
||||
IfErrors error
|
||||
StrCmp $R0 StopLineFind 0 done
|
||||
StrCpy $0 'stopped'
|
||||
goto send
|
||||
|
||||
LineFind-TextCompare:
|
||||
GetLabelAddress $6 LineFindBack
|
||||
goto Edit
|
||||
LineFindBack:
|
||||
FileClose $0
|
||||
StrCmp $R0 "6. TextCompare" Compile
|
||||
StrCmp $CALLBACK '' Compile
|
||||
${FileJoin} "$PROJECT" "$CALLBACK" ""
|
||||
|
||||
Compile:
|
||||
StrCmp $LOG '' 0 +4
|
||||
GetTempFileName $LOG $PLUGINSDIR
|
||||
GetDlgItem $0 $HWND 1212
|
||||
EnableWindow $0 1
|
||||
ReadRegStr $0 HKLM "SOFTWARE\NSIS" ""
|
||||
IfErrors 0 +2
|
||||
StrCpy $0 "${NSISDIR}"
|
||||
nsExec::Exec '"$0\makensis.exe" /O$LOG $PROJECT'
|
||||
Pop $0
|
||||
StrCmp $0 0 0 +6
|
||||
ExecWait '$PROJECT.exe' $0
|
||||
Delete $PROJECT
|
||||
Delete $PROJECT.exe
|
||||
StrCpy $PROJECT ''
|
||||
goto done
|
||||
MessageBox MB_YESNO|MB_ICONEXCLAMATION "Compile error. Open log?" IDNO +2
|
||||
Exec 'notepad.exe $LOG'
|
||||
StrCpy $0 "Compile Error"
|
||||
goto send
|
||||
|
||||
LineRead:
|
||||
${LineRead} "$R1" "$R2" $0
|
||||
IfErrors error send
|
||||
|
||||
FileReadFromEnd:
|
||||
${FileReadFromEnd} "$R1" "FileReadFromEndCallback"
|
||||
IfErrors error
|
||||
StrCmp $R0 StopFileReadFromEnd 0 done
|
||||
StrCpy $0 'stopped'
|
||||
goto send
|
||||
|
||||
LineSum:
|
||||
${LineSum} "$R1" $0
|
||||
IfErrors error send
|
||||
|
||||
FileJoin:
|
||||
${FileJoin} "$R1" "$R2" "$R3"
|
||||
IfErrors error
|
||||
MessageBox MB_YESNO " Open output file?" IDNO done
|
||||
StrCmp $R3 '' 0 +3
|
||||
Exec '"notepad.exe" "$R1"'
|
||||
goto done
|
||||
Exec '"notepad.exe" "$R3"'
|
||||
goto done
|
||||
|
||||
ConfigRead:
|
||||
${ConfigRead} "$R1" "$R2" $0
|
||||
IfErrors error send
|
||||
|
||||
ConfigWrite:
|
||||
${ConfigWrite} "$R1" "$R2" "$R3" $0
|
||||
IfErrors error
|
||||
MessageBox MB_YESNO " Open output file?" IDNO send
|
||||
Exec '"notepad.exe" "$R1"'
|
||||
goto send
|
||||
|
||||
FileRecode:
|
||||
${FileRecode} "$R1" "$R2"
|
||||
IfErrors error
|
||||
MessageBox MB_YESNO " Open output file?" IDNO done
|
||||
Exec '"notepad.exe" "$R1"'
|
||||
goto done
|
||||
|
||||
error:
|
||||
StrCpy $0 'error'
|
||||
goto send
|
||||
|
||||
done:
|
||||
StrCpy $0 'Done'
|
||||
|
||||
send:
|
||||
GetDlgItem $1 $HWND 1210
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:$0"
|
||||
|
||||
abort:
|
||||
Abort
|
||||
FunctionEnd
|
||||
|
||||
Function LineFindCallback
|
||||
MessageBox MB_OKCANCEL '$$R9 "Line"=[$R9]$\n$$R8 "#"=[$R8]$\n$$R7 "-#"=[$R7]$\n$$R6 "Range"=[$R6]$\n$$R5 "Read"=[$R5]$\n$$R4 "Write"=[$R4]' IDOK +2
|
||||
StrCpy $R0 StopLineFind
|
||||
|
||||
Push $R0
|
||||
FunctionEnd
|
||||
|
||||
Function FileReadFromEndCallback
|
||||
MessageBox MB_OKCANCEL '$$9 "Line"=[$9]$\n$$8 "#"=[$8]$\n$$7 "-#"=[$7]' IDOK +2
|
||||
StrCpy $R0 StopFileReadFromEnd
|
||||
|
||||
Push $R0
|
||||
FunctionEnd
|
||||
|
||||
Function .onInit
|
||||
InitPluginsDir
|
||||
GetTempFileName $INI $PLUGINSDIR
|
||||
File /oname=$INI "TextFunc.ini"
|
||||
FunctionEnd
|
||||
|
||||
Page instfiles
|
||||
|
||||
Section -Empty
|
||||
SectionEnd
|
414
KattekerCreator/nsis/Examples/TextFuncTest.nsi
Normal file
414
KattekerCreator/nsis/Examples/TextFuncTest.nsi
Normal file
@ -0,0 +1,414 @@
|
||||
;_____________________________________________________________________________
|
||||
;
|
||||
; Text Functions Test
|
||||
;_____________________________________________________________________________
|
||||
;
|
||||
; 2006 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)
|
||||
|
||||
Name "Text Functions Test"
|
||||
OutFile "TextFuncTest.exe"
|
||||
Caption "$(^Name)"
|
||||
ShowInstDetails show
|
||||
XPStyle on
|
||||
RequestExecutionLevel user
|
||||
|
||||
Var FUNCTION
|
||||
Var TEMPFILE1
|
||||
Var TEMPFILE2
|
||||
Var TEMPFILE3
|
||||
Var HANDLE
|
||||
Var OUT
|
||||
|
||||
!include "TextFunc.nsh"
|
||||
|
||||
;############### INSTALL ###############
|
||||
|
||||
!define StackVerificationStart `!insertmacro StackVerificationStart`
|
||||
!macro StackVerificationStart _FUNCTION
|
||||
StrCpy $FUNCTION ${_FUNCTION}
|
||||
Call StackVerificationStart
|
||||
!macroend
|
||||
|
||||
!define StackVerificationEnd `!insertmacro StackVerificationEnd`
|
||||
!macro StackVerificationEnd
|
||||
Call StackVerificationEnd
|
||||
!macroend
|
||||
|
||||
Function StackVerificationStart
|
||||
StrCpy $0 !0
|
||||
StrCpy $1 !1
|
||||
StrCpy $2 !2
|
||||
StrCpy $3 !3
|
||||
StrCpy $4 !4
|
||||
StrCpy $5 !5
|
||||
StrCpy $6 !6
|
||||
StrCpy $7 !7
|
||||
StrCpy $8 !8
|
||||
StrCpy $9 !9
|
||||
StrCpy $R0 !R0
|
||||
StrCpy $R1 !R1
|
||||
StrCpy $R2 !R2
|
||||
StrCpy $R3 !R3
|
||||
StrCpy $R4 !R4
|
||||
StrCpy $R5 !R5
|
||||
StrCpy $R6 !R6
|
||||
StrCpy $R7 !R7
|
||||
StrCpy $R8 !R8
|
||||
StrCpy $R9 !R9
|
||||
FunctionEnd
|
||||
|
||||
Function StackVerificationEnd
|
||||
IfErrors +3
|
||||
DetailPrint 'PASSED $FUNCTION no errors'
|
||||
goto +2
|
||||
DetailPrint 'FAILED $FUNCTION error'
|
||||
|
||||
StrCmp $0 '!0' 0 error
|
||||
StrCmp $1 '!1' 0 error
|
||||
StrCmp $2 '!2' 0 error
|
||||
StrCmp $3 '!3' 0 error
|
||||
StrCmp $4 '!4' 0 error
|
||||
StrCmp $5 '!5' 0 error
|
||||
StrCmp $6 '!6' 0 error
|
||||
StrCmp $7 '!7' 0 error
|
||||
StrCmp $8 '!8' 0 error
|
||||
StrCmp $9 '!9' 0 error
|
||||
StrCmp $R0 '!R0' 0 error
|
||||
StrCmp $R1 '!R1' 0 error
|
||||
StrCmp $R2 '!R2' 0 error
|
||||
StrCmp $R3 '!R3' 0 error
|
||||
StrCmp $R4 '!R4' 0 error
|
||||
StrCmp $R5 '!R5' 0 error
|
||||
StrCmp $R6 '!R6' 0 error
|
||||
StrCmp $R7 '!R7' 0 error
|
||||
StrCmp $R8 '!R8' 0 error
|
||||
StrCmp $R9 '!R9' 0 error
|
||||
DetailPrint 'PASSED $FUNCTION stack'
|
||||
goto end
|
||||
|
||||
error:
|
||||
DetailPrint 'FAILED $FUNCTION stack'
|
||||
; MessageBox MB_OKCANCEL '$$0={$0}$\n$$1={$1}$\n$$2={$2}$\n$$3={$3}$\n$$4={$4}$\n$$5={$5}$\n$$6={$6}$\n$$7={$7}$\n$$8={$8}$\n$$9={$9}$\n$$R0={$R0}$\n$$R1={$R1}$\n$$R2={$R2}$\n$$R3={$R3}$\n$$R4={$R4}$\n$$R5={$R5}$\n$$R6={$R6}$\n$$R7={$R7}$\n$$R8={$R8}$\n$$R9={$R9}' IDOK +2
|
||||
; quit
|
||||
|
||||
end:
|
||||
FunctionEnd
|
||||
|
||||
|
||||
|
||||
Section CreateTestFile
|
||||
GetTempFileName $TEMPFILE1
|
||||
FileOpen $HANDLE $TEMPFILE1 w
|
||||
FileWrite $HANDLE '1A=a$\r$\n'
|
||||
FileWrite $HANDLE '2B=b$\r$\n'
|
||||
FileWrite $HANDLE '3C=c$\r$\n'
|
||||
FileWrite $HANDLE '4D=d$\r$\n'
|
||||
FileWrite $HANDLE '5E=e$\r$\n'
|
||||
FileClose $HANDLE
|
||||
GetTempFileName $TEMPFILE2
|
||||
GetTempFileName $TEMPFILE3
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section LineFind
|
||||
${StackVerificationStart} LineFind
|
||||
|
||||
${LineFind} '$TEMPFILE1' '/NUL' '1:-4 3 -1' 'LineFindCallback1'
|
||||
IfErrors error
|
||||
StrCmp $OUT '|1:2|-5|1|1A=a$\r$\n|1:2|-4|2|2B=b$\r$\n|3:3|-3|3|3C=c$\r$\n' 0 error
|
||||
|
||||
StrCpy $OUT ''
|
||||
SetDetailsPrint none
|
||||
${LineFind} '$TEMPFILE1' '$TEMPFILE2' '1:-1' 'LineFindCallback2'
|
||||
SetDetailsPrint both
|
||||
IfErrors error
|
||||
StrCmp $OUT '|1:-1||1|1A=a$\r$\n|1:-1||2|4D=d$\r$\n|1:-1||3|3C=c$\r$\n|1:-1||4|2B=B$\r$\n|1:-1||5|5E=e$\r$\n' 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
Function LineFindCallback1
|
||||
StrCpy $OUT '$OUT|$R6|$R7|$R8|$R9'
|
||||
StrCmp $R8 3 0 +2
|
||||
StrCpy $0 StopLineFind
|
||||
|
||||
Push $0
|
||||
FunctionEnd
|
||||
|
||||
Function LineFindCallback2
|
||||
StrCmp $R8 2 0 +2
|
||||
StrCpy $R9 '4D=d$\r$\n'
|
||||
StrCmp $R8 4 0 +2
|
||||
StrCpy $R9 '2B=B$\r$\n'
|
||||
|
||||
StrCpy $OUT '$OUT|$R6|$R7|$R8|$R9'
|
||||
|
||||
Push $0
|
||||
FunctionEnd
|
||||
|
||||
|
||||
Section LineRead
|
||||
${StackVerificationStart} LineRead
|
||||
|
||||
${LineRead} '$TEMPFILE1' '-1' $OUT
|
||||
IfErrors error
|
||||
StrCmp $OUT '5E=e$\r$\n' 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section FileReadFromEnd
|
||||
${StackVerificationStart} FileReadFromEnd
|
||||
|
||||
StrCpy $OUT ''
|
||||
${FileReadFromEnd} '$TEMPFILE1' 'FileReadFromEndCallback'
|
||||
IfErrors error
|
||||
StrCmp $OUT '|-1|5|5E=e$\r$\n|-2|4|4D=d$\r$\n|-3|3|3C=c$\r$\n|-4|2|2B=b$\r$\n' 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
Function FileReadFromEndCallback
|
||||
StrCpy $OUT '$OUT|$7|$8|$9'
|
||||
StrCmp $8 2 0 +2
|
||||
StrCpy $0 StopFileReadFromEnd
|
||||
|
||||
Push $0
|
||||
FunctionEnd
|
||||
|
||||
|
||||
Section LineSum
|
||||
${StackVerificationStart} LineSum
|
||||
|
||||
${LineSum} '$TEMPFILE1' $OUT
|
||||
IfErrors error
|
||||
StrCmp $OUT '5' 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section FileJoin
|
||||
${StackVerificationStart} FileJoin
|
||||
|
||||
SetDetailsPrint none
|
||||
${FileJoin} '$TEMPFILE1' '$TEMPFILE2' '$TEMPFILE3'
|
||||
SetDetailsPrint both
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section TextCompare
|
||||
${StackVerificationStart} TextCompare
|
||||
|
||||
StrCpy $OUT ''
|
||||
${TextCompare} '$TEMPFILE1' '$TEMPFILE2' 'FastDiff' 'TextCompareCallback'
|
||||
StrCmp $OUT '|2|4D=d$\r$\n|2|2B=b$\r$\n|4|2B=B$\r$\n|4|4D=d$\r$\n' 0 error
|
||||
|
||||
StrCpy $OUT ''
|
||||
${TextCompare} '$TEMPFILE1' '$TEMPFILE2' 'FastEqual' 'TextCompareCallback'
|
||||
StrCmp $OUT '|1|1A=a$\r$\n|1|1A=a$\r$\n|3|3C=c$\r$\n|3|3C=c$\r$\n|5|5E=e$\r$\n|5|5E=e$\r$\n' 0 error
|
||||
|
||||
StrCpy $OUT ''
|
||||
${TextCompare} '$TEMPFILE1' '$TEMPFILE2' 'SlowDiff' 'TextCompareCallback'
|
||||
StrCmp $OUT '' 0 error
|
||||
|
||||
StrCpy $OUT ''
|
||||
${TextCompare} '$TEMPFILE1' '$TEMPFILE2' 'SlowEqual' 'TextCompareCallback'
|
||||
StrCmp $OUT '|1|1A=a$\r$\n|1|1A=a$\r$\n|4|2B=B$\r$\n|2|2B=b$\r$\n|3|3C=c$\r$\n|3|3C=c$\r$\n|2|4D=d$\r$\n|4|4D=d$\r$\n|5|5E=e$\r$\n|5|5E=e$\r$\n' 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
Section TextCompareS
|
||||
${StackVerificationStart} TextCompareS
|
||||
|
||||
StrCpy $OUT ''
|
||||
${TextCompareS} '$TEMPFILE1' '$TEMPFILE2' 'SlowDiff' 'TextCompareCallback'
|
||||
StrCmp $OUT '|||2|2B=b$\r$\n' 0 error
|
||||
|
||||
StrCpy $OUT ''
|
||||
${TextCompareS} '$TEMPFILE1' '$TEMPFILE2' 'SlowEqual' 'TextCompareCallback'
|
||||
StrCmp $OUT '|1|1A=a$\r$\n|1|1A=a$\r$\n|3|3C=c$\r$\n|3|3C=c$\r$\n|2|4D=d$\r$\n|4|4D=d$\r$\n|5|5E=e$\r$\n|5|5E=e$\r$\n' 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
Function TextCompareCallback
|
||||
StrCpy $OUT '$OUT|$6|$7|$8|$9'
|
||||
|
||||
Push $0
|
||||
FunctionEnd
|
||||
|
||||
|
||||
Section ConfigRead
|
||||
${StackVerificationStart} ConfigRead
|
||||
|
||||
${ConfigRead} '$TEMPFILE1' '3c=' $OUT
|
||||
StrCmp $OUT 'c' 0 error
|
||||
|
||||
${ConfigRead} '$TEMPFILE1' '6F=' $OUT
|
||||
StrCmp $OUT '' 0 error
|
||||
|
||||
${ConfigRead} '$TEMPFILE1' 'FF=' $OUT
|
||||
IfErrors 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section ConfigReadS
|
||||
${StackVerificationStart} ConfigReadS
|
||||
|
||||
${ConfigReadS} '$TEMPFILE1' '3C=' $OUT
|
||||
StrCmp $OUT 'c' 0 error
|
||||
|
||||
${ConfigReadS} '$TEMPFILE1' '3c=' $OUT
|
||||
IfErrors 0 error
|
||||
StrCmp $OUT '' 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section ConfigWrite
|
||||
${StackVerificationStart} ConfigWrite
|
||||
|
||||
${ConfigWrite} '$TEMPFILE1' '5E=' 'e**' $OUT
|
||||
StrCmp $OUT 'CHANGED' 0 error
|
||||
|
||||
${ConfigWrite} '$TEMPFILE1' '2B=' '' $OUT
|
||||
StrCmp $OUT 'DELETED' 0 error
|
||||
|
||||
${ConfigWrite} '$TEMPFILE1' '3c=' 'c' $OUT
|
||||
StrCmp $OUT 'SAME' 0 error
|
||||
|
||||
${ConfigWrite} '$TEMPFILE1' '6F=' '*' $OUT
|
||||
StrCmp $OUT 'ADDED' 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section ConfigWriteS
|
||||
${StackVerificationStart} ConfigWriteS
|
||||
|
||||
${ConfigWriteS} '$TEMPFILE1' '5e=' 'e**' $OUT
|
||||
StrCmp $OUT 'ADDED' 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section FileRecode
|
||||
${StackVerificationStart} FileRecode
|
||||
|
||||
${FileRecode} '$TEMPFILE1' 'CharToOem'
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section TrimNewLines
|
||||
${StackVerificationStart} TrimNewLines
|
||||
|
||||
${TrimNewLines} 'Text Line$\r$\n' $OUT
|
||||
StrCmp $OUT 'Text Line' 0 error
|
||||
|
||||
${TrimNewLines} 'Text Line' $OUT
|
||||
StrCmp $OUT 'Text Line' 0 error
|
||||
|
||||
${TrimNewLines} 'Text Line$\n' $OUT
|
||||
StrCmp $OUT 'Text Line' 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section WriteUninstaller
|
||||
SetDetailsPrint none
|
||||
Delete $TEMPFILE1
|
||||
Delete $TEMPFILE2
|
||||
Delete $TEMPFILE3
|
||||
SetDetailsPrint both
|
||||
goto +2
|
||||
WriteUninstaller '$EXEDIR\un.TextFuncTest.exe'
|
||||
SectionEnd
|
||||
|
||||
|
||||
|
||||
;############### UNINSTALL ###############
|
||||
|
||||
Section un.Uninstall
|
||||
${LineFind} '$TEMPFILE1' '/NUL' '1:-1' 'un.LineFindCallback'
|
||||
${LineRead} '$TEMPFILE1' '-1' $OUT
|
||||
${FileReadFromEnd} '$TEMPFILE1' 'un.FileReadFromEndCallback'
|
||||
${LineSum} '$TEMPFILE1' $OUT
|
||||
${FileJoin} '$TEMPFILE1' '$TEMPFILE2' '$TEMPFILE3'
|
||||
${TextCompare} '$TEMPFILE1' '$TEMPFILE2' 'FastDiff' 'un.TextCompareCallback'
|
||||
${TextCompareS} '$TEMPFILE1' '$TEMPFILE2' 'FastDiff' 'un.TextCompareCallback'
|
||||
${ConfigRead} '$TEMPFILE1' '3c=' $OUT
|
||||
${ConfigReadS} '$TEMPFILE1' '3c=' $OUT
|
||||
${ConfigWrite} '$TEMPFILE1' '5E=' 'e**' $OUT
|
||||
${ConfigWriteS} '$TEMPFILE1' '5E=' 'e**' $OUT
|
||||
${FileRecode} '$TEMPFILE1' 'CharToOem'
|
||||
${TrimNewLines} 'Text Line$\r$\n' $OUT
|
||||
SectionEnd
|
||||
|
||||
Function un.LineFindCallback
|
||||
Push $0
|
||||
FunctionEnd
|
||||
|
||||
Function un.FileReadFromEndCallback
|
||||
Push $0
|
||||
FunctionEnd
|
||||
|
||||
Function un.TextCompareCallback
|
||||
Push $0
|
||||
FunctionEnd
|
44
KattekerCreator/nsis/Examples/UserInfo/UserInfo.nsi
Normal file
44
KattekerCreator/nsis/Examples/UserInfo/UserInfo.nsi
Normal file
@ -0,0 +1,44 @@
|
||||
Name "UserInfo.dll test"
|
||||
OutFile UserInfo.exe
|
||||
|
||||
!define REALMSG "$\nOriginal non-restricted account type: $2"
|
||||
|
||||
Section
|
||||
ClearErrors
|
||||
UserInfo::GetName
|
||||
IfErrors Win9x
|
||||
Pop $0
|
||||
UserInfo::GetAccountType
|
||||
Pop $1
|
||||
# GetOriginalAccountType will check the tokens of the original user of the
|
||||
# current thread/process. If the user tokens were elevated or limited for
|
||||
# this process, GetOriginalAccountType will return the non-restricted
|
||||
# account type.
|
||||
# On Vista with UAC, for example, this is not the same value when running
|
||||
# with `RequestExecutionLevel user`. GetOriginalAccountType will return
|
||||
# "admin" while GetAccountType will return "user".
|
||||
UserInfo::GetOriginalAccountType
|
||||
Pop $2
|
||||
StrCmp $1 "Admin" 0 +3
|
||||
MessageBox MB_OK 'User "$0" is in the Administrators group${REALMSG}'
|
||||
Goto done
|
||||
StrCmp $1 "Power" 0 +3
|
||||
MessageBox MB_OK 'User "$0" is in the Power Users group${REALMSG}'
|
||||
Goto done
|
||||
StrCmp $1 "User" 0 +3
|
||||
MessageBox MB_OK 'User "$0" is just a regular user${REALMSG}'
|
||||
Goto done
|
||||
StrCmp $1 "Guest" 0 +3
|
||||
MessageBox MB_OK 'User "$0" is a guest${REALMSG}'
|
||||
Goto done
|
||||
MessageBox MB_OK "Unknown error"
|
||||
Goto done
|
||||
|
||||
Win9x:
|
||||
# This one means you don't need to care about admin or
|
||||
# not admin because Windows 9x doesn't either
|
||||
MessageBox MB_OK "Error! This DLL can't run under Windows 9x!"
|
||||
|
||||
done:
|
||||
SectionEnd
|
||||
|
69
KattekerCreator/nsis/Examples/UserVars.nsi
Normal file
69
KattekerCreator/nsis/Examples/UserVars.nsi
Normal file
@ -0,0 +1,69 @@
|
||||
; UserVars.nsi
|
||||
;
|
||||
; This script shows you how to declare and user variables.
|
||||
|
||||
;--------------------------------
|
||||
|
||||
Name "User Variables Text"
|
||||
OutFile "UserVars.exe"
|
||||
|
||||
InstallDir "$PROGRAMFILES\User Variables Test"
|
||||
|
||||
RequestExecutionLevel admin
|
||||
|
||||
;--------------------------------
|
||||
|
||||
;Pages
|
||||
Page directory
|
||||
Page instfiles
|
||||
|
||||
UninstPage uninstConfirm
|
||||
UninstPage instfiles
|
||||
|
||||
;--------------------------------
|
||||
; Declaration of user variables (Var command), allowed charaters for variables names : [a-z][A-Z][0-9] and '_'
|
||||
|
||||
Var "Name"
|
||||
Var "Serial"
|
||||
Var "Info"
|
||||
|
||||
;--------------------------------
|
||||
; Installer
|
||||
|
||||
Section "Dummy Section" SecDummy
|
||||
|
||||
StrCpy $0 "Admin"
|
||||
StrCpy "$Name" $0
|
||||
StrCpy "$Serial" "12345"
|
||||
MessageBox MB_OK "User Name: $Name $\n$\nSerial Number: $Serial"
|
||||
|
||||
CreateDirectory $INSTDIR
|
||||
WriteUninstaller "$INSTDIR\Uninst.exe"
|
||||
|
||||
SectionEnd
|
||||
|
||||
Section "Another Section"
|
||||
|
||||
Var /GLOBAL "AnotherVar"
|
||||
|
||||
StrCpy $AnotherVar "test"
|
||||
|
||||
SectionEnd
|
||||
|
||||
;--------------------------------
|
||||
; Uninstaller
|
||||
|
||||
Section "Uninstall"
|
||||
|
||||
StrCpy $Info "User variables test uninstalled successfully."
|
||||
Delete "$INSTDIR\Uninst.exe"
|
||||
RmDir $INSTDIR
|
||||
|
||||
SectionEnd
|
||||
|
||||
Function un.OnUninstSuccess
|
||||
|
||||
HideWindow
|
||||
MessageBox MB_OK "$Info"
|
||||
|
||||
FunctionEnd
|
62
KattekerCreator/nsis/Examples/VPatch/example.nsi
Normal file
62
KattekerCreator/nsis/Examples/VPatch/example.nsi
Normal file
@ -0,0 +1,62 @@
|
||||
;VPatch example
|
||||
;Written by Joost Verburg
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; The name of the installer
|
||||
Name "VPatch Test"
|
||||
|
||||
; The file to write
|
||||
OutFile "vpatchtest.exe"
|
||||
|
||||
; The default installation directory
|
||||
InstallDir "$PROGRAMFILES\VPatch Test"
|
||||
|
||||
; The text to prompt the user to enter a directory
|
||||
DirText "Choose a folder in which to install the VPatch Test!"
|
||||
|
||||
; Show details
|
||||
ShowInstDetails show
|
||||
|
||||
;--------------------------------
|
||||
; The normal way to use VPatch
|
||||
;--------------------------------
|
||||
!include "VPatchLib.nsh"
|
||||
|
||||
Section "Update file"
|
||||
; Set output path to the installation directory
|
||||
SetOutPath $INSTDIR
|
||||
|
||||
; Extract the old file under name 'updatefile.txt'
|
||||
File /oname=updatefile.txt oldfile.txt
|
||||
|
||||
; Update the file - it will be replaced with the new version
|
||||
DetailPrint "Updating updatefile.txt using patch..."
|
||||
!insertmacro VPatchFile "patch.pat" "$INSTDIR\updatefile.txt" "$INSTDIR\temporaryfile.txt"
|
||||
|
||||
SectionEnd
|
||||
|
||||
;-------------------------------
|
||||
; The hard way to use VPatch
|
||||
;-------------------------------
|
||||
Section "New version in separate file"
|
||||
|
||||
; Set output path to the installation directory
|
||||
SetOutPath $INSTDIR
|
||||
|
||||
; Extract the old file
|
||||
File oldfile.txt
|
||||
|
||||
; Extract the patch to the plug-ins folder (temporary)
|
||||
InitPluginsDir
|
||||
File /oname=$PLUGINSDIR\patch.pat patch.pat
|
||||
|
||||
; Update the old file to the new file using the patch
|
||||
DetailPrint "Updating oldfile.txt using patch to newfile.txt..."
|
||||
vpatch::vpatchfile "$PLUGINSDIR\patch.pat" "$INSTDIR\oldfile.txt" "$INSTDIR\newfile.txt"
|
||||
|
||||
; Show result
|
||||
Pop $R0
|
||||
DetailPrint "Result: $R0"
|
||||
|
||||
SectionEnd
|
6
KattekerCreator/nsis/Examples/VPatch/newfile.txt
Normal file
6
KattekerCreator/nsis/Examples/VPatch/newfile.txt
Normal file
@ -0,0 +1,6 @@
|
||||
*** THIS IS A TEST FILE FOR THE VPATCH EXAMPLE ***
|
||||
*** COMPILE EXAMPLE.NSI TO TEST ***
|
||||
|
||||
newfile - vpatch
|
||||
|
||||
67890 - GHIJKL
|
6
KattekerCreator/nsis/Examples/VPatch/oldfile.txt
Normal file
6
KattekerCreator/nsis/Examples/VPatch/oldfile.txt
Normal file
@ -0,0 +1,6 @@
|
||||
*** THIS IS A TEST FILE FOR THE VPATCH EXAMPLE ***
|
||||
*** COMPILE EXAMPLE.NSI TO TEST ***
|
||||
|
||||
oldfile - vpatch
|
||||
|
||||
12345 - ABCDEF
|
BIN
KattekerCreator/nsis/Examples/VPatch/patch.pat
Normal file
BIN
KattekerCreator/nsis/Examples/VPatch/patch.pat
Normal file
Binary file not shown.
29
KattekerCreator/nsis/Examples/VersionInfo.nsi
Normal file
29
KattekerCreator/nsis/Examples/VersionInfo.nsi
Normal file
@ -0,0 +1,29 @@
|
||||
; VersionInfo.nsi
|
||||
;
|
||||
; This script shows you how to add version information to an installer.
|
||||
; Windows shows this information on the Version tab of the File properties.
|
||||
|
||||
;--------------------------------
|
||||
|
||||
Name "Version Info"
|
||||
|
||||
OutFile "VersionInfo.exe"
|
||||
|
||||
LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf"
|
||||
;--------------------------------
|
||||
;Version Information
|
||||
|
||||
VIProductVersion "1.2.3.4"
|
||||
VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "Test Application"
|
||||
VIAddVersionKey /LANG=${LANG_ENGLISH} "Comments" "A test comment"
|
||||
VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "Fake company"
|
||||
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalTrademarks" "Test Application is a trademark of Fake company"
|
||||
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "Copyright Fake company"
|
||||
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "Test Application"
|
||||
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "1.2.3"
|
||||
|
||||
;--------------------------------
|
||||
|
||||
Section ""
|
||||
|
||||
SectionEnd
|
107
KattekerCreator/nsis/Examples/WordFunc.ini
Normal file
107
KattekerCreator/nsis/Examples/WordFunc.ini
Normal file
@ -0,0 +1,107 @@
|
||||
[Settings]
|
||||
NumFields=13
|
||||
NextButtonText=&Enter
|
||||
|
||||
[Field 1]
|
||||
Type=Droplist
|
||||
Flags=NOTIFY
|
||||
State=1. WordFind (Find word by number)
|
||||
ListItems=1. WordFind (Find word by number)| (Delimiter exclude)| (Sum of words)| (Sum of delimiters)| (Find word number)| ( }} )| ( {} )| ( *} )|2. WordFind2X|3. WordReplace (Replace)| (Delete)| (Multiple-replace)|4. WordAdd (Add)| (Delete) |5. WordInsert|6. StrFilter (UpperCase)| (LowerCase)| (Filter)|7. VersionCompare|8. VersionConvert
|
||||
Left=44
|
||||
Right=190
|
||||
Top=10
|
||||
Bottom=191
|
||||
|
||||
[Field 2]
|
||||
Type=Text
|
||||
State=C:\io.sys|C:\logo.sys|C:\Program Files|C:\WINDOWS
|
||||
Left=44
|
||||
Right=-10
|
||||
Top=30
|
||||
Bottom=41
|
||||
|
||||
[Field 3]
|
||||
Type=Text
|
||||
State=|C:\
|
||||
Left=44
|
||||
Right=-10
|
||||
Top=46
|
||||
Bottom=59
|
||||
|
||||
[Field 4]
|
||||
Type=Text
|
||||
Flags=DISABLED
|
||||
Left=44
|
||||
Right=-10
|
||||
Top=62
|
||||
Bottom=75
|
||||
|
||||
[Field 5]
|
||||
Type=Text
|
||||
State=-4
|
||||
Left=44
|
||||
Right=-10
|
||||
Top=80
|
||||
Bottom=92
|
||||
|
||||
[Field 6]
|
||||
Type=Text
|
||||
Left=10
|
||||
Right=-30
|
||||
Top=108
|
||||
Bottom=120
|
||||
|
||||
[Field 7]
|
||||
Type=Text
|
||||
Left=-22
|
||||
Right=-10
|
||||
Top=108
|
||||
Bottom=120
|
||||
|
||||
[Field 8]
|
||||
Type=Label
|
||||
Text=String
|
||||
Left=10
|
||||
Right=43
|
||||
Top=32
|
||||
Bottom=44
|
||||
|
||||
[Field 9]
|
||||
Type=Label
|
||||
Text=Delimiter
|
||||
Left=10
|
||||
Right=43
|
||||
Top=48
|
||||
Bottom=60
|
||||
|
||||
[Field 10]
|
||||
Type=Label
|
||||
Left=10
|
||||
Right=44
|
||||
Top=65
|
||||
Bottom=76
|
||||
|
||||
[Field 11]
|
||||
Type=Label
|
||||
Text=Word #
|
||||
Left=10
|
||||
Right=43
|
||||
Top=81
|
||||
Bottom=94
|
||||
|
||||
[Field 12]
|
||||
Type=Label
|
||||
Text=Result (Word):
|
||||
Left=10
|
||||
Right=236
|
||||
Top=97
|
||||
Bottom=110
|
||||
|
||||
[Field 13]
|
||||
Type=Label
|
||||
Text=EL
|
||||
Left=-21
|
||||
Right=-10
|
||||
Top=97
|
||||
Bottom=110
|
||||
|
535
KattekerCreator/nsis/Examples/WordFunc.nsi
Normal file
535
KattekerCreator/nsis/Examples/WordFunc.nsi
Normal file
@ -0,0 +1,535 @@
|
||||
;_____________________________________________________________________________
|
||||
;
|
||||
; Word Functions
|
||||
;_____________________________________________________________________________
|
||||
;
|
||||
; 2005 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)
|
||||
|
||||
Name "Word Functions"
|
||||
OutFile "WordFunc.exe"
|
||||
Caption "$(^Name)"
|
||||
XPStyle on
|
||||
RequestExecutionLevel user
|
||||
|
||||
Var INI
|
||||
Var HWND
|
||||
Var STATE
|
||||
|
||||
!include "WinMessages.nsh"
|
||||
!include "WordFunc.nsh"
|
||||
|
||||
Page Custom ShowCustom LeaveCustom
|
||||
|
||||
Function ShowCustom
|
||||
InstallOptions::initDialog "$INI"
|
||||
Pop $hwnd
|
||||
InstallOptions::show
|
||||
Pop $0
|
||||
FunctionEnd
|
||||
|
||||
Function LeaveCustom
|
||||
ReadINIStr $0 $INI "Settings" "State"
|
||||
StrCmp $0 0 Enter
|
||||
|
||||
GetDlgItem $1 $HWND 1202
|
||||
EnableWindow $1 1
|
||||
GetDlgItem $1 $HWND 1203
|
||||
ShowWindow $1 1
|
||||
GetDlgItem $1 $HWND 1204
|
||||
ShowWindow $1 1
|
||||
GetDlgItem $1 $HWND 1206
|
||||
EnableWindow $1 1
|
||||
GetDlgItem $1 $HWND 1205
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:"
|
||||
GetDlgItem $1 $HWND 1206
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:"
|
||||
|
||||
ReadINIStr $0 $INI "Field 1" "State"
|
||||
StrCmp $0 "1. WordFind (Find word by number)" 0 WordFind2Send
|
||||
GetDlgItem $1 $HWND 1202
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:|C:\"
|
||||
GetDlgItem $1 $HWND 1204
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:-4"
|
||||
GetDlgItem $1 $HWND 1210
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Word #"
|
||||
GetDlgItem $1 $HWND 1211
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Result (Word):"
|
||||
goto WordFindSend
|
||||
|
||||
WordFind2Send:
|
||||
StrCmp $0 " (Delimiter exclude)" 0 WordFind3Send
|
||||
GetDlgItem $1 $HWND 1202
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:|C:\"
|
||||
GetDlgItem $1 $HWND 1204
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:E-2{"
|
||||
GetDlgItem $1 $HWND 1210
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Word #"
|
||||
GetDlgItem $1 $HWND 1211
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Result (Before{ or }after delimiter):"
|
||||
goto WordFindSend
|
||||
|
||||
WordFind3Send:
|
||||
StrCmp $0 " (Sum of words)" 0 WordFind4Send
|
||||
GetDlgItem $1 $HWND 1202
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:|C:\"
|
||||
GetDlgItem $1 $HWND 1204
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:#"
|
||||
GetDlgItem $1 $HWND 1210
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Option"
|
||||
GetDlgItem $1 $HWND 1211
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Result (Sum of words):"
|
||||
goto WordFindSend
|
||||
|
||||
WordFind4Send:
|
||||
StrCmp $0 " (Sum of delimiters)" 0 WordFind5Send
|
||||
GetDlgItem $1 $HWND 1202
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:|"
|
||||
GetDlgItem $1 $HWND 1204
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:E*"
|
||||
GetDlgItem $1 $HWND 1210
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Option"
|
||||
GetDlgItem $1 $HWND 1211
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Result (Sum of delimiters):"
|
||||
goto WordFindSend
|
||||
|
||||
WordFind5Send:
|
||||
StrCmp $0 " (Find word number)" 0 WordFind6Send
|
||||
GetDlgItem $1 $HWND 1202
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:|C:\"
|
||||
GetDlgItem $1 $HWND 1204
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:/Program Files"
|
||||
GetDlgItem $1 $HWND 1210
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:/Word"
|
||||
GetDlgItem $1 $HWND 1211
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Result (Word #):"
|
||||
goto WordFindSend
|
||||
|
||||
WordFind6Send:
|
||||
StrCmp $0 " ( }} )" 0 WordFind7Send
|
||||
GetDlgItem $1 $HWND 1202
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:|C:\"
|
||||
GetDlgItem $1 $HWND 1204
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:E+2}}"
|
||||
GetDlgItem $1 $HWND 1210
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Word #"
|
||||
GetDlgItem $1 $HWND 1211
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Result (Before{{ or }}after word):"
|
||||
goto WordFindSend
|
||||
|
||||
WordFind7Send:
|
||||
StrCmp $0 " ( {} )" 0 WordFind8Send
|
||||
GetDlgItem $1 $HWND 1202
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:|C:\"
|
||||
GetDlgItem $1 $HWND 1204
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:+2{}"
|
||||
GetDlgItem $1 $HWND 1210
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Word #"
|
||||
GetDlgItem $1 $HWND 1211
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Result (Without word):"
|
||||
goto WordFindSend
|
||||
|
||||
WordFind8Send:
|
||||
StrCmp $0 " ( *} )" 0 WordFind2XSend
|
||||
GetDlgItem $1 $HWND 1202
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:|C:\"
|
||||
GetDlgItem $1 $HWND 1204
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:E+2*}"
|
||||
GetDlgItem $1 $HWND 1210
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Word #"
|
||||
GetDlgItem $1 $HWND 1211
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Result (Before{* or *}after word with word):"
|
||||
goto WordFindSend
|
||||
|
||||
WordFind2XSend:
|
||||
StrCmp $0 "2. WordFind2X" 0 WordReplace1Send
|
||||
GetDlgItem $1 $HWND 1201
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:[C:\io.sys];[C:\logo.sys];[C:\WINDOWS]"
|
||||
GetDlgItem $1 $HWND 1202
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:[C:\"
|
||||
GetDlgItem $1 $HWND 1203
|
||||
EnableWindow $1 1
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:];"
|
||||
GetDlgItem $1 $HWND 1204
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:E+2"
|
||||
GetDlgItem $1 $HWND 1207
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:String"
|
||||
GetDlgItem $1 $HWND 1208
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Delimiter1"
|
||||
GetDlgItem $1 $HWND 1209
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Delimiter2"
|
||||
GetDlgItem $1 $HWND 1210
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Word #"
|
||||
GetDlgItem $1 $HWND 1211
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Result (Word):"
|
||||
abort
|
||||
|
||||
WordReplace1Send:
|
||||
StrCmp $0 "3. WordReplace (Replace)" 0 WordReplace2Send
|
||||
GetDlgItem $1 $HWND 1201
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:C:\io.sys|C:\logo.sys|C:\WINDOWS"
|
||||
GetDlgItem $1 $HWND 1202
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:SYS"
|
||||
GetDlgItem $1 $HWND 1203
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:bmp"
|
||||
GetDlgItem $1 $HWND 1204
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:+2"
|
||||
goto WordReplaceSend
|
||||
|
||||
WordReplace2Send:
|
||||
StrCmp $0 " (Delete)" 0 WordReplace3Send
|
||||
GetDlgItem $1 $HWND 1201
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:C:\io.sys|C:\logo.sys|C:\WINDOWS"
|
||||
GetDlgItem $1 $HWND 1202
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:SYS"
|
||||
GetDlgItem $1 $HWND 1203
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:"
|
||||
GetDlgItem $1 $HWND 1204
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:E+"
|
||||
goto WordReplaceSend
|
||||
|
||||
WordReplace3Send:
|
||||
StrCmp $0 " (Multiple-replace)" 0 WordAdd1Send
|
||||
GetDlgItem $1 $HWND 1201
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:C:\io.sys||||||C:\logo.sys|||C:\WINDOWS"
|
||||
GetDlgItem $1 $HWND 1202
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:|"
|
||||
GetDlgItem $1 $HWND 1203
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:|"
|
||||
GetDlgItem $1 $HWND 1204
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:+1*"
|
||||
goto WordReplaceSend
|
||||
|
||||
WordAdd1Send:
|
||||
StrCmp $0 "4. WordAdd (Add)" 0 WordAdd2Send
|
||||
GetDlgItem $1 $HWND 1204
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:+C:\WINDOWS|C:\config.sys|C:\IO.SYS"
|
||||
GetDlgItem $1 $HWND 1211
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Result (String1 + String2):"
|
||||
goto WordAddSend
|
||||
|
||||
WordAdd2Send:
|
||||
StrCmp $0 " (Delete) " 0 WordInsertSend
|
||||
GetDlgItem $1 $HWND 1204
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:E-C:\WINDOWS|C:\config.sys|C:\IO.SYS"
|
||||
GetDlgItem $1 $HWND 1211
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Result (String1 - String2):"
|
||||
goto WordAddSend
|
||||
|
||||
WordInsertSend:
|
||||
StrCmp $0 "5. WordInsert" 0 StrFilter1Send
|
||||
GetDlgItem $1 $HWND 1201
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:C:\io.sys|C:\WINDOWS"
|
||||
GetDlgItem $1 $HWND 1202
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:|"
|
||||
GetDlgItem $1 $HWND 1203
|
||||
EnableWindow $1 1
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:C:\logo.sys"
|
||||
GetDlgItem $1 $HWND 1204
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:E+2"
|
||||
GetDlgItem $1 $HWND 1207
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:String"
|
||||
GetDlgItem $1 $HWND 1208
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Delimiter"
|
||||
GetDlgItem $1 $HWND 1209
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Word"
|
||||
GetDlgItem $1 $HWND 1210
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Word #"
|
||||
GetDlgItem $1 $HWND 1211
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Result:"
|
||||
abort
|
||||
|
||||
StrFilter1Send:
|
||||
StrCmp $0 "6. StrFilter (UpperCase)" 0 StrFilter2Send
|
||||
GetDlgItem $1 $HWND 1201
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:123abc 456DEF 7890|%#"
|
||||
GetDlgItem $1 $HWND 1202
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:+"
|
||||
GetDlgItem $1 $HWND 1203
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:"
|
||||
GetDlgItem $1 $HWND 1204
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:"
|
||||
GetDlgItem $1 $HWND 1211
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Result (String in uppercase):"
|
||||
goto StrFilterSend
|
||||
|
||||
StrFilter2Send:
|
||||
StrCmp $0 " (LowerCase)" 0 StrFilter3Send
|
||||
GetDlgItem $1 $HWND 1201
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:123abc 456DEF 7890|%#"
|
||||
GetDlgItem $1 $HWND 1202
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:-"
|
||||
GetDlgItem $1 $HWND 1203
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:ef"
|
||||
GetDlgItem $1 $HWND 1204
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:"
|
||||
GetDlgItem $1 $HWND 1211
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Result (String in lowercase except EF):"
|
||||
goto StrFilterSend
|
||||
|
||||
StrFilter3Send:
|
||||
StrCmp $0 " (Filter)" 0 VersionCompareSend
|
||||
GetDlgItem $1 $HWND 1201
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:123abc 456DEF 7890|%#"
|
||||
GetDlgItem $1 $HWND 1202
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:+12"
|
||||
GetDlgItem $1 $HWND 1203
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:b"
|
||||
GetDlgItem $1 $HWND 1204
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:def"
|
||||
GetDlgItem $1 $HWND 1211
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Result (String Digits + Letters + b - def):"
|
||||
goto StrFilterSend
|
||||
|
||||
VersionCompareSend:
|
||||
StrCmp $0 "7. VersionCompare" 0 VersionConvertSend
|
||||
GetDlgItem $1 $HWND 1201
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:1.1.1.9"
|
||||
GetDlgItem $1 $HWND 1202
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:1.1.1.01"
|
||||
GetDlgItem $1 $HWND 1203
|
||||
ShowWindow $1 0
|
||||
GetDlgItem $1 $HWND 1204
|
||||
ShowWindow $1 0
|
||||
GetDlgItem $1 $HWND 1206
|
||||
EnableWindow $1 0
|
||||
GetDlgItem $1 $HWND 1207
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Version1"
|
||||
GetDlgItem $1 $HWND 1208
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Version2"
|
||||
GetDlgItem $1 $HWND 1209
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:"
|
||||
GetDlgItem $1 $HWND 1210
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:"
|
||||
GetDlgItem $1 $HWND 1211
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Result (0-equal 1-newer 2-older):"
|
||||
abort
|
||||
|
||||
VersionConvertSend:
|
||||
StrCmp $0 "8. VersionConvert" 0 Abort
|
||||
GetDlgItem $1 $HWND 1201
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:9.0c"
|
||||
GetDlgItem $1 $HWND 1202
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:"
|
||||
GetDlgItem $1 $HWND 1203
|
||||
ShowWindow $1 0
|
||||
GetDlgItem $1 $HWND 1204
|
||||
ShowWindow $1 0
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:"
|
||||
GetDlgItem $1 $HWND 1206
|
||||
EnableWindow $1 0
|
||||
GetDlgItem $1 $HWND 1207
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Version"
|
||||
GetDlgItem $1 $HWND 1208
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:CharList"
|
||||
GetDlgItem $1 $HWND 1209
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:"
|
||||
GetDlgItem $1 $HWND 1210
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:"
|
||||
GetDlgItem $1 $HWND 1211
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Result (numerical version format):"
|
||||
abort
|
||||
|
||||
Abort:
|
||||
Abort
|
||||
|
||||
WordFindSend:
|
||||
GetDlgItem $1 $HWND 1203
|
||||
EnableWindow $1 0
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:"
|
||||
GetDlgItem $1 $HWND 1201
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:C:\io.sys|C:\logo.sys|C:\Program Files|C:\WINDOWS"
|
||||
GetDlgItem $1 $HWND 1207
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:String"
|
||||
GetDlgItem $1 $HWND 1208
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Delimiter"
|
||||
GetDlgItem $1 $HWND 1209
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:"
|
||||
Abort
|
||||
|
||||
WordReplaceSend:
|
||||
GetDlgItem $1 $HWND 1203
|
||||
EnableWindow $1 1
|
||||
GetDlgItem $1 $HWND 1207
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:String"
|
||||
GetDlgItem $1 $HWND 1208
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Replace it"
|
||||
GetDlgItem $1 $HWND 1209
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR: with"
|
||||
GetDlgItem $1 $HWND 1210
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Word #"
|
||||
GetDlgItem $1 $HWND 1211
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Result:"
|
||||
Abort
|
||||
|
||||
WordAddSend:
|
||||
GetDlgItem $1 $HWND 1203
|
||||
EnableWindow $1 0
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:"
|
||||
GetDlgItem $1 $HWND 1201
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:C:\io.sys|C:\logo.sys|C:\WINDOWS"
|
||||
GetDlgItem $1 $HWND 1202
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:|"
|
||||
GetDlgItem $1 $HWND 1207
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:String1"
|
||||
GetDlgItem $1 $HWND 1208
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Delimiter"
|
||||
GetDlgItem $1 $HWND 1209
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:"
|
||||
GetDlgItem $1 $HWND 1210
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:String2"
|
||||
Abort
|
||||
|
||||
StrFilterSend:
|
||||
GetDlgItem $1 $HWND 1203
|
||||
EnableWindow $1 1
|
||||
GetDlgItem $1 $HWND 1206
|
||||
EnableWindow $1 0
|
||||
GetDlgItem $1 $HWND 1207
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:String"
|
||||
GetDlgItem $1 $HWND 1208
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Filter"
|
||||
GetDlgItem $1 $HWND 1209
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Include"
|
||||
GetDlgItem $1 $HWND 1210
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:Exclude"
|
||||
Abort
|
||||
|
||||
;=Enter=
|
||||
Enter:
|
||||
StrCpy $0 ''
|
||||
ReadINIStr $STATE $INI "Field 1" "State"
|
||||
ReadINIStr $R1 $INI "Field 2" "State"
|
||||
ReadINIStr $R2 $INI "Field 3" "State"
|
||||
ReadINIStr $R3 $INI "Field 4" "State"
|
||||
ReadINIStr $R4 $INI "Field 5" "State"
|
||||
|
||||
StrCmp $STATE "1. WordFind (Find word by number)" WordFind
|
||||
StrCmp $STATE " (Delimiter exclude)" WordFind
|
||||
StrCmp $STATE " (Find in string)" WordFind
|
||||
StrCmp $STATE " (Sum of words)" WordFind
|
||||
StrCmp $STATE " (Sum of delimiters)" WordFind
|
||||
StrCmp $STATE " (Find word number)" WordFind
|
||||
StrCmp $STATE " ( }} )" WordFind
|
||||
StrCmp $STATE " ( {} )" WordFind
|
||||
StrCmp $STATE " ( *} )" WordFind
|
||||
StrCmp $STATE "2. WordFind2X" WordFind2X
|
||||
StrCmp $STATE "3. WordReplace (Replace)" WordReplace
|
||||
StrCmp $STATE " (Delete)" WordReplace
|
||||
StrCmp $STATE " (Multiple-replace)" WordReplace
|
||||
StrCmp $STATE "4. WordAdd (Add)" WordAdd
|
||||
StrCmp $STATE " (Delete) " WordAdd
|
||||
StrCmp $STATE "5. WordInsert" WordInsert
|
||||
StrCmp $STATE "6. StrFilter (UpperCase)" StrFilter
|
||||
StrCmp $STATE " (LowerCase)" StrFilter
|
||||
StrCmp $STATE " (Filter)" StrFilter
|
||||
StrCmp $STATE "7. VersionCompare" VersionCompare
|
||||
StrCmp $STATE "8. VersionConvert" VersionConvert
|
||||
Abort
|
||||
|
||||
WordFind:
|
||||
${WordFind} "$R1" "$R2" "$R4" $R0
|
||||
IfErrors 0 Send
|
||||
StrCpy $0 $R0
|
||||
StrCmp $R0 3 0 +3
|
||||
StrCpy $3 '"+1" "-1" "+1}" "+1{" "#" "/word"'
|
||||
goto error3
|
||||
StrCmp $R0 2 0 error1
|
||||
StrCpy $R4 $R4 '' 1
|
||||
StrCpy $1 $R4 1
|
||||
StrCmp $1 / 0 error2
|
||||
StrCpy $R4 $R4 '' 1
|
||||
StrCpy $R0 '"$R4" no such word.'
|
||||
goto Send
|
||||
|
||||
WordFind2X:
|
||||
${WordFind2X} "$R1" "$R2" "$R3" "$R4" $R0
|
||||
IfErrors 0 Send
|
||||
StrCpy $0 $R0
|
||||
StrCmp $R0 3 0 +3
|
||||
StrCpy $3 '"+1" "-1"'
|
||||
goto error3
|
||||
StrCmp $R0 2 +3
|
||||
StrCpy $R0 '"$R2...$R3" no words found.'
|
||||
goto Send
|
||||
StrCpy $R4 $R4 '' 1
|
||||
StrCpy $1 $R4 1
|
||||
StrCmp $1 / 0 +2
|
||||
StrCpy $R4 $R4 '' 1
|
||||
StrCpy $R0 '"$R4" no such word.'
|
||||
goto Send
|
||||
|
||||
WordReplace:
|
||||
${WordReplace} "$R1" "$R2" "$R3" "$R4" $R0
|
||||
IfErrors 0 Send
|
||||
StrCpy $0 $R0
|
||||
StrCmp $R0 3 0 +3
|
||||
StrCpy $3 '"+1" "+1*" "+" "+*" "{}"'
|
||||
goto error3
|
||||
StrCmp $R0 2 0 error1
|
||||
StrCpy $R4 $R4 '' 1
|
||||
goto error2
|
||||
|
||||
WordAdd:
|
||||
${WordAdd} "$R1" "$R2" "$R4" $R0
|
||||
IfErrors 0 Send
|
||||
StrCpy $0 $R0
|
||||
StrCmp $R0 3 0 error1empty
|
||||
StrCpy $3 '"+text" "-text"'
|
||||
goto error3
|
||||
|
||||
WordInsert:
|
||||
${WordInsert} "$R1" "$R2" "$R3" "$R4" $R0
|
||||
IfErrors 0 Send
|
||||
StrCpy $0 $R0
|
||||
StrCmp $R0 3 0 +3
|
||||
StrCpy $3 '"+1" "-1"'
|
||||
goto error3
|
||||
StrCmp $R0 2 0 error1empty
|
||||
StrCpy $R4 $R4 '' 1
|
||||
goto error2
|
||||
|
||||
StrFilter:
|
||||
${StrFilter} "$R1" "$R2" "$R3" "$R4" $R0
|
||||
IfErrors 0 Send
|
||||
StrCpy $R0 'Syntax error'
|
||||
goto Send
|
||||
|
||||
VersionCompare:
|
||||
${VersionCompare} "$R1" "$R2" $R0
|
||||
goto Send
|
||||
|
||||
VersionConvert:
|
||||
${VersionConvert} "$R1" "$R2" $R0
|
||||
goto Send
|
||||
|
||||
error3:
|
||||
StrCpy $R0 '"$R4" syntax error ($3)'
|
||||
goto Send
|
||||
error2:
|
||||
StrCpy $R0 '"$R4" no such word number'
|
||||
goto Send
|
||||
error1empty:
|
||||
StrCpy $R0 '"$R2" delimiter is empty'
|
||||
goto Send
|
||||
error1:
|
||||
StrCpy $R0 '"$R2" delimiter not found in string'
|
||||
goto Send
|
||||
|
||||
Send:
|
||||
GetDlgItem $1 $HWND 1205
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:$R0"
|
||||
GetDlgItem $1 $HWND 1206
|
||||
SendMessage $1 ${WM_SETTEXT} 1 "STR:$0"
|
||||
abort
|
||||
FunctionEnd
|
||||
|
||||
Function .onInit
|
||||
InitPluginsDir
|
||||
GetTempFileName $INI $PLUGINSDIR
|
||||
File /oname=$INI "WordFunc.ini"
|
||||
FunctionEnd
|
||||
|
||||
Page instfiles
|
||||
|
||||
Section "Empty"
|
||||
SectionEnd
|
610
KattekerCreator/nsis/Examples/WordFuncTest.nsi
Normal file
610
KattekerCreator/nsis/Examples/WordFuncTest.nsi
Normal file
@ -0,0 +1,610 @@
|
||||
;_____________________________________________________________________________
|
||||
;
|
||||
; Word Functions Test
|
||||
;_____________________________________________________________________________
|
||||
;
|
||||
; 2006 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)
|
||||
|
||||
Name "Word Functions Test"
|
||||
OutFile "WordFuncTest.exe"
|
||||
Caption "$(^Name)"
|
||||
ShowInstDetails show
|
||||
XPStyle on
|
||||
RequestExecutionLevel user
|
||||
|
||||
Var FUNCTION
|
||||
Var OUT
|
||||
|
||||
!include "WordFunc.nsh"
|
||||
|
||||
;############### INSTALL ###############
|
||||
|
||||
!define StackVerificationStart `!insertmacro StackVerificationStart`
|
||||
!macro StackVerificationStart _FUNCTION
|
||||
StrCpy $FUNCTION ${_FUNCTION}
|
||||
Call StackVerificationStart
|
||||
!macroend
|
||||
|
||||
!define StackVerificationEnd `!insertmacro StackVerificationEnd`
|
||||
!macro StackVerificationEnd
|
||||
Call StackVerificationEnd
|
||||
!macroend
|
||||
|
||||
Function StackVerificationStart
|
||||
StrCpy $0 !0
|
||||
StrCpy $1 !1
|
||||
StrCpy $2 !2
|
||||
StrCpy $3 !3
|
||||
StrCpy $4 !4
|
||||
StrCpy $5 !5
|
||||
StrCpy $6 !6
|
||||
StrCpy $7 !7
|
||||
StrCpy $8 !8
|
||||
StrCpy $9 !9
|
||||
StrCpy $R0 !R0
|
||||
StrCpy $R1 !R1
|
||||
StrCpy $R2 !R2
|
||||
StrCpy $R3 !R3
|
||||
StrCpy $R4 !R4
|
||||
StrCpy $R5 !R5
|
||||
StrCpy $R6 !R6
|
||||
StrCpy $R7 !R7
|
||||
StrCpy $R8 !R8
|
||||
StrCpy $R9 !R9
|
||||
FunctionEnd
|
||||
|
||||
Function StackVerificationEnd
|
||||
IfErrors +3
|
||||
DetailPrint 'PASSED $FUNCTION no errors'
|
||||
goto +2
|
||||
DetailPrint 'FAILED $FUNCTION error'
|
||||
|
||||
StrCmp $0 '!0' 0 error
|
||||
StrCmp $1 '!1' 0 error
|
||||
StrCmp $2 '!2' 0 error
|
||||
StrCmp $3 '!3' 0 error
|
||||
StrCmp $4 '!4' 0 error
|
||||
StrCmp $5 '!5' 0 error
|
||||
StrCmp $6 '!6' 0 error
|
||||
StrCmp $7 '!7' 0 error
|
||||
StrCmp $8 '!8' 0 error
|
||||
StrCmp $9 '!9' 0 error
|
||||
StrCmp $R0 '!R0' 0 error
|
||||
StrCmp $R1 '!R1' 0 error
|
||||
StrCmp $R2 '!R2' 0 error
|
||||
StrCmp $R3 '!R3' 0 error
|
||||
StrCmp $R4 '!R4' 0 error
|
||||
StrCmp $R5 '!R5' 0 error
|
||||
StrCmp $R6 '!R6' 0 error
|
||||
StrCmp $R7 '!R7' 0 error
|
||||
StrCmp $R8 '!R8' 0 error
|
||||
StrCmp $R9 '!R9' 0 error
|
||||
DetailPrint 'PASSED $FUNCTION stack'
|
||||
goto end
|
||||
|
||||
error:
|
||||
DetailPrint 'FAILED $FUNCTION stack'
|
||||
; MessageBox MB_OKCANCEL '$$0={$0}$\n$$1={$1}$\n$$2={$2}$\n$$3={$3}$\n$$4={$4}$\n$$5={$5}$\n$$6={$6}$\n$$7={$7}$\n$$8={$8}$\n$$9={$9}$\n$$R0={$R0}$\n$$R1={$R1}$\n$$R2={$R2}$\n$$R3={$R3}$\n$$R4={$R4}$\n$$R5={$R5}$\n$$R6={$R6}$\n$$R7={$R7}$\n$$R8={$R8}$\n$$R9={$R9}' IDOK +2
|
||||
; quit
|
||||
|
||||
end:
|
||||
FunctionEnd
|
||||
|
||||
|
||||
|
||||
Section WordFind
|
||||
${StackVerificationStart} WordFind
|
||||
|
||||
${WordFind} '||io.sys|||Program Files|||WINDOWS' '||' '-02' $OUT
|
||||
StrCmp $OUT '|Program Files' 0 error
|
||||
|
||||
${WordFind} '||io.sys||||Program Files||||WINDOWS' '||' '-2' $OUT
|
||||
StrCmp $OUT 'Program Files' 0 error
|
||||
|
||||
${WordFind} 'C:\io.sys|||logo.sys|||WINDOWS' '||' '-2}' $OUT
|
||||
StrCmp $OUT '|logo.sys|||WINDOWS' 0 error
|
||||
|
||||
${WordFind} 'C:\io.sys|||logo.sys|||WINDOWS' '||' '#' $OUT
|
||||
StrCmp $OUT '3' 0 error
|
||||
|
||||
${WordFind} 'C:\io.sys|||logo.sys|||WINDOWS' '||' '*' $OUT
|
||||
StrCmp $OUT '2' 0 error
|
||||
|
||||
${WordFind} 'C:\io.sys|||Program Files|||WINDOWS' '||' '/|Program Files' $OUT
|
||||
StrCmp $OUT '2' 0 error
|
||||
|
||||
${WordFind} 'C:\io.sys|||logo.sys|||WINDOWS' '||' '+2}}' $OUT
|
||||
StrCmp $OUT '|||WINDOWS' 0 error
|
||||
|
||||
${WordFind} 'C:\io.sys|||logo.sys|||WINDOWS' '||' '+2{}' $OUT
|
||||
StrCmp $OUT 'C:\io.sys|||WINDOWS' 0 error
|
||||
|
||||
${WordFind} 'C:\io.sys|||logo.sys|||WINDOWS' '||' '+2*}' $OUT
|
||||
StrCmp $OUT '|logo.sys|||WINDOWS' 0 error
|
||||
|
||||
${WordFind} 'C:\\Program Files\\NSIS\\NSIS.chm' '\' '-2{*' $OUT
|
||||
StrCmp $OUT 'C:\\Program Files\\NSIS' 0 error
|
||||
|
||||
${WordFind} 'C:\io.sys|||Program Files|||WINDOWS|||' '||' '-1' $OUT
|
||||
StrCmp $OUT '|' 0 error
|
||||
|
||||
${WordFind} '||C:\io.sys|||logo.sys|||WINDOWS||' '||' '-1}' $OUT
|
||||
StrCmp $OUT '' 0 error
|
||||
|
||||
${WordFind} '||C:\io.sys|||logo.sys|||WINDOWS||' '||' '+1{' $OUT
|
||||
StrCmp $OUT '' 0 error
|
||||
|
||||
${WordFind} 'C:\io.sys|||logo.sys' '_' 'E+1' $OUT
|
||||
IfErrors 0 error
|
||||
StrCmp $OUT 1 0 error
|
||||
|
||||
${WordFind} 'C:\io.sys|||logo.sys|||' '\' 'E+3' $OUT
|
||||
IfErrors 0 error
|
||||
StrCmp $OUT 2 0 error
|
||||
|
||||
${WordFind} 'C:\io.sys|||logo.sys' '\' 'E1' $OUT
|
||||
IfErrors 0 error
|
||||
StrCmp $OUT 3 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section WordFindS
|
||||
${StackVerificationStart} WordFindS
|
||||
|
||||
${WordFindS} 'C:\io.sys|||Program Files|||WINDOWS' '||' '/|PROGRAM FILES' $OUT
|
||||
StrCmp $OUT 'C:\io.sys|||Program Files|||WINDOWS' 0 error
|
||||
|
||||
${WordFindS} 'C:\io.sys|||Program Files|||WINDOWS' '||' '/|Program Files' $OUT
|
||||
StrCmp $OUT '2' 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section WordFind2X
|
||||
${StackVerificationStart} WordFind2X
|
||||
|
||||
${WordFind2X} '[C:\io.sys];[C:\logo.sys];[C:\WINDOWS]' '[C:\' '];' '+2' $OUT
|
||||
StrCmp $OUT 'logo.sys' 0 error
|
||||
|
||||
${WordFind2X} 'C:\WINDOWS C:\io.sys C:\logo.sys' '\' '.' '-1' $OUT
|
||||
StrCmp $OUT 'logo' 0 error
|
||||
|
||||
${WordFind2X} 'C:\WINDOWS C:\io.sys C:\logo.sys' '\' '.' '-1{{' $OUT
|
||||
StrCmp $OUT 'C:\WINDOWS C:\io.sys C:' 0 error
|
||||
|
||||
${WordFind2X} 'C:\WINDOWS C:\io.sys C:\logo.sys' '\' '.' '-1{}' $OUT
|
||||
StrCmp $OUT 'C:\WINDOWS C:\io.sys C:sys' 0 error
|
||||
|
||||
${WordFind2X} 'C:\WINDOWS C:\io.sys C:\logo.sys' '\' '.' '-1{*' $OUT
|
||||
StrCmp $OUT 'C:\WINDOWS C:\io.sys C:\logo.' 0 error
|
||||
|
||||
${WordFind2X} 'C:\WINDOWS C:\io.sys C:\logo.sys' '\' '.' '/logo' $OUT
|
||||
StrCmp $OUT '2' 0 error
|
||||
|
||||
${WordFind2X} '||a||b||c' '||' '||' 'E+1' $OUT
|
||||
StrCmp $OUT 'a' 0 error
|
||||
|
||||
${WordFind2X} '[io.sys];[C:\logo.sys]' '\' '];' 'E+1' $OUT
|
||||
IfErrors 0 error
|
||||
StrCmp $OUT 1 0 error
|
||||
|
||||
${WordFind2X} '[io.sys];[C:\logo.sys]' '[' '];' 'E+2' $OUT
|
||||
IfErrors 0 error
|
||||
StrCmp $OUT 2 0 error
|
||||
|
||||
${WordFind2X} '[io.sys];[C:\logo.sys]' '\' '];' 'E2' $OUT
|
||||
IfErrors 0 error
|
||||
StrCmp $OUT 3 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section WordFind2XS
|
||||
${StackVerificationStart} WordFind2XS
|
||||
|
||||
${WordFind2XS} 'C:\WINDOWS C:\io.sys C:\logo.sys' '\' '.' '/LOGO' $OUT
|
||||
StrCmp $OUT 'C:\WINDOWS C:\io.sys C:\logo.sys' 0 error
|
||||
|
||||
${WordFind2XS} 'C:\WINDOWS C:\io.sys C:\logo.sys' '\' '.' '/logo' $OUT
|
||||
StrCmp $OUT '2' 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section WordFind3X
|
||||
${StackVerificationStart} WordFind3X
|
||||
|
||||
${WordFind3X} '[1.AAB];[2.BAA];[3.BBB];' '[' 'AA' '];' '+1' $OUT
|
||||
StrCmp $OUT '1.AAB' 0 error
|
||||
|
||||
${WordFind3X} '[1.AAB];[2.BAA];[3.BBB];' '[' 'AA' '];' '-1' $OUT
|
||||
StrCmp $OUT '2.BAA' 0 error
|
||||
|
||||
${WordFind3X} '[1.AAB];[2.BAA];[3.BBB];' '[' 'AA' '];' '-1{{' $OUT
|
||||
StrCmp $OUT '[1.AAB];' 0 error
|
||||
|
||||
${WordFind3X} '[1.AAB];[2.BAA];[3.BBB];' '[' 'AA' '];' '-1{}' $OUT
|
||||
StrCmp $OUT '[1.AAB];[3.BBB];' 0 error
|
||||
|
||||
${WordFind3X} '[1.AAB];[2.BAA];[3.BBB];' '[' 'AA' '];' '-1{*' $OUT
|
||||
StrCmp $OUT '[1.AAB];[2.BAA];' 0 error
|
||||
|
||||
${WordFind3X} '[1.AAB];[2.BAA];[3.BBB];' '[' 'AA' '];' '/2.BAA' $OUT
|
||||
StrCmp $OUT '2' 0 error
|
||||
|
||||
${WordFind3X} '[1.AAB];[2.BAA];[3.BBB];' '[' 'XX' '];' 'E+1' $OUT
|
||||
IfErrors 0 error
|
||||
StrCmp $OUT '1' 0 error
|
||||
|
||||
${WordFind3X} '[1.AAB];[2.BAA];[3.BBB];' '[' 'AA' '];' 'E+3' $OUT
|
||||
IfErrors 0 error
|
||||
StrCmp $OUT '2' 0 error
|
||||
|
||||
${WordFind3X} '[1.AAB];[2.BAA];[3.BBB];' '[' 'AA' '];' 'E3' $OUT
|
||||
IfErrors 0 error
|
||||
StrCmp $OUT '3' 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section WordFind3XS
|
||||
${StackVerificationStart} WordFind3XS
|
||||
|
||||
${WordFind3XS} '[1.AAB];[2.BAA];[3.BBB];' '[' 'AA' '];' '/2.baa' $OUT
|
||||
StrCmp $OUT '[1.AAB];[2.BAA];[3.BBB];' 0 error
|
||||
|
||||
${WordFind3XS} '[1.AAB];[2.BAA];[3.BBB];' '[' 'AA' '];' '/2.BAA' $OUT
|
||||
StrCmp $OUT '2' 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section WordReplace
|
||||
${StackVerificationStart} WordReplace
|
||||
|
||||
${WordReplace} 'C:\io.sys C:\logo.sys C:\WINDOWS' 'SYS' 'bmp' '+2' $OUT
|
||||
StrCmp $OUT 'C:\io.sys C:\logo.bmp C:\WINDOWS' 0 error
|
||||
|
||||
${WordReplace} 'C:\io.sys C:\logo.sys C:\WINDOWS' 'SYS' '' '+' $OUT
|
||||
StrCmp $OUT 'C:\io. C:\logo. C:\WINDOWS' 0 error
|
||||
|
||||
${WordReplace} 'C:\io.sys C:\logo.sys C:\WINDOWS' 'C:\io.sys' '' '+' $OUT
|
||||
StrCmp $OUT ' C:\logo.sys C:\WINDOWS' 0 error
|
||||
|
||||
${WordReplace} 'C:\io.sys C:\logo.sys C:\WINDOWS' ' ' ' ' '+1*' $OUT
|
||||
StrCmp $OUT 'C:\io.sys C:\logo.sys C:\WINDOWS' 0 error
|
||||
|
||||
${WordReplace} 'C:\io.sys C:\logo.sysSYSsys C:\WINDOWS' 'sys' 'bmp' '+*' $OUT
|
||||
StrCmp $OUT 'C:\io.bmp C:\logo.bmp C:\WINDOWS' 0 error
|
||||
|
||||
${WordReplace} 'SYSsysC:\io.sys C:\logo.sys C:\WINDOWSsysSYSsys' 'sys' '|' '{' $OUT
|
||||
StrCmp $OUT '||C:\io.sys C:\logo.sys C:\WINDOWSsysSYSsys' 0 error
|
||||
|
||||
${WordReplace} 'SYSsysC:\io.sys C:\logo.sys C:\WINDOWSsysSYSsys' 'sys' '|' '}' $OUT
|
||||
StrCmp $OUT 'SYSsysC:\io.sys C:\logo.sys C:\WINDOWS|||' 0 error
|
||||
|
||||
${WordReplace} 'SYSsysC:\io.sys C:\logo.sys C:\WINDOWSsysSYSsys' 'sys' '|' '{}' $OUT
|
||||
StrCmp $OUT '||C:\io.sys C:\logo.sys C:\WINDOWS|||' 0 error
|
||||
|
||||
${WordReplace} 'SYSsysC:\io.sys C:\logo.sys C:\WINDOWSsysSYSsys' 'sys' '|' '{*' $OUT
|
||||
StrCmp $OUT '|C:\io.sys C:\logo.sys C:\WINDOWSsysSYSsys' 0 error
|
||||
|
||||
${WordReplace} 'SYSsysC:\io.sys C:\logo.sys C:\WINDOWSsysSYSsys' 'sys' '|' '}*' $OUT
|
||||
StrCmp $OUT 'SYSsysC:\io.sys C:\logo.sys C:\WINDOWS|' 0 error
|
||||
|
||||
${WordReplace} 'SYSsysC:\io.sys C:\logo.sys C:\WINDOWSsysSYSsys' 'sys' '|' '{}*' $OUT
|
||||
StrCmp $OUT '|C:\io.sys C:\logo.sys C:\WINDOWS|' 0 error
|
||||
|
||||
${WordReplace} 'sysSYSsysC:\io.sys C:\logo.sys C:\WINDOWSsysSYSsys' 'sys' '|' '{}*' $OUT
|
||||
StrCmp $OUT '|C:\io.sys C:\logo.sys C:\WINDOWS|' 0 error
|
||||
|
||||
${WordReplace} 'C:\io.sys C:\logo.sys' '#sys' '|sys|' 'E+1' $OUT
|
||||
IfErrors 0 error
|
||||
StrCmp $OUT '1' 0 error
|
||||
|
||||
${WordReplace} 'C:\io.sys C:\logo.sys' '.sys' '|sys|' 'E+3' $OUT
|
||||
IfErrors 0 error
|
||||
StrCmp $OUT '2' 0 error
|
||||
|
||||
${WordReplace} 'C:\io.sys C:\logo.sys' '.sys' '|sys|' 'E3' $OUT
|
||||
IfErrors 0 error
|
||||
StrCmp $OUT '3' 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section WordReplaceS
|
||||
${StackVerificationStart} WordReplaceS
|
||||
|
||||
${WordReplaceS} 'C:\io.sys C:\logo.sys C:\WINDOWS' 'SYS' 'bmp' '+2' $OUT
|
||||
StrCmp $OUT 'C:\io.sys C:\logo.sys C:\WINDOWS' 0 error
|
||||
|
||||
${WordReplaceS} 'C:\io.sys C:\logo.sys C:\WINDOWS' 'sys' 'bmp' '+2' $OUT
|
||||
StrCmp $OUT 'C:\io.sys C:\logo.bmp C:\WINDOWS' 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section WordAdd
|
||||
${StackVerificationStart} WordAdd
|
||||
|
||||
${WordAdd} 'C:\io.sys C:\WINDOWS' ' ' '+C:\WINDOWS C:\config.sys' $OUT
|
||||
StrCmp $OUT 'C:\io.sys C:\WINDOWS C:\config.sys' 0 error
|
||||
|
||||
${WordAdd} 'C:\io.sys C:\logo.sys C:\WINDOWS' ' ' '-C:\WINDOWS C:\config.sys C:\IO.SYS' $OUT
|
||||
StrCmp $OUT 'C:\logo.sys' 0 error
|
||||
|
||||
${WordAdd} 'C:\io.sys' ' ' '+C:\WINDOWS C:\config.sys C:\IO.SYS' $OUT
|
||||
StrCmp $OUT 'C:\io.sys C:\WINDOWS C:\config.sys' 0 error
|
||||
|
||||
${WordAdd} 'C:\io.sys C:\logo.sys C:\WINDOWS' ' ' '-C:\WINDOWS' $OUT
|
||||
StrCmp $OUT 'C:\io.sys C:\logo.sys' 0 error
|
||||
|
||||
${WordAdd} 'C:\io.sys C:\logo.sys' ' ' '+C:\logo.sys' $OUT
|
||||
StrCmp $OUT 'C:\io.sys C:\logo.sys' 0 error
|
||||
|
||||
${WordAdd} 'C:\io.sys C:\logo.sys' ' ' 'E-' $OUT
|
||||
StrCmp $OUT 'C:\io.sys C:\logo.sys' 0 error
|
||||
IfErrors error
|
||||
|
||||
${WordAdd} 'C:\io.sys C:\logo.sys' '' 'E-C:\logo.sys' $OUT
|
||||
IfErrors 0 error
|
||||
StrCmp $OUT '1' 0 error
|
||||
|
||||
${WordAdd} 'C:\io.sys C:\logo.sys' '' 'EC:\logo.sys' $OUT
|
||||
IfErrors 0 error
|
||||
StrCmp $OUT '3' 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section WordAddS
|
||||
${StackVerificationStart} WordAddS
|
||||
|
||||
${WordAddS} 'C:\io.sys C:\WINDOWS' ' ' '+C:\windows C:\config.sys' $OUT
|
||||
StrCmp $OUT 'C:\io.sys C:\WINDOWS C:\windows C:\config.sys' 0 error
|
||||
|
||||
${WordAddS} 'C:\io.sys C:\WINDOWS' ' ' '+C:\WINDOWS C:\config.sys' $OUT
|
||||
StrCmp $OUT 'C:\io.sys C:\WINDOWS C:\config.sys' 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section WordInsert
|
||||
${StackVerificationStart} WordInsert
|
||||
|
||||
${WordInsert} 'C:\io.sys C:\WINDOWS' ' ' 'C:\logo.sys' '-2' $OUT
|
||||
StrCmp $OUT 'C:\io.sys C:\logo.sys C:\WINDOWS' 0 error
|
||||
|
||||
${WordInsert} 'C:\io.sys' ' ' 'C:\WINDOWS' '+2' $OUT
|
||||
StrCmp $OUT 'C:\io.sys C:\WINDOWS' 0 error
|
||||
|
||||
${WordInsert} '' ' ' 'C:\WINDOWS' '+1' $OUT
|
||||
StrCmp $OUT 'C:\WINDOWS ' 0 error
|
||||
|
||||
${WordInsert} 'C:\io.sys C:\logo.sys' '' 'C:\logo.sys' 'E+1' $OUT
|
||||
IfErrors 0 error
|
||||
StrCmp $OUT '1' 0 error
|
||||
|
||||
${WordInsert} 'C:\io.sys C:\logo.sys' ' ' 'C:\logo.sys' 'E+4' $OUT
|
||||
IfErrors 0 error
|
||||
StrCmp $OUT '2' 0 error
|
||||
|
||||
${WordInsert} 'C:\io.sys C:\logo.sys' '' 'C:\logo.sys' 'E1' $OUT
|
||||
IfErrors 0 error
|
||||
StrCmp $OUT '3' 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section WordInsertS
|
||||
${StackVerificationStart} WordInsertS
|
||||
|
||||
${WordInsertS} 'C:\io.sys x C:\logo.sys' ' X ' 'C:\NTLDR' '+2' $OUT
|
||||
StrCmp $OUT 'C:\io.sys x C:\logo.sys X C:\NTLDR' 0 error
|
||||
|
||||
${WordInsertS} 'C:\io.sys x C:\logo.sys' ' x ' 'C:\NTLDR' '+2' $OUT
|
||||
StrCmp $OUT 'C:\io.sys x C:\NTLDR x C:\logo.sys' 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section StrFilter
|
||||
${StackVerificationStart} StrFilter
|
||||
|
||||
${StrFilter} '123abc 456DEF 7890|%#' '+' '' '' $OUT
|
||||
IfErrors error
|
||||
StrCmp $OUT '123ABC 456DEF 7890|%#' 0 error
|
||||
|
||||
${StrFilter} '123abc 456DEF 7890|%#' '-' 'ef' '' $OUT
|
||||
IfErrors error
|
||||
StrCmp $OUT '123abc 456dEF 7890|%#' 0 error
|
||||
|
||||
${StrFilter} '123abc 456DEF 7890|%#' '2' '|%' '' $OUT
|
||||
IfErrors error
|
||||
StrCmp $OUT 'abcDEF|%' 0 error
|
||||
|
||||
${StrFilter} '123abc 456DEF 7890|%#' '13' 'af' '4590' $OUT
|
||||
IfErrors error
|
||||
StrCmp $OUT '123a 6F 78|%#' 0 error
|
||||
|
||||
${StrFilter} '123abc 456DEF 7890|%#' '+12' 'b' 'def' $OUT
|
||||
IfErrors error
|
||||
StrCmp $OUT '123AbC4567890' 0 error
|
||||
|
||||
${StrFilter} '123abc 456DEF 7890|%#' '+12' 'b' 'def' $OUT
|
||||
IfErrors error
|
||||
StrCmp $OUT '123AbC4567890' 0 error
|
||||
|
||||
${StrFilter} '123abc 456DEF 7890|%#' '123' 'b' 'def' $OUT
|
||||
IfErrors 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section StrFilterS
|
||||
${StackVerificationStart} StrFilterS
|
||||
|
||||
${StrFilterS} '123abc 456DEF 7890|%#' '13' 'af' '4590' $OUT
|
||||
IfErrors error
|
||||
StrCmp $OUT '123a 6 78|%#' 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section VersionCompare
|
||||
${StackVerificationStart} VersionCompare
|
||||
|
||||
${VersionCompare} '1.1.1.9' '1.1.1.01' $OUT
|
||||
StrCmp $OUT '1' 0 error
|
||||
|
||||
${VersionCompare} '1.1.1.1' '1.1.1.10' $OUT
|
||||
StrCmp $OUT '2' 0 error
|
||||
|
||||
${VersionCompare} '91.1.1.1' '101.1.1.9' $OUT
|
||||
StrCmp $OUT '2' 0 error
|
||||
|
||||
${VersionCompare} '1.1.1.1' '1.1.1.1' $OUT
|
||||
StrCmp $OUT '0' 0 error
|
||||
|
||||
${VersionCompare} '1.1.1.9' '1.1.1.10' $OUT
|
||||
StrCmp $OUT '2' 0 error
|
||||
|
||||
${VersionCompare} '1.1.1.0' '1.1.1' $OUT
|
||||
StrCmp $OUT '0' 0 error
|
||||
|
||||
${VersionCompare} '1.1.0.0' '1.1' $OUT
|
||||
StrCmp $OUT '0' 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section VersionConvert
|
||||
${StackVerificationStart} VersionConvert
|
||||
|
||||
${VersionConvert} '9.0a' '' $OUT
|
||||
StrCmp $OUT '9.0.01' 0 error
|
||||
|
||||
${VersionConvert} '9.0c' '' $OUT
|
||||
StrCmp $OUT '9.0.03' 0 error
|
||||
|
||||
${VersionConvert} '0.15c-9m' '' $OUT
|
||||
StrCmp $OUT '0.15.03.9.13' 0 error
|
||||
|
||||
${VersionConvert} '0.15c+' 'abcdefghijklmnopqrstuvwxyz+' $OUT
|
||||
StrCmp $OUT '0.15.0327' 0 error
|
||||
|
||||
${VersionConvert} '0.0xa12.x.ax|.|.|x|a|.3|a.4.||5.|' '' $OUT
|
||||
StrCmp $OUT '0.0.2401.12.24.0124.24.01.3.01.4.5' 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section WriteUninstaller
|
||||
goto +2
|
||||
WriteUninstaller '$EXEDIR\un.WordFuncTest.exe'
|
||||
SectionEnd
|
||||
|
||||
|
||||
|
||||
;############### UNINSTALL ###############
|
||||
|
||||
Section un.Uninstall
|
||||
${WordFind} 'C:\io.sys C:\Program Files C:\WINDOWS' ' C:\' '-02' $OUT
|
||||
${WordFindS} 'C:\io.sys C:\Program Files C:\WINDOWS' ' C:\' '-02' $OUT
|
||||
${WordFind2X} '[C:\io.sys];[C:\logo.sys];[C:\WINDOWS]' '[C:\' '];' '+2' $OUT
|
||||
${WordFind2XS} '[C:\io.sys];[C:\logo.sys];[C:\WINDOWS]' '[C:\' '];' '+2' $OUT
|
||||
${WordFind3X} '[1.AAB];[2.BAA];[3.BBB];' '[' 'AA' '];' '+1' $OUT
|
||||
${WordFind3XS} '[1.AAB];[2.BAA];[3.BBB];' '[' 'AA' '];' '+1' $OUT
|
||||
${WordReplace} 'C:\io.sys C:\logo.sys C:\WINDOWS' 'SYS' 'bmp' '+2' $OUT
|
||||
${WordReplaceS} 'C:\io.sys C:\logo.sys C:\WINDOWS' 'SYS' 'bmp' '+2' $OUT
|
||||
${WordAdd} 'C:\io.sys C:\WINDOWS' ' ' '+C:\WINDOWS C:\config.sys' $OUT
|
||||
${WordAddS} 'C:\io.sys C:\WINDOWS' ' ' '+C:\WINDOWS C:\config.sys' $OUT
|
||||
${WordInsert} 'C:\io.sys C:\WINDOWS' ' ' 'C:\logo.sys' '-2' $OUT
|
||||
${WordInsertS} 'C:\io.sys C:\WINDOWS' ' ' 'C:\logo.sys' '-2' $OUT
|
||||
${StrFilter} '123abc 456DEF 7890|%#' '+' '' '' $OUT
|
||||
${StrFilterS} '123abc 456DEF 7890|%#' '+' '' '' $OUT
|
||||
${VersionCompare} '1.1.1.9' '1.1.1.01' $OUT
|
||||
${VersionConvert} '9.0a' '' $OUT
|
||||
SectionEnd
|
330
KattekerCreator/nsis/Examples/bigtest.nsi
Normal file
330
KattekerCreator/nsis/Examples/bigtest.nsi
Normal file
@ -0,0 +1,330 @@
|
||||
; bigtest.nsi
|
||||
;
|
||||
; 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
|
||||
|
||||
!ifdef NOCOMPRESS
|
||||
SetCompress off
|
||||
!endif
|
||||
|
||||
;--------------------------------
|
||||
|
||||
Name "BigNSISTest"
|
||||
Caption "NSIS Big Test"
|
||||
Icon "${NSISDIR}\Contrib\Graphics\Icons\nsis1-install.ico"
|
||||
OutFile "bigtest.exe"
|
||||
|
||||
SetDateSave on
|
||||
SetDatablockOptimize on
|
||||
CRCCheck on
|
||||
SilentInstall normal
|
||||
BGGradient 000000 800000 FFFFFF
|
||||
InstallColors FF8080 000030
|
||||
XPStyle on
|
||||
|
||||
InstallDir "$PROGRAMFILES\NSISTest\BigNSISTest"
|
||||
InstallDirRegKey HKLM "Software\NSISTest\BigNSISTest" "Install_Dir"
|
||||
|
||||
CheckBitmap "${NSISDIR}\Contrib\Graphics\Checks\classic-cross.bmp"
|
||||
|
||||
LicenseText "A test text, make sure it's all there"
|
||||
LicenseData "bigtest.nsi"
|
||||
|
||||
RequestExecutionLevel admin
|
||||
ManifestSupportedOS all
|
||||
|
||||
;--------------------------------
|
||||
|
||||
Page license
|
||||
Page components
|
||||
Page directory
|
||||
Page instfiles
|
||||
|
||||
UninstPage uninstConfirm
|
||||
UninstPage instfiles
|
||||
|
||||
;--------------------------------
|
||||
|
||||
!ifndef NOINSTTYPES ; only if not defined
|
||||
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 info
|
||||
StrCpy $1 "Hello World"
|
||||
DetailPrint "I like to be able to see what is going on (debug) $1"
|
||||
WriteRegStr HKLM SOFTWARE\NSISTest\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 "silent.nsi"
|
||||
CreateDirectory "$INSTDIR\MyProjectFamily\MyProject" ; 2 recursively create a directory for fun.
|
||||
WriteUninstaller "$INSTDIR\bt-uninst.exe"
|
||||
|
||||
Nop ; for fun
|
||||
|
||||
SectionEnd
|
||||
|
||||
Section "TempTest"
|
||||
|
||||
SectionIn 1 2 3
|
||||
Start: MessageBox MB_OK "Start:"
|
||||
|
||||
MessageBox MB_YESNO "Goto MyLabel" IDYES MyLabel
|
||||
|
||||
MessageBox MB_OK "Right before MyLabel:"
|
||||
|
||||
MyLabel: MessageBox MB_OK "MyLabel:"
|
||||
|
||||
MessageBox MB_OK "Right after MyLabel:"
|
||||
|
||||
MessageBox MB_YESNO "Goto Start:?" IDYES Start
|
||||
|
||||
SectionEnd
|
||||
|
||||
SectionGroup /e SectionGroup1
|
||||
|
||||
Section "Test Registry/INI functions"
|
||||
|
||||
SectionIn 1 4 3
|
||||
|
||||
WriteRegStr HKLM SOFTWARE\NSISTest\BigNSISTest "StrTest_INSTDIR" "$INSTDIR"
|
||||
WriteRegDword HKLM SOFTWARE\NSISTest\BigNSISTest "DwordTest_0xDEADBEEF" 0xdeadbeef
|
||||
WriteRegDword HKLM SOFTWARE\NSISTest\BigNSISTest "DwordTest_123456" 123456
|
||||
WriteRegDword HKLM SOFTWARE\NSISTest\BigNSISTest "DwordTest_0123" 0123
|
||||
WriteRegBin HKLM SOFTWARE\NSISTest\BigNSISTest "BinTest_deadbeef01f00dbeef" "DEADBEEF01F00DBEEF"
|
||||
StrCpy $8 "$SYSDIR\IniTest"
|
||||
WriteINIStr "$INSTDIR\test.ini" "MySection" "Value1" $8
|
||||
WriteINIStr "$INSTDIR\test.ini" "MySectionIni" "Value1" $8
|
||||
WriteINIStr "$INSTDIR\test.ini" "MySectionIni" "Value2" $8
|
||||
WriteINIStr "$INSTDIR\test.ini" "IniOn" "Value1" $8
|
||||
|
||||
Call MyFunctionTest
|
||||
|
||||
DeleteINIStr "$INSTDIR\test.ini" "IniOn" "Value1"
|
||||
DeleteINISec "$INSTDIR\test.ini" "MySectionIni"
|
||||
|
||||
ReadINIStr $1 "$INSTDIR\test.ini" "MySectionIni" "Value1"
|
||||
StrCmp $1 "" INIDelSuccess
|
||||
MessageBox MB_OK "DeleteINISec failed"
|
||||
INIDelSuccess:
|
||||
|
||||
ClearErrors
|
||||
ReadRegStr $1 HKCR "software\microsoft" xyz_cc_does_not_exist
|
||||
IfErrors 0 NoError
|
||||
MessageBox MB_OK "could not read from HKCR\software\microsoft\xyz_cc_does_not_exist"
|
||||
Goto ErrorYay
|
||||
NoError:
|
||||
MessageBox MB_OK "read '$1' from HKCR\software\microsoft\xyz_cc_does_not_exist"
|
||||
ErrorYay:
|
||||
|
||||
SectionEnd
|
||||
|
||||
Section "Test CreateShortcut"
|
||||
|
||||
SectionIn 1 2 3
|
||||
|
||||
Call CSCTest
|
||||
|
||||
SectionEnd
|
||||
|
||||
SectionGroup Group2
|
||||
|
||||
!define ASSERT `!insertmacro ASSERT "${U+24}{__FILE__}" ${U+24}{__LINE__} `
|
||||
!macro ASSERT __file __line __xpr
|
||||
${__xpr} +2
|
||||
MessageBox MB_ICONSTOP `ASSERT: ${__xpr} (${__file}:${__line})`
|
||||
!macroend
|
||||
|
||||
Section "Integer"
|
||||
IntOp $0 0xffffffff >> 31
|
||||
${ASSERT} `IntCmpU $0 -1`
|
||||
IntOp $0 0xffffffff >>> 31
|
||||
${ASSERT} `IntCmpU $0 1`
|
||||
IntOp $0 1 << 31
|
||||
${ASSERT} `IntCmpU $0 0x80000000`
|
||||
IntOp $0 0x80000000 ^ 0x40000000
|
||||
${ASSERT} `IntCmpU $0 0xC0000000`
|
||||
ClearErrors
|
||||
IntOp $0 1 / 0
|
||||
${ASSERT} `IfErrors ` ; Division by zero must set the error flag
|
||||
${ASSERT} `IntCmpU $0 0` ; Unspecified result, hopefully it's zero
|
||||
SectionEnd
|
||||
|
||||
Section "Test Branching"
|
||||
|
||||
BeginTestSection:
|
||||
SectionIn 1 2 3
|
||||
|
||||
SetOutPath $INSTDIR
|
||||
|
||||
IfFileExists "$INSTDIR\LogicLib.nsi" 0 BranchTest69
|
||||
|
||||
MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to overwrite $INSTDIR\LogicLib.nsi?" IDNO NoOverwrite ; skipped if file doesn't exist
|
||||
|
||||
BranchTest69:
|
||||
|
||||
SetOverwrite ifnewer ; NOT AN INSTRUCTION, NOT COUNTED IN SKIPPINGS
|
||||
|
||||
NoOverwrite:
|
||||
|
||||
File "LogicLib.nsi" ; 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"
|
||||
|
||||
LoopTest:
|
||||
|
||||
Call myfunc
|
||||
StrCpy $1 "x$1"
|
||||
StrCmp $1 "xxxxxx" 0 LoopTest
|
||||
|
||||
NoRecurse:
|
||||
|
||||
EndTestBranch:
|
||||
|
||||
SectionEnd
|
||||
|
||||
SectionGroupEnd
|
||||
|
||||
Section "Test CopyFiles"
|
||||
|
||||
SectionIn 1 2 3
|
||||
|
||||
SetOutPath $INSTDIR\cpdest
|
||||
CopyFiles "$WINDIR\*.ini" "$INSTDIR\cpdest" 0
|
||||
|
||||
SectionEnd
|
||||
|
||||
SectionGroupEnd
|
||||
|
||||
Section "Test Exec functions" TESTIDX
|
||||
|
||||
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
|
||||
|
||||
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\silent.nsi.lnk" "$INSTDIR\silent.nsi" "" "$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 "MyTestVar=$1"
|
||||
MessageBox MB_OK "myfunc: $2"
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function MyFunctionTest
|
||||
|
||||
ReadINIStr $1 "$INSTDIR\test.ini" "MySectionIni" "Value1"
|
||||
StrCmp $1 $8 NoFailedMsg
|
||||
MessageBox MB_OK "WriteINIStr failed"
|
||||
|
||||
NoFailedMsg:
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function .onSelChange
|
||||
|
||||
SectionGetText ${TESTIDX} $0
|
||||
StrCmp $0 "" e
|
||||
SectionSetText ${TESTIDX} ""
|
||||
Goto e2
|
||||
e:
|
||||
SectionSetText ${TESTIDX} "TextInSection"
|
||||
e2:
|
||||
|
||||
FunctionEnd
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; Uninstaller
|
||||
|
||||
UninstallText "This will uninstall example2. Hit next to continue."
|
||||
UninstallIcon "${NSISDIR}\Contrib\Graphics\Icons\nsis1-uninstall.ico"
|
||||
|
||||
Section "Uninstall"
|
||||
|
||||
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BigNSISTest"
|
||||
DeleteRegKey HKLM "SOFTWARE\NSISTest\BigNSISTest"
|
||||
Delete "$INSTDIR\silent.nsi"
|
||||
Delete "$INSTDIR\LogicLib.nsi"
|
||||
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\MyProjectFamily\MyProject"
|
||||
RMDir "$INSTDIR\MyProjectFamily"
|
||||
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
|
40
KattekerCreator/nsis/Examples/example1.nsi
Normal file
40
KattekerCreator/nsis/Examples/example1.nsi
Normal file
@ -0,0 +1,40 @@
|
||||
; example1.nsi
|
||||
;
|
||||
; This script is perhaps one of the simplest NSIs you can make. All of the
|
||||
; optional settings are left to their default settings. The installer simply
|
||||
; prompts the user asking them where to install, and drops a copy of example1.nsi
|
||||
; there.
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; The name of the installer
|
||||
Name "Example1"
|
||||
|
||||
; The file to write
|
||||
OutFile "example1.exe"
|
||||
|
||||
; The default installation directory
|
||||
InstallDir $DESKTOP\Example1
|
||||
|
||||
; Request application privileges for Windows Vista
|
||||
RequestExecutionLevel user
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; Pages
|
||||
|
||||
Page directory
|
||||
Page instfiles
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; The stuff to install
|
||||
Section "" ;No components page, name is not important
|
||||
|
||||
; Set output path to the installation directory.
|
||||
SetOutPath $INSTDIR
|
||||
|
||||
; Put file there
|
||||
File example1.nsi
|
||||
|
||||
SectionEnd ; end the section
|
92
KattekerCreator/nsis/Examples/example2.nsi
Normal file
92
KattekerCreator/nsis/Examples/example2.nsi
Normal file
@ -0,0 +1,92 @@
|
||||
; example2.nsi
|
||||
;
|
||||
; This script is based on example1.nsi, but it remember the directory,
|
||||
; has uninstall support and (optionally) installs start menu shortcuts.
|
||||
;
|
||||
; It will install example2.nsi into a directory that the user selects,
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; The name of the installer
|
||||
Name "Example2"
|
||||
|
||||
; The file to write
|
||||
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"
|
||||
|
||||
; Request application privileges for Windows Vista
|
||||
RequestExecutionLevel admin
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; Pages
|
||||
|
||||
Page components
|
||||
Page directory
|
||||
Page instfiles
|
||||
|
||||
UninstPage uninstConfirm
|
||||
UninstPage instfiles
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; The stuff to install
|
||||
Section "Example2 (required)"
|
||||
|
||||
SectionIn RO
|
||||
|
||||
; Set output path to the installation directory.
|
||||
SetOutPath $INSTDIR
|
||||
|
||||
; Put file there
|
||||
File "example2.nsi"
|
||||
|
||||
; 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"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2" "NoModify" 1
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2" "NoRepair" 1
|
||||
WriteUninstaller "$INSTDIR\uninstall.exe"
|
||||
|
||||
SectionEnd
|
||||
|
||||
; 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 (MakeNSISW).lnk" "$INSTDIR\example2.nsi" "" "$INSTDIR\example2.nsi" 0
|
||||
|
||||
SectionEnd
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; Uninstaller
|
||||
|
||||
Section "Uninstall"
|
||||
|
||||
; Remove registry keys
|
||||
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2"
|
||||
DeleteRegKey HKLM SOFTWARE\NSIS_Example2
|
||||
|
||||
; Remove files and uninstaller
|
||||
Delete $INSTDIR\example2.nsi
|
||||
Delete $INSTDIR\uninstall.exe
|
||||
|
||||
; Remove shortcuts, if any
|
||||
Delete "$SMPROGRAMS\Example2\*.*"
|
||||
|
||||
; Remove directories used
|
||||
RMDir "$SMPROGRAMS\Example2"
|
||||
RMDir "$INSTDIR"
|
||||
|
||||
SectionEnd
|
123
KattekerCreator/nsis/Examples/gfx.nsi
Normal file
123
KattekerCreator/nsis/Examples/gfx.nsi
Normal file
@ -0,0 +1,123 @@
|
||||
; gfx.nsi
|
||||
;
|
||||
; This script shows some examples of using all of the new
|
||||
; graphic related additions introduced in NSIS 2
|
||||
;
|
||||
; Written by Amir Szkeley 22nd July 2002
|
||||
|
||||
;--------------------------------
|
||||
|
||||
!macro BIMAGE IMAGE PARMS
|
||||
Push $0
|
||||
GetTempFileName $0
|
||||
File /oname=$0 "${IMAGE}"
|
||||
SetBrandingImage ${PARMS} $0
|
||||
Delete $0
|
||||
Pop $0
|
||||
!macroend
|
||||
|
||||
;--------------------------------
|
||||
|
||||
Name "Graphical effects"
|
||||
|
||||
OutFile "gfx.exe"
|
||||
|
||||
; Adds an XP manifest to the installer
|
||||
XPStyle on
|
||||
|
||||
; Add branding image to the installer (an image placeholder on the side).
|
||||
; It is not enough to just add the placeholder, we must set the image too...
|
||||
; We will later set the image in every pre-page function.
|
||||
; We can also set just one persistent image in .onGUIInit
|
||||
AddBrandingImage left 100u
|
||||
|
||||
; Sets the font of the installer
|
||||
SetFont "Comic Sans MS" 8
|
||||
|
||||
; Just to make it three pages...
|
||||
SubCaption 0 ": Yet another page..."
|
||||
SubCaption 2 ": Yet another page..."
|
||||
LicenseText "License page"
|
||||
LicenseData "gfx.nsi"
|
||||
DirText "Lets make a third page!"
|
||||
|
||||
; Install dir
|
||||
InstallDir "${NSISDIR}\Examples"
|
||||
|
||||
; Request application privileges for Windows Vista
|
||||
RequestExecutionLevel user
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; Pages
|
||||
Page license licenseImage
|
||||
Page custom customPage
|
||||
Page directory dirImage
|
||||
Page instfiles instImage
|
||||
|
||||
;--------------------------------
|
||||
|
||||
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\Graphics\Wizard\nsis.bmp" ""
|
||||
done:
|
||||
WriteUninstaller $INSTDIR\uninst.exe
|
||||
SectionEnd
|
||||
|
||||
;--------------------------------
|
||||
|
||||
Function licenseImage
|
||||
!insertmacro BIMAGE "${NSISDIR}\Contrib\Graphics\Header\nsis.bmp" /RESIZETOFIT
|
||||
MessageBox MB_YESNO 'Would you like to skip the license page?' IDNO no
|
||||
Abort
|
||||
no:
|
||||
FunctionEnd
|
||||
|
||||
Function customPage
|
||||
!insertmacro BIMAGE "${NSISDIR}\Contrib\Graphics\Checks\modern.bmp" /RESIZETOFIT
|
||||
MessageBox MB_OK 'This is a nice custom "page" with yet another image :P'
|
||||
#insert install options/start menu/<insert plugin name here> here
|
||||
FunctionEnd
|
||||
|
||||
Function dirImage
|
||||
!insertmacro BIMAGE "${NSISDIR}\Contrib\Graphics\Header\win.bmp" /RESIZETOFIT
|
||||
FunctionEnd
|
||||
|
||||
Function instImage
|
||||
!insertmacro BIMAGE "${NSISDIR}\Contrib\Graphics\Wizard\llama.bmp" /RESIZETOFIT
|
||||
FunctionEnd
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; Uninstall pages
|
||||
|
||||
UninstPage uninstConfirm un.uninstImage
|
||||
UninstPage custom un.customPage
|
||||
UninstPage instfiles un.instImage
|
||||
|
||||
Function un.uninstImage
|
||||
!insertmacro BIMAGE "${NSISDIR}\Contrib\Graphics\Checks\modern.bmp" /RESIZETOFIT
|
||||
FunctionEnd
|
||||
|
||||
Function un.customPage
|
||||
!insertmacro BIMAGE "${NSISDIR}\Contrib\Graphics\Header\win.bmp" /RESIZETOFIT
|
||||
MessageBox MB_OK 'This is a nice uninstaller custom "page" with yet another image :P'
|
||||
#insert install options/start menu/<insert plugin name here> here
|
||||
FunctionEnd
|
||||
|
||||
Function un.instImage
|
||||
!insertmacro BIMAGE "${NSISDIR}\Contrib\Graphics\Wizard\llama.bmp" /RESIZETOFIT
|
||||
FunctionEnd
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; Uninstaller
|
||||
|
||||
; Another page for uninstaller
|
||||
UninstallText "Another page..."
|
||||
|
||||
Section uninstall
|
||||
MessageBox MB_OK "Bla"
|
||||
SectionEnd
|
||||
|
191
KattekerCreator/nsis/Examples/languages.nsi
Normal file
191
KattekerCreator/nsis/Examples/languages.nsi
Normal file
@ -0,0 +1,191 @@
|
||||
; languages.nsi
|
||||
;
|
||||
; This is an example of a multilingual installer
|
||||
; The user can select the language on startup
|
||||
|
||||
!pragma warning error all
|
||||
|
||||
;--------------------------------
|
||||
|
||||
OutFile languages.exe
|
||||
|
||||
XPStyle on
|
||||
|
||||
RequestExecutionLevel user
|
||||
|
||||
;--------------------------------
|
||||
|
||||
Page license
|
||||
Page components
|
||||
Page instfiles
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; First is default
|
||||
LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf"
|
||||
LoadLanguageFile "${NSISDIR}\Contrib\Language files\Czech.nlf"
|
||||
LoadLanguageFile "${NSISDIR}\Contrib\Language files\Dutch.nlf"
|
||||
LoadLanguageFile "${NSISDIR}\Contrib\Language files\French.nlf"
|
||||
LoadLanguageFile "${NSISDIR}\Contrib\Language files\German.nlf"
|
||||
LoadLanguageFile "${NSISDIR}\Contrib\Language files\Korean.nlf"
|
||||
LoadLanguageFile "${NSISDIR}\Contrib\Language files\Russian.nlf"
|
||||
LoadLanguageFile "${NSISDIR}\Contrib\Language files\Spanish.nlf"
|
||||
LoadLanguageFile "${NSISDIR}\Contrib\Language files\Swedish.nlf"
|
||||
LoadLanguageFile "${NSISDIR}\Contrib\Language files\TradChinese.nlf"
|
||||
LoadLanguageFile "${NSISDIR}\Contrib\Language files\SimpChinese.nlf"
|
||||
LoadLanguageFile "${NSISDIR}\Contrib\Language files\Slovak.nlf"
|
||||
|
||||
; License data
|
||||
; Not exactly translated, but it shows what's needed
|
||||
LicenseLangString myLicenseData ${LANG_ENGLISH} "bigtest.nsi"
|
||||
LicenseLangString myLicenseData ${LANG_CZECH} "WordFuncTest.nsi"
|
||||
LicenseLangString myLicenseData ${LANG_DUTCH} "waplugin.nsi"
|
||||
LicenseLangString myLicenseData ${LANG_FRENCH} "example1.nsi"
|
||||
LicenseLangString myLicenseData ${LANG_GERMAN} "example2.nsi"
|
||||
LicenseLangString myLicenseData ${LANG_KOREAN} "gfx.nsi"
|
||||
LicenseLangString myLicenseData ${LANG_RUSSIAN} "languages.nsi"
|
||||
LicenseLangString myLicenseData ${LANG_SPANISH} "LogicLib.nsi"
|
||||
LicenseLangString myLicenseData ${LANG_SWEDISH} "makensis.nsi"
|
||||
LicenseLangString myLicenseData ${LANG_TRADCHINESE} "one-section.nsi"
|
||||
LicenseLangString myLicenseData ${LANG_SIMPCHINESE} "primes.nsi"
|
||||
LicenseLangString myLicenseData ${LANG_SLOVAK} "silent.nsi"
|
||||
|
||||
LicenseData $(myLicenseData)
|
||||
|
||||
; Set name using the normal interface (Name command)
|
||||
LangString Name ${LANG_ENGLISH} "English"
|
||||
LangString Name ${LANG_CZECH} "Czech"
|
||||
LangString Name ${LANG_DUTCH} "Dutch"
|
||||
LangString Name ${LANG_FRENCH} "French"
|
||||
LangString Name ${LANG_GERMAN} "German"
|
||||
LangString Name ${LANG_KOREAN} "Korean"
|
||||
LangString Name ${LANG_RUSSIAN} "Russian"
|
||||
LangString Name ${LANG_SPANISH} "Spanish"
|
||||
LangString Name ${LANG_SWEDISH} "Swedish"
|
||||
LangString Name ${LANG_TRADCHINESE} "Traditional Chinese"
|
||||
LangString Name ${LANG_SIMPCHINESE} "Simplified Chinese"
|
||||
LangString Name ${LANG_SLOVAK} "Slovak"
|
||||
|
||||
Name $(Name)
|
||||
|
||||
; Directly change the inner lang strings (Same as ComponentText)
|
||||
LangString ^ComponentsText ${LANG_ENGLISH} "English component page"
|
||||
LangString ^ComponentsText ${LANG_CZECH} "Czech component page"
|
||||
LangString ^ComponentsText ${LANG_DUTCH} "Dutch component page"
|
||||
LangString ^ComponentsText ${LANG_FRENCH} "French component page"
|
||||
LangString ^ComponentsText ${LANG_GERMAN} "German component page"
|
||||
LangString ^ComponentsText ${LANG_KOREAN} "Korean component page"
|
||||
LangString ^ComponentsText ${LANG_RUSSIAN} "Russian component page"
|
||||
LangString ^ComponentsText ${LANG_SPANISH} "Spanish component page"
|
||||
LangString ^ComponentsText ${LANG_SWEDISH} "Swedish component page"
|
||||
LangString ^ComponentsText ${LANG_TRADCHINESE} "Traditional Chinese component page"
|
||||
LangString ^ComponentsText ${LANG_SIMPCHINESE} "Simplified Chinese component page"
|
||||
LangString ^ComponentsText ${LANG_SLOVAK} "Slovak component page"
|
||||
|
||||
; Set one text for all languages (simply don't use a LangString)
|
||||
CompletedText "Languages example completed"
|
||||
|
||||
; A LangString for the section name
|
||||
LangString Sec1Name ${LANG_ENGLISH} "English section #1"
|
||||
LangString Sec1Name ${LANG_CZECH} "Czech section #1"
|
||||
LangString Sec1Name ${LANG_DUTCH} "Dutch section #1"
|
||||
LangString Sec1Name ${LANG_FRENCH} "French section #1"
|
||||
LangString Sec1Name ${LANG_GERMAN} "German section #1"
|
||||
LangString Sec1Name ${LANG_KOREAN} "Korean section #1"
|
||||
LangString Sec1Name ${LANG_RUSSIAN} "Russian section #1"
|
||||
LangString Sec1Name ${LANG_SPANISH} "Spanish section #1"
|
||||
LangString Sec1Name ${LANG_SWEDISH} "Swedish section #1"
|
||||
LangString Sec1Name ${LANG_TRADCHINESE} "Trandional Chinese section #1"
|
||||
LangString Sec1Name ${LANG_SIMPCHINESE} "Simplified Chinese section #1"
|
||||
LangString Sec1Name ${LANG_SLOVAK} "Slovak section #1"
|
||||
|
||||
; A multilingual message
|
||||
LangString Message ${LANG_ENGLISH} "English message"
|
||||
LangString Message ${LANG_CZECH} "Czech message"
|
||||
LangString Message ${LANG_DUTCH} "Dutch message"
|
||||
LangString Message ${LANG_FRENCH} "French message"
|
||||
LangString Message ${LANG_GERMAN} "German message"
|
||||
LangString Message ${LANG_KOREAN} "Korean message"
|
||||
LangString Message ${LANG_RUSSIAN} "Russian message"
|
||||
LangString Message ${LANG_SPANISH} "Spanish message"
|
||||
LangString Message ${LANG_SWEDISH} "Swedish message"
|
||||
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
|
||||
MessageBox MB_OK $(Message)
|
||||
SectionEnd
|
||||
|
||||
; The old, slow, wasteful way
|
||||
; Look at this section and see why LangString is so much easier
|
||||
Section "Section number two"
|
||||
StrCmp $LANGUAGE ${LANG_ENGLISH} 0 +2
|
||||
MessageBox MB_OK "Installing English stuff"
|
||||
StrCmp $LANGUAGE ${LANG_CZECH} 0 +2
|
||||
MessageBox MB_OK "Installing Czech stuff"
|
||||
StrCmp $LANGUAGE ${LANG_DUTCH} 0 +2
|
||||
MessageBox MB_OK "Installing Dutch stuff"
|
||||
StrCmp $LANGUAGE ${LANG_FRENCH} 0 +2
|
||||
MessageBox MB_OK "Installing French stuff"
|
||||
StrCmp $LANGUAGE ${LANG_GERMAN} 0 +2
|
||||
MessageBox MB_OK "Installing German stuff"
|
||||
StrCmp $LANGUAGE ${LANG_KOREAN} 0 +2
|
||||
MessageBox MB_OK "Installing Korean stuff"
|
||||
StrCmp $LANGUAGE ${LANG_RUSSIAN} 0 +2
|
||||
MessageBox MB_OK "Installing Russian stuff"
|
||||
StrCmp $LANGUAGE ${LANG_SPANISH} 0 +2
|
||||
MessageBox MB_OK "Installing Spanish stuff"
|
||||
StrCmp $LANGUAGE ${LANG_SWEDISH} 0 +2
|
||||
MessageBox MB_OK "Installing Swedish stuff"
|
||||
StrCmp $LANGUAGE ${LANG_TRADCHINESE} 0 +2
|
||||
MessageBox MB_OK "Installing Traditional Chinese stuff"
|
||||
StrCmp $LANGUAGE ${LANG_SIMPCHINESE} 0 +2
|
||||
MessageBox MB_OK "Installing Simplified Chinese stuff"
|
||||
StrCmp $LANGUAGE ${LANG_SLOVAK} 0 +2
|
||||
MessageBox MB_OK "Installing Slovak stuff"
|
||||
SectionEnd
|
||||
|
||||
;--------------------------------
|
||||
|
||||
Function .onInit
|
||||
|
||||
;Language selection dialog
|
||||
|
||||
Push ""
|
||||
Push ${LANG_ENGLISH}
|
||||
Push English
|
||||
Push ${LANG_CZECH}
|
||||
Push Czech
|
||||
Push ${LANG_DUTCH}
|
||||
Push Dutch
|
||||
Push ${LANG_FRENCH}
|
||||
Push French
|
||||
Push ${LANG_GERMAN}
|
||||
Push German
|
||||
Push ${LANG_KOREAN}
|
||||
Push Korean
|
||||
Push ${LANG_RUSSIAN}
|
||||
Push Russian
|
||||
Push ${LANG_SPANISH}
|
||||
Push Spanish
|
||||
Push ${LANG_SWEDISH}
|
||||
Push Swedish
|
||||
Push ${LANG_TRADCHINESE}
|
||||
Push "Traditional Chinese"
|
||||
Push ${LANG_SIMPCHINESE}
|
||||
Push "Simplified Chinese"
|
||||
Push ${LANG_SLOVAK}
|
||||
Push Slovak
|
||||
Push A ; A means auto count languages
|
||||
; for the auto count to work the first empty push (Push "") must remain
|
||||
LangDLL::LangDialog "Installer Language" "Please select the language of the installer"
|
||||
|
||||
Pop $LANGUAGE
|
||||
StrCmp $LANGUAGE "cancel" 0 +2
|
||||
Abort
|
||||
FunctionEnd
|
1107
KattekerCreator/nsis/Examples/makensis.nsi
Normal file
1107
KattekerCreator/nsis/Examples/makensis.nsi
Normal file
File diff suppressed because it is too large
Load Diff
47
KattekerCreator/nsis/Examples/nsDialogs/InstallOptions.nsi
Normal file
47
KattekerCreator/nsis/Examples/nsDialogs/InstallOptions.nsi
Normal file
@ -0,0 +1,47 @@
|
||||
!include LogicLib.nsh
|
||||
!include WinMessages.nsh
|
||||
|
||||
Name "nsDialogs IO"
|
||||
OutFile "nsDialogs IO.exe"
|
||||
|
||||
Page custom nsDialogsIO UpdateINIState
|
||||
Page instfiles
|
||||
|
||||
XPStyle on
|
||||
|
||||
ShowInstDetails show
|
||||
|
||||
!include nsDialogs.nsh
|
||||
!insertmacro NSD_FUNCTION_INIFILE
|
||||
|
||||
Function nsDialogsIO
|
||||
|
||||
InitPluginsDir
|
||||
File /oname=$PLUGINSDIR\io.ini "..\InstallOptions\test.ini"
|
||||
|
||||
${If} ${Cmd} `MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Test the right-to-left version?" IDYES`
|
||||
WriteINIStr $PLUGINSDIR\io.ini Settings RTL 1
|
||||
${EndIf}
|
||||
|
||||
StrCpy $0 $PLUGINSDIR\io.ini
|
||||
|
||||
Call CreateDialogFromINI
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Section
|
||||
|
||||
ReadINIStr $0 "$PLUGINSDIR\io.ini" "Field 2" "State"
|
||||
DetailPrint "Install X=$0"
|
||||
ReadINIStr $0 "$PLUGINSDIR\io.ini" "Field 3" "State"
|
||||
DetailPrint "Install Y=$0"
|
||||
ReadINIStr $0 "$PLUGINSDIR\io.ini" "Field 4" "State"
|
||||
DetailPrint "Install Z=$0"
|
||||
ReadINIStr $0 "$PLUGINSDIR\io.ini" "Field 5" "State"
|
||||
DetailPrint "File=$0"
|
||||
ReadINIStr $0 "$PLUGINSDIR\io.ini" "Field 6" "State"
|
||||
DetailPrint "Dir=$0"
|
||||
ReadINIStr $0 "$PLUGINSDIR\io.ini" "Field 8" "State"
|
||||
DetailPrint "Info=$0"
|
||||
|
||||
SectionEnd
|
220
KattekerCreator/nsis/Examples/nsDialogs/example.nsi
Normal file
220
KattekerCreator/nsis/Examples/nsDialogs/example.nsi
Normal file
@ -0,0 +1,220 @@
|
||||
!include nsDialogs.nsh
|
||||
!include LogicLib.nsh
|
||||
!include WinCore.nsh ; MAKELONG
|
||||
|
||||
Name "nsDialogs Example"
|
||||
OutFile "nsDialogs Example.exe"
|
||||
Caption "$(^Name)"
|
||||
|
||||
XPStyle on
|
||||
RequestExecutionLevel user
|
||||
|
||||
LicenseText "All the action takes place on the next page..." "Start"
|
||||
SubCaption 0 ": Ready?"
|
||||
|
||||
Page license
|
||||
Page custom nsDialogsPage
|
||||
Page custom LBPage
|
||||
Page custom RangesPage
|
||||
Page custom NotifyPage
|
||||
!pragma warning disable 8000 ; "Page instfiles not used, no sections will be executed!"
|
||||
|
||||
Var BUTTON
|
||||
Var EDIT
|
||||
Var CHECKBOX
|
||||
|
||||
Function nsDialogsPage
|
||||
nsDialogs::Create 1018
|
||||
Pop $0
|
||||
|
||||
GetFunctionAddress $0 OnBack
|
||||
nsDialogs::OnBack $0
|
||||
|
||||
${NSD_CreateButton} 0 0 100% 12u Test
|
||||
Pop $BUTTON
|
||||
GetFunctionAddress $0 OnClick
|
||||
nsDialogs::OnClick $BUTTON $0
|
||||
|
||||
${NSD_CreateText} 0 35 100% 12u hello
|
||||
Pop $EDIT
|
||||
GetFunctionAddress $0 OnChange
|
||||
nsDialogs::OnChange $EDIT $0
|
||||
${NSD_Edit_SetCueBannerText} $EDIT 0 "Type 'hello there' and get a free surprise"
|
||||
|
||||
${NSD_CreateCheckbox} 0 -50 100% 8u Test
|
||||
Pop $CHECKBOX
|
||||
GetFunctionAddress $0 OnCheckbox
|
||||
nsDialogs::OnClick $CHECKBOX $0
|
||||
|
||||
${NSD_CreateLabel} 0 40u 75% 40u "* Type `hello there` above.$\n* Click the button.$\n* Check the checkbox.$\n* Hit the Back button."
|
||||
Pop $0
|
||||
|
||||
nsDialogs::Show
|
||||
FunctionEnd
|
||||
|
||||
Function OnClick
|
||||
Pop $0 # HWND
|
||||
MessageBox MB_OK clicky
|
||||
FunctionEnd
|
||||
|
||||
Function OnChange
|
||||
Pop $0 # HWND
|
||||
|
||||
System::Call user32::GetWindowText(p$EDIT,t.r0,i${NSIS_MAX_STRLEN})
|
||||
${If} $0 == "hello there"
|
||||
MessageBox MB_OK "right back at ya"
|
||||
${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
Function OnBack
|
||||
MessageBox MB_YESNO "are you sure?" IDYES +2
|
||||
Abort
|
||||
FunctionEnd
|
||||
|
||||
Function OnCheckbox
|
||||
Pop $0 # HWND
|
||||
MessageBox MB_OK "checkbox clicked"
|
||||
FunctionEnd
|
||||
|
||||
!macro BeginControlsTestPage title
|
||||
nsDialogs::Create 1018
|
||||
Pop $0
|
||||
${NSD_SetText} $hWndParent "$(^Name): ${title}"
|
||||
!macroend
|
||||
|
||||
!macro CreateButton x y w h txt var handler data
|
||||
${NSD_CreateButton} ${x} ${y} ${w} ${h} "${txt}"
|
||||
Pop ${var}
|
||||
nsDialogs::SetUserData ${var} ${data}
|
||||
${NSD_OnClick} ${var} ${handler}
|
||||
!macroend
|
||||
|
||||
|
||||
Function LBPage
|
||||
!insertmacro BeginControlsTestPage "ListBox"
|
||||
|
||||
${NSD_CreateSortedListBox} 1u 0 -2u 70u ""
|
||||
Pop $1
|
||||
${NSD_LB_AddString} $1 "Foo"
|
||||
${NSD_LB_AddString} $1 "Bar"
|
||||
|
||||
StrCpy $9 1
|
||||
${NSD_CreateText} 1u 75u -2u 12u "New item #$9"
|
||||
Pop $EDIT
|
||||
!insertmacro CreateButton 1u 90u 50u 12u "Add (&Sorted)" $0 LBAction Add
|
||||
!insertmacro CreateButton 53u 90u 50u 12u "&Prepend" $0 LBAction Prepend
|
||||
!insertmacro CreateButton 105u 90u 50u 12u "&Append" $0 LBAction Append
|
||||
!insertmacro CreateButton 160u 90u 50u 12u "&Delete Last" $0 LBAction DL
|
||||
!insertmacro CreateButton 215u 90u 50u 12u "&Clear" $0 LBAction Clear
|
||||
|
||||
nsDialogs::Show
|
||||
FunctionEnd
|
||||
|
||||
Function LBAction
|
||||
Pop $0
|
||||
nsDialogs::GetUserData $0
|
||||
Pop $0
|
||||
${NSD_GetText} $EDIT $8
|
||||
|
||||
${Select} $0
|
||||
${Case} "Add"
|
||||
${NSD_LB_AddString} $1 $8
|
||||
${Case} "Prepend"
|
||||
${NSD_LB_PrependString} $1 $8
|
||||
${Case} "Append"
|
||||
${NSD_LB_AppendString} $1 $8
|
||||
${Case} "DL"
|
||||
${NSD_LB_GetCount} $1 $8
|
||||
${If} $8 U> 0
|
||||
IntOp $8 $8 - 1
|
||||
${NSD_LB_DelItem} $1 $8
|
||||
${EndIf}
|
||||
Return
|
||||
${Case} "Clear"
|
||||
${NSD_LB_Clear} $1
|
||||
Return
|
||||
${EndSelect}
|
||||
|
||||
IntOp $9 $9 + 1
|
||||
${NSD_SetText} $EDIT "New item #$9"
|
||||
FunctionEnd
|
||||
|
||||
|
||||
Function RangesPage
|
||||
!insertmacro BeginControlsTestPage "Ranges"
|
||||
|
||||
${NSD_CreateHTrackBar} 1 0 -2 20u ""
|
||||
Pop $1
|
||||
${NSD_TrackBar_SetRangeMax} $1 10
|
||||
${NSD_TrackBar_SetTicFreq} $1 1
|
||||
${NSD_TrackBar_SetPos} $1 3
|
||||
|
||||
StrCpy $9 20 ; Progress pos
|
||||
${NSD_CreateProgressBar} 1 25u -2 8u ""
|
||||
Pop $2
|
||||
${NSD_CreateTimer} RangesTimer 1000
|
||||
|
||||
${NSD_CreateNumber} 1 40u 50u 12u "42"
|
||||
Pop $3
|
||||
${NSD_CreateUpDown} 0 0 0 0 ""
|
||||
Pop $4
|
||||
${NSD_UD_SetBuddy} $4 $3
|
||||
${MAKELONG} $5 $0 50 0 ; 0..50
|
||||
${NSD_UD_SetPackedRange} $4 $5
|
||||
|
||||
nsDialogs::Show
|
||||
FunctionEnd
|
||||
|
||||
Function RangesTimer
|
||||
IntOp $9 $9 + 5
|
||||
${IfThen} $9 > 100 ${|} StrCpy $9 0 ${|}
|
||||
${NSD_ProgressBar_SetPos} $2 $9
|
||||
FunctionEnd
|
||||
|
||||
|
||||
Function NotifyPage
|
||||
!insertmacro BeginControlsTestPage "WM_NOTIFY"
|
||||
|
||||
${NSD_CreateRichEdit} 1 1 -2 -2 ""
|
||||
Pop $9
|
||||
${NSD_OnNotify} $9 OnNotify
|
||||
IntOp $8 ${ENM_LINK} | ${ENM_KEYEVENTS}
|
||||
${NSD_RichEd_SetEventMask} $9 $8
|
||||
SendMessage $9 ${EM_AUTOURLDETECT} 1 0
|
||||
${NSD_SetText} $9 "{\rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0\pard http://nsis.sf.net\par {\b Click the link!}\par\par Type something and I will block every other character...}"
|
||||
|
||||
nsDialogs::Show
|
||||
FunctionEnd
|
||||
|
||||
Function OnNotify
|
||||
Pop $1 ; HWND
|
||||
Pop $2 ; Code
|
||||
Pop $3 ; NMHDR*
|
||||
${If} $2 = ${EN_LINK}
|
||||
System::Call '*$3(p,p,p,p.r2,p,p,i.r4,i.r5)' ; Extract from ENLINK*
|
||||
${IfThen} $2 <> ${WM_LBUTTONDOWN} ${|} Return ${|}
|
||||
IntOp $2 $5 - $4
|
||||
System::Call '*(ir4,ir5,l,&t$2,i)p.r2' ; Create TEXTRANGE and a text buffer
|
||||
${If} $2 P<> 0
|
||||
IntPtrOp $3 $2 + 16 ; Find buffer
|
||||
System::Call '*$2(i,i,p$3)' ; Set buffer in TEXTRANGE
|
||||
SendMessage $1 ${EM_GETTEXTRANGE} "" $2 $4
|
||||
${If} $4 <> 0
|
||||
System::Call 'SHELL32::ShellExecute(p$hWndParent, p0, pr3, p0, p0, i 1)'
|
||||
${EndIf}
|
||||
System::Free $2
|
||||
${EndIf}
|
||||
${ElseIf} $2 = ${EN_MSGFILTER}
|
||||
Var /Global Toggle
|
||||
System::Call '*$3(p,i,i,i.r4)' ; MSGFILTER->msg
|
||||
${If} $4 = ${WM_CHAR}
|
||||
IntOp $Toggle $Toggle ^ 1
|
||||
${If} $Toggle & 1
|
||||
${NSD_Return} 1
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
Section
|
||||
SectionEnd
|
107
KattekerCreator/nsis/Examples/nsDialogs/timer.nsi
Normal file
107
KattekerCreator/nsis/Examples/nsDialogs/timer.nsi
Normal file
@ -0,0 +1,107 @@
|
||||
!include LogicLib.nsh
|
||||
!include nsDialogs.nsh
|
||||
!include WinMessages.nsh
|
||||
|
||||
Name "nsDialogs Timer Example"
|
||||
OutFile "nsDialogs Timer Example.exe"
|
||||
XPStyle on
|
||||
RequestExecutionLevel user
|
||||
|
||||
Var DIALOG
|
||||
Var TEXT
|
||||
Var PROGBAR
|
||||
Var PROGBAR2
|
||||
Var PROGBAR3
|
||||
Var BUTTON
|
||||
Var BUTTON2
|
||||
|
||||
Page custom nsDialogsPage
|
||||
!pragma warning disable 8000 ; "Page instfiles not used, no sections will be executed!"
|
||||
|
||||
Function OnTimer
|
||||
|
||||
SendMessage $PROGBAR ${PBM_GETPOS} 0 0 $1
|
||||
${If} $1 = 100
|
||||
SendMessage $PROGBAR ${PBM_SETPOS} 0 0
|
||||
${Else}
|
||||
SendMessage $PROGBAR ${PBM_DELTAPOS} 10 0
|
||||
${EndIf}
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function OnTimer2
|
||||
|
||||
SendMessage $PROGBAR2 ${PBM_GETPOS} 0 0 $1
|
||||
${If} $1 = 100
|
||||
SendMessage $PROGBAR2 ${PBM_SETPOS} 0 0
|
||||
${Else}
|
||||
SendMessage $PROGBAR2 ${PBM_DELTAPOS} 5 0
|
||||
${EndIf}
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function OnTimer3
|
||||
|
||||
SendMessage $PROGBAR3 ${PBM_GETPOS} 0 0 $1
|
||||
${If} $1 >= 100
|
||||
${NSD_KillTimer} OnTimer3
|
||||
MessageBox MB_OK "Timer 3 killed"
|
||||
${Else}
|
||||
SendMessage $PROGBAR3 ${PBM_DELTAPOS} 2 0
|
||||
${EndIf}
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function OnClick
|
||||
|
||||
Pop $0
|
||||
|
||||
${NSD_KillTimer} OnTimer
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function OnClick2
|
||||
|
||||
Pop $0
|
||||
|
||||
${NSD_KillTimer} OnTimer2
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function nsDialogsPage
|
||||
|
||||
nsDialogs::Create 1018
|
||||
Pop $DIALOG
|
||||
|
||||
${NSD_CreateLabel} 0u 0u 100% 9u "nsDialogs timer example"
|
||||
Pop $TEXT
|
||||
|
||||
${NSD_CreateProgressBar} 0u 10u 100% 12u ""
|
||||
Pop $PROGBAR
|
||||
|
||||
${NSD_CreateButton} 0u 25u 100u 14u "Kill Timer 1"
|
||||
Pop $BUTTON
|
||||
${NSD_OnClick} $BUTTON OnClick
|
||||
|
||||
${NSD_CreateProgressBar} 0u 52u 100% 12u ""
|
||||
Pop $PROGBAR2
|
||||
SendMessage $PROGBAR2 ${PBM_SETBARCOLOR} 0 0x0000FF ; No visual styles
|
||||
SendMessage $PROGBAR2 ${PBM_SETSTATE} ${PBST_ERROR} 0 ; Vista+
|
||||
|
||||
${NSD_CreateButton} 0u 67u 100u 14u "Kill Timer 2"
|
||||
Pop $BUTTON2
|
||||
${NSD_OnClick} $BUTTON2 OnClick2
|
||||
|
||||
${NSD_CreateProgressBar} 0u 114u 100% 12u ""
|
||||
Pop $PROGBAR3
|
||||
|
||||
${NSD_CreateTimer} OnTimer 1000
|
||||
${NSD_CreateTimer} OnTimer2 100
|
||||
${NSD_CreateTimer} OnTimer3 200
|
||||
|
||||
nsDialogs::Show
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Section
|
||||
SectionEnd
|
214
KattekerCreator/nsis/Examples/nsDialogs/welcome.nsi
Normal file
214
KattekerCreator/nsis/Examples/nsDialogs/welcome.nsi
Normal file
@ -0,0 +1,214 @@
|
||||
!include MUI.nsh
|
||||
!include LogicLib.nsh
|
||||
!include nsDialogs.nsh
|
||||
!include WinMessages.nsh
|
||||
!include FileFunc.nsh
|
||||
|
||||
Name "nsDialogs Welcome"
|
||||
OutFile "nsDialogs Welcome.exe"
|
||||
|
||||
Page custom nsDialogsWelcome
|
||||
Page custom nsDialogsDirectory
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
|
||||
!insertmacro MUI_LANGUAGE English
|
||||
|
||||
|
||||
Var DIALOG
|
||||
Var HEADLINE
|
||||
Var TEXT
|
||||
Var IMAGECTL
|
||||
Var IMAGE
|
||||
Var DIRECTORY
|
||||
Var FREESPACE
|
||||
|
||||
Var HEADLINE_FONT
|
||||
|
||||
Function .onInit
|
||||
|
||||
CreateFont $HEADLINE_FONT "$(^Font)" "14" "700"
|
||||
|
||||
InitPluginsDir
|
||||
File /oname=$PLUGINSDIR\welcome.bmp "${NSISDIR}\Contrib\Graphics\Wizard\orange-nsis.bmp"
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function HideControls
|
||||
|
||||
LockWindow on
|
||||
GetDlgItem $0 $HWNDPARENT 1028
|
||||
ShowWindow $0 ${SW_HIDE}
|
||||
|
||||
GetDlgItem $0 $HWNDPARENT 1256
|
||||
ShowWindow $0 ${SW_HIDE}
|
||||
|
||||
GetDlgItem $0 $HWNDPARENT 1035
|
||||
ShowWindow $0 ${SW_HIDE}
|
||||
|
||||
GetDlgItem $0 $HWNDPARENT 1037
|
||||
ShowWindow $0 ${SW_HIDE}
|
||||
|
||||
GetDlgItem $0 $HWNDPARENT 1038
|
||||
ShowWindow $0 ${SW_HIDE}
|
||||
|
||||
GetDlgItem $0 $HWNDPARENT 1039
|
||||
ShowWindow $0 ${SW_HIDE}
|
||||
|
||||
GetDlgItem $0 $HWNDPARENT 1045
|
||||
ShowWindow $0 ${SW_NORMAL}
|
||||
LockWindow off
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function ShowControls
|
||||
|
||||
LockWindow on
|
||||
GetDlgItem $0 $HWNDPARENT 1028
|
||||
ShowWindow $0 ${SW_NORMAL}
|
||||
|
||||
GetDlgItem $0 $HWNDPARENT 1256
|
||||
ShowWindow $0 ${SW_NORMAL}
|
||||
|
||||
GetDlgItem $0 $HWNDPARENT 1035
|
||||
ShowWindow $0 ${SW_NORMAL}
|
||||
|
||||
GetDlgItem $0 $HWNDPARENT 1037
|
||||
ShowWindow $0 ${SW_NORMAL}
|
||||
|
||||
GetDlgItem $0 $HWNDPARENT 1038
|
||||
ShowWindow $0 ${SW_NORMAL}
|
||||
|
||||
GetDlgItem $0 $HWNDPARENT 1039
|
||||
ShowWindow $0 ${SW_NORMAL}
|
||||
|
||||
GetDlgItem $0 $HWNDPARENT 1045
|
||||
ShowWindow $0 ${SW_HIDE}
|
||||
LockWindow off
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function nsDialogsWelcome
|
||||
|
||||
nsDialogs::Create 1044
|
||||
Pop $DIALOG
|
||||
|
||||
nsDialogs::CreateControl STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${SS_BITMAP} 0 0 0 109u 193u ""
|
||||
Pop $IMAGECTL
|
||||
|
||||
StrCpy $0 $PLUGINSDIR\welcome.bmp
|
||||
System::Call 'user32::LoadImage(p 0, t r0, i ${IMAGE_BITMAP}, i 0, i 0, i ${LR_LOADFROMFILE})p.s'
|
||||
Pop $IMAGE
|
||||
|
||||
SendMessage $IMAGECTL ${STM_SETIMAGE} ${IMAGE_BITMAP} $IMAGE
|
||||
|
||||
nsDialogs::CreateControl STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 120u 10u -130u 20u "Welcome to nsDialogs!"
|
||||
Pop $HEADLINE
|
||||
|
||||
SendMessage $HEADLINE ${WM_SETFONT} $HEADLINE_FONT 0
|
||||
|
||||
nsDialogs::CreateControl STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 120u 32u -130u -32u "nsDialogs is the next generation of user interfaces in NSIS. It gives the developer full control over custom pages. Some of the features include control text containing variables, callbacks directly into script functions and creation of any type of control. Create boring old edit boxes or load some external library and create custom controls with no need of creating your own plug-in.$\r$\n$\r$\nUnlike InstallOptions, nsDialogs doesn't use INI files to communicate with the script. By interacting directly with the script, nsDialogs can perform much faster without the need of costly, old and inefficient INI operations. Direct interaction also allows direct calls to functions defined in the script and removes the need of conversion functions like Io2Nsis.$\r$\n$\r$\nHit the Next button to see how it all fits into a mock directory page."
|
||||
Pop $TEXT
|
||||
|
||||
SetCtlColors $DIALOG 0 0xffffff
|
||||
SetCtlColors $HEADLINE 0 0xffffff
|
||||
SetCtlColors $TEXT 0 0xffffff
|
||||
|
||||
Call HideControls
|
||||
|
||||
nsDialogs::Show
|
||||
|
||||
Call ShowControls
|
||||
|
||||
System::Call gdi32::DeleteObject(p$IMAGE)
|
||||
|
||||
FunctionEnd
|
||||
|
||||
!define SHACF_FILESYSTEM 1
|
||||
|
||||
Function nsDialogsDirectory
|
||||
|
||||
!insertmacro MUI_HEADER_TEXT "Choose Install Location" "Choose the folder in which to install $(^NameDA)."
|
||||
|
||||
GetDlgItem $0 $HWNDPARENT 1
|
||||
EnableWindow $0 0
|
||||
|
||||
nsDialogs::Create 1018
|
||||
Pop $DIALOG
|
||||
|
||||
nsDialogs::CreateControl STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${SS_CENTER} 0 0 0 100% 30 "Directory page"
|
||||
Pop $HEADLINE
|
||||
|
||||
SendMessage $HEADLINE ${WM_SETFONT} $HEADLINE_FONT 0
|
||||
|
||||
nsDialogs::CreateControl STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 0 30 100% 40 "Select the installation directory of NSIS to continue. $_CLICK"
|
||||
Pop $TEXT
|
||||
|
||||
nsDialogs::CreateControl EDIT ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${ES_AUTOHSCROLL}|${WS_TABSTOP} ${WS_EX_CLIENTEDGE} 0 75 100% 12u ""
|
||||
Pop $DIRECTORY
|
||||
|
||||
SendMessage $HWNDPARENT ${WM_NEXTDLGCTL} $DIRECTORY 1
|
||||
|
||||
GetFunctionAddress $0 DirChange
|
||||
nsDialogs::OnChange $DIRECTORY $0
|
||||
|
||||
System::Call shlwapi::SHAutoComplete(p$DIRECTORY,i${SHACF_FILESYSTEM})
|
||||
|
||||
nsDialogs::CreateControl STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 0 -10u 100% 10u ""
|
||||
Pop $FREESPACE
|
||||
|
||||
Call UpdateFreeSpace
|
||||
|
||||
nsDialogs::Show
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function UpdateFreeSpace
|
||||
|
||||
${GetRoot} $INSTDIR $0
|
||||
StrCpy $1 " bytes"
|
||||
|
||||
System::Call kernel32::GetDiskFreeSpaceEx(tr0,*l,*l,*l.r0)
|
||||
|
||||
${If} $0 > 1024
|
||||
${OrIf} $0 < 0
|
||||
System::Int64Op $0 / 1024
|
||||
Pop $0
|
||||
StrCpy $1 "kb"
|
||||
${If} $0 > 1024
|
||||
${OrIf} $0 < 0
|
||||
System::Int64Op $0 / 1024
|
||||
Pop $0
|
||||
StrCpy $1 "mb"
|
||||
${If} $0 > 1024
|
||||
${OrIf} $0 < 0
|
||||
System::Int64Op $0 / 1024
|
||||
Pop $0
|
||||
StrCpy $1 "gb"
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
|
||||
SendMessage $FREESPACE ${WM_SETTEXT} 0 "STR:Free space: $0$1"
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function DirChange
|
||||
|
||||
Pop $0 # dir hwnd
|
||||
|
||||
GetDlgItem $0 $HWNDPARENT 1
|
||||
|
||||
System::Call user32::GetWindowText(p$DIRECTORY,t.d,i${NSIS_MAX_STRLEN})
|
||||
|
||||
${If} ${FileExists} $INSTDIR\makensis.exe
|
||||
EnableWindow $0 1
|
||||
${Else}
|
||||
EnableWindow $0 0
|
||||
${EndIf}
|
||||
|
||||
Call UpdateFreeSpace
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Section
|
||||
SectionEnd
|
31
KattekerCreator/nsis/Examples/nsExec/test.nsi
Normal file
31
KattekerCreator/nsis/Examples/nsExec/test.nsi
Normal file
@ -0,0 +1,31 @@
|
||||
Name "nsExec Test"
|
||||
|
||||
OutFile "nsExec Test.exe"
|
||||
|
||||
ShowInstDetails show
|
||||
|
||||
Section "Silent MakeNSIS"
|
||||
nsExec::Exec '"${NSISDIR}\makensis.exe"'
|
||||
Pop $0 # return value/error/timeout
|
||||
DetailPrint ""
|
||||
DetailPrint " Return value: $0"
|
||||
DetailPrint ""
|
||||
SectionEnd
|
||||
|
||||
Section "MakeNSIS commands help"
|
||||
nsExec::ExecToLog '"${NSISDIR}\makensis.exe" /CMDHELP'
|
||||
Pop $0 # return value/error/timeout
|
||||
DetailPrint ""
|
||||
DetailPrint " Return value: $0"
|
||||
DetailPrint ""
|
||||
SectionEnd
|
||||
|
||||
Section "Output to variable"
|
||||
nsExec::ExecToStack '"${NSISDIR}\makensis.exe" /VERSION'
|
||||
Pop $0 # return value/error/timeout
|
||||
Pop $1 # printed text, up to ${NSIS_MAX_STRLEN}
|
||||
DetailPrint '"${NSISDIR}\makensis.exe" /VERSION printed: $1'
|
||||
DetailPrint ""
|
||||
DetailPrint " Return value: $0"
|
||||
DetailPrint ""
|
||||
SectionEnd
|
80
KattekerCreator/nsis/Examples/one-section.nsi
Normal file
80
KattekerCreator/nsis/Examples/one-section.nsi
Normal file
@ -0,0 +1,80 @@
|
||||
; one-section.nsi
|
||||
;
|
||||
; This example demonstrates how to control section selection.
|
||||
; It allows only one of the sections of a group to be selected.
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; Section define/macro header file
|
||||
; See this header file for more info
|
||||
|
||||
!include "Sections.nsh"
|
||||
|
||||
;--------------------------------
|
||||
|
||||
Name "One Section"
|
||||
OutFile "one-section.exe"
|
||||
RequestExecutionLevel user
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; Pages
|
||||
|
||||
Page Components
|
||||
Page InstFiles
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; Sections
|
||||
|
||||
Section !Required
|
||||
SectionIn RO
|
||||
SectionEnd
|
||||
|
||||
Section "Group 1 - Option 1" g1o1
|
||||
SectionEnd
|
||||
|
||||
Section /o "Group 1 - Option 2" g1o2
|
||||
SectionEnd
|
||||
|
||||
Section /o "Group 1 - Option 3" g1o3
|
||||
SectionEnd
|
||||
|
||||
Section "Group 2 - Option 1" g2o1
|
||||
SectionEnd
|
||||
|
||||
Section /o "Group 2 - Option 2" g2o2
|
||||
SectionEnd
|
||||
|
||||
Section /o "Group 2 - Option 3" g2o3
|
||||
SectionEnd
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; Functions
|
||||
|
||||
; $1 stores the status of group 1
|
||||
; $2 stores the status of group 2
|
||||
|
||||
Function .onInit
|
||||
|
||||
StrCpy $1 ${g1o1} ; Group 1 - Option 1 is selected by default
|
||||
StrCpy $2 ${g2o1} ; Group 2 - Option 1 is selected by default
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function .onSelChange
|
||||
|
||||
!insertmacro StartRadioButtons $1
|
||||
!insertmacro RadioButton ${g1o1}
|
||||
!insertmacro RadioButton ${g1o2}
|
||||
!insertmacro RadioButton ${g1o3}
|
||||
!insertmacro EndRadioButtons
|
||||
|
||||
!insertmacro StartRadioButtons $2
|
||||
!insertmacro RadioButton ${g2o1}
|
||||
!insertmacro RadioButton ${g2o2}
|
||||
!insertmacro RadioButton ${g2o3}
|
||||
!insertmacro EndRadioButtons
|
||||
|
||||
FunctionEnd
|
70
KattekerCreator/nsis/Examples/primes.nsi
Normal file
70
KattekerCreator/nsis/Examples/primes.nsi
Normal file
@ -0,0 +1,70 @@
|
||||
; 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"
|
||||
Caption "Prime number generator"
|
||||
ShowInstDetails show
|
||||
AllowRootDirInstall true
|
||||
InstallDir "$EXEDIR"
|
||||
RequestExecutionLevel user
|
||||
|
||||
DirText "Select a directory to write primes.txt. $_CLICK"
|
||||
|
||||
;--------------------------------
|
||||
|
||||
;Pages
|
||||
|
||||
Page directory
|
||||
Page instfiles
|
||||
|
||||
;--------------------------------
|
||||
|
||||
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
|
||||
!define PCNT $3 ; count of how many we've printed
|
||||
FileOpen $9 $INSTDIR\primes.txt w
|
||||
|
||||
DetailPrint "2 is prime!"
|
||||
FileWrite $9 "2 is prime!$\r$\n"
|
||||
DetailPrint "3 is prime!"
|
||||
FileWrite $9 "3 is prime!$\r$\n"
|
||||
Strcpy ${PPOS} 3
|
||||
Strcpy ${PCNT} 2
|
||||
outerloop:
|
||||
StrCpy ${PDIV} 3
|
||||
innerloop:
|
||||
IntOp ${PMOD} ${PPOS} % ${PDIV}
|
||||
IntCmp ${PMOD} 0 notprime
|
||||
IntOp ${PDIV} ${PDIV} + 2
|
||||
IntCmp ${PDIV} ${PPOS} 0 innerloop 0
|
||||
DetailPrint "${PPOS} is prime!"
|
||||
FileWrite $9 "${PPOS} is prime!$\r$\n"
|
||||
IntOp ${PCNT} ${PCNT} + 1
|
||||
IntCmp ${PCNT} 100 0 innerloop
|
||||
StrCpy ${PCNT} 0
|
||||
MessageBox MB_YESNO "Process more?" IDNO stop
|
||||
notprime:
|
||||
IntOp ${PPOS} ${PPOS} + 2
|
||||
Goto outerloop
|
||||
stop:
|
||||
FileClose $9
|
||||
|
||||
FunctionEnd
|
93
KattekerCreator/nsis/Examples/rtest.nsi
Normal file
93
KattekerCreator/nsis/Examples/rtest.nsi
Normal file
@ -0,0 +1,93 @@
|
||||
; rtest.nsi
|
||||
;
|
||||
; This script tests some advanced NSIS functions.
|
||||
|
||||
;--------------------------------
|
||||
|
||||
Name "rtest"
|
||||
OutFile "rtest.exe"
|
||||
|
||||
ComponentText "Select tests!"
|
||||
ShowInstDetails show
|
||||
|
||||
RequestExecutionLevel user
|
||||
|
||||
;--------------------------------
|
||||
|
||||
Section "Test 1"
|
||||
|
||||
StrCpy $R0 "a"
|
||||
|
||||
GetFunctionAddress $R1 test1
|
||||
Call $R1
|
||||
|
||||
StrCmp $R0 "a182345678" success
|
||||
|
||||
DetailPrint "Test 1 failed (output: $R0)"
|
||||
Goto end
|
||||
|
||||
success:
|
||||
DetailPrint "Test 1 succeeded (output: $R0)"
|
||||
|
||||
end:
|
||||
|
||||
SectionEnd
|
||||
|
||||
Function test1
|
||||
|
||||
GetLabelAddress $9 skip
|
||||
|
||||
IntOp $9 $9 - 1
|
||||
StrCpy $R0 $R01
|
||||
|
||||
Call $9
|
||||
|
||||
StrCpy $R0 $R02
|
||||
StrCpy $R0 $R03
|
||||
StrCpy $R0 $R04
|
||||
StrCpy $R0 $R05
|
||||
StrCpy $R0 $R06
|
||||
StrCpy $R0 $R07
|
||||
StrCpy $R0 $R08
|
||||
|
||||
skip:
|
||||
|
||||
FunctionEnd
|
||||
|
||||
;--------------------------------
|
||||
|
||||
Section "Test 2"
|
||||
|
||||
StrCpy $R0 "0"
|
||||
StrCpy $R1 "11"
|
||||
|
||||
Call test2
|
||||
|
||||
StrCmp $R1 "11,10,9,8,7,6,5,4,3,2,1" success
|
||||
|
||||
DetailPrint "Test 2 failed (output: $R1)"
|
||||
Goto end
|
||||
|
||||
success:
|
||||
DetailPrint "Test 2 succeeded (output: $R1)"
|
||||
|
||||
end:
|
||||
|
||||
SectionEnd
|
||||
|
||||
Function test2
|
||||
|
||||
IntOp $R0 $R0 + 1
|
||||
IntCmp $R0 10 done
|
||||
|
||||
Push $R0
|
||||
|
||||
GetFunctionAddress $R2 test2
|
||||
Call $R2
|
||||
|
||||
Pop $R0
|
||||
|
||||
done:
|
||||
StrCpy $R1 "$R1,$R0"
|
||||
|
||||
FunctionEnd
|
63
KattekerCreator/nsis/Examples/silent.nsi
Normal file
63
KattekerCreator/nsis/Examples/silent.nsi
Normal file
@ -0,0 +1,63 @@
|
||||
# This example shows how to handle silent installers.
|
||||
# In short, you need IfSilent and the /SD switch for MessageBox to make your installer
|
||||
# really silent when the /S switch is used.
|
||||
|
||||
Name "Silent"
|
||||
OutFile "silent.exe"
|
||||
RequestExecutionLevel user
|
||||
|
||||
# uncomment the following line to make the installer silent by default.
|
||||
; SilentInstall silent
|
||||
|
||||
Function .onInit
|
||||
# `/SD IDYES' tells MessageBox to automatically choose IDYES if the installer is silent
|
||||
# in this case, the installer can only be silent if the user used the /S switch or if
|
||||
# you've uncommented line number 5
|
||||
MessageBox MB_YESNO|MB_ICONQUESTION "Would you like the installer to be silent from now on?" \
|
||||
/SD IDYES IDNO no IDYES yes
|
||||
|
||||
# SetSilent can only be used in .onInit and doesn't work well along with `SetSilent silent'
|
||||
|
||||
yes:
|
||||
SetSilent silent
|
||||
Goto done
|
||||
no:
|
||||
SetSilent normal
|
||||
done:
|
||||
FunctionEnd
|
||||
|
||||
Section
|
||||
IfSilent 0 +2
|
||||
MessageBox MB_OK|MB_ICONINFORMATION 'This is a "silent" installer'
|
||||
|
||||
# there is no need to use IfSilent for this one because the /SD switch takes care of that
|
||||
MessageBox MB_OK|MB_ICONINFORMATION "This is not a silent installer" /SD IDOK
|
||||
|
||||
# when `SetOverwrite on' (which is the default) is used, the installer will show a message
|
||||
# if it can't open a file for writing. On silent installers, the ignore option will be
|
||||
# automatically selected. if `AllowSkipFiles off' (default is on) was used, there is no
|
||||
# ignore option and the cancel option will be automatically selected.
|
||||
|
||||
# on is default
|
||||
; AllowSkipFiles on
|
||||
|
||||
# lock file
|
||||
FileOpen $0 $TEMP\silentOverwrite w
|
||||
# try to extract - will fail
|
||||
File /oname=$TEMP\silentOverwrite silent.nsi
|
||||
# unlcok
|
||||
FileClose $0
|
||||
|
||||
# this will always show on silent installers because ignore is the option automatically
|
||||
# selected when a file can't be opened for writing on a silent installer
|
||||
MessageBox MB_OK|MB_ICONINFORMATION "This message box always shows if the installer is silent"
|
||||
|
||||
AllowSkipFiles off
|
||||
|
||||
# lock file
|
||||
FileOpen $0 $TEMP\silentOverwrite w
|
||||
# try to extract - will fail
|
||||
File /oname=$TEMP\silentOverwrite silent.nsi
|
||||
# unlcok
|
||||
FileClose $0
|
||||
SectionEnd
|
30
KattekerCreator/nsis/Examples/unicode.nsi
Normal file
30
KattekerCreator/nsis/Examples/unicode.nsi
Normal file
@ -0,0 +1,30 @@
|
||||
; unicode is not enabled by default
|
||||
; unicode installers will not be able to run on Windows 9x!
|
||||
Unicode true
|
||||
|
||||
Name "Unicode Games"
|
||||
OutFile "unicode.exe"
|
||||
|
||||
ShowInstDetails show
|
||||
|
||||
XPStyle on
|
||||
|
||||
Section "Unicode in UI"
|
||||
|
||||
DetailPrint "Hello World!"
|
||||
DetailPrint "שלום עולם!"
|
||||
DetailPrint "مرحبا العالم!"
|
||||
DetailPrint "こんにちは、世界!"
|
||||
DetailPrint "你好世界!"
|
||||
DetailPrint "привет мир!"
|
||||
DetailPrint "안녕하세요!"
|
||||
|
||||
DetailPrint "${U+00A9}" # arbitrary unicode chars
|
||||
|
||||
SectionEnd
|
||||
|
||||
Section "Unicode in Files"
|
||||
|
||||
# TODO add file I/O unicode function examples
|
||||
|
||||
SectionEnd
|
53
KattekerCreator/nsis/Examples/viewhtml.nsi
Normal file
53
KattekerCreator/nsis/Examples/viewhtml.nsi
Normal file
@ -0,0 +1,53 @@
|
||||
; viewhtml.nsi
|
||||
;
|
||||
; 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"
|
||||
|
||||
; Set to silent mode
|
||||
SilentInstall silent
|
||||
|
||||
; The file to write
|
||||
OutFile "viewhtml.exe"
|
||||
|
||||
; Request application privileges for Windows Vista
|
||||
RequestExecutionLevel user
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; The stuff to install
|
||||
Section ""
|
||||
|
||||
; Get a temporary filename (in the Windows Temp directory)
|
||||
GetTempFileName $R0
|
||||
|
||||
; Extract file
|
||||
; Lets skip this one, it's not built to be showin in IE
|
||||
; File /oname=$R0 "..\Menu\compiler.html"
|
||||
; and write our own! :)
|
||||
FileOpen $0 $R0 "w"
|
||||
FileWrite $0 "<HTML><BODY><H1>HTML page for viewhtml.nsi</H1></BODY></HTML>"
|
||||
FileClose $0
|
||||
|
||||
; View file
|
||||
ExecWait '"$PROGRAMFILES\Internet Explorer\iexplore.exe" "$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.
|
||||
;
|
||||
|
||||
; Delete the files (on reboot if file is in use)
|
||||
Delete /REBOOTOK $R0
|
||||
|
||||
SectionEnd
|
205
KattekerCreator/nsis/Examples/waplugin.nsi
Normal file
205
KattekerCreator/nsis/Examples/waplugin.nsi
Normal file
@ -0,0 +1,205 @@
|
||||
; 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.
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; Uncomment the next line to enable auto Winamp download
|
||||
; !define WINAMP_AUTOINSTALL
|
||||
|
||||
; The name of the installer
|
||||
Name "TinyVis Plug-in"
|
||||
|
||||
; The file to write
|
||||
OutFile "waplugin.exe"
|
||||
|
||||
; The default installation directory
|
||||
InstallDir $PROGRAMFILES\Winamp
|
||||
|
||||
; 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 nevershow
|
||||
|
||||
; Request application privileges for Windows Vista
|
||||
RequestExecutionLevel admin
|
||||
|
||||
;--------------------------------
|
||||
|
||||
;Pages
|
||||
|
||||
Page directory
|
||||
Page instfiles
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; 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"
|
||||
File /oname=vis_nsfs.dll "${NSISDIR}\Plugins\x86-ansi\TypeLib.dll" # dummy plug-in
|
||||
|
||||
; 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:
|
||||
|
||||
FunctionEnd
|
||||
|
||||
!ifdef WINAMP_AUTOINSTALL
|
||||
|
||||
Function GetWinampInstPath
|
||||
|
||||
Push $0
|
||||
Push $1
|
||||
Push $2
|
||||
ReadRegStr $0 HKLM \
|
||||
"Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp" \
|
||||
"UninstallString"
|
||||
StrCmp $0 "" fin
|
||||
|
||||
StrCpy $1 $0 1 0 ; get firstchar
|
||||
StrCmp $1 '"' "" getparent
|
||||
; if first char is ", let's remove "'s first.
|
||||
StrCpy $0 $0 "" 1
|
||||
StrCpy $1 0
|
||||
rqloop:
|
||||
StrCpy $2 $0 1 $1
|
||||
StrCmp $2 '"' rqdone
|
||||
StrCmp $2 "" rqdone
|
||||
IntOp $1 $1 + 1
|
||||
Goto rqloop
|
||||
rqdone:
|
||||
StrCpy $0 $0 $1
|
||||
getparent:
|
||||
; the uninstall string goes to an EXE, let's get the directory.
|
||||
StrCpy $1 -1
|
||||
gploop:
|
||||
StrCpy $2 $0 1 $1
|
||||
StrCmp $2 "" gpexit
|
||||
StrCmp $2 "\" gpexit
|
||||
IntOp $1 $1 - 1
|
||||
Goto gploop
|
||||
gpexit:
|
||||
StrCpy $0 $0 $1
|
||||
|
||||
StrCmp $0 "" fin
|
||||
IfFileExists $0\winamp.exe fin
|
||||
StrCpy $0 ""
|
||||
fin:
|
||||
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
|
||||
StrCmp $0 success success
|
||||
SetDetailsView show
|
||||
DetailPrint "download failed: $0"
|
||||
Abort
|
||||
success:
|
||||
ExecWait '"$2" /S'
|
||||
Delete $2
|
||||
Call GetWinampInstPath
|
||||
Pop $0
|
||||
StrCmp $0 "" skip
|
||||
StrCpy $INSTDIR $0
|
||||
skip:
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function ConnectInternet
|
||||
|
||||
Push $R0
|
||||
|
||||
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:
|
||||
|
||||
Pop $R0
|
||||
|
||||
FunctionEnd
|
||||
|
||||
!endif ; WINAMP_AUTOINSTALL
|
Reference in New Issue
Block a user