header files of useful functions (Instructor)
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4112 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
bdbec46023
commit
fd2947c9ae
14 changed files with 11766 additions and 1 deletions
91
Examples/FileFunc.ini
Normal file
91
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
|
751
Examples/FileFunc.nsi
Normal file
751
Examples/FileFunc.nsi
Normal file
|
@ -0,0 +1,751 @@
|
|||
;_____________________________________________________________________________
|
||||
;
|
||||
; File Functions
|
||||
;_____________________________________________________________________________
|
||||
;
|
||||
; 2005 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)
|
||||
|
||||
Name "File Functions"
|
||||
OutFile "FileFunc.exe"
|
||||
Caption "$(^Name)"
|
||||
XPStyle on
|
||||
|
||||
!include "WinMessages.nsh"
|
||||
!include "FileFunc.nsh"
|
||||
|
||||
!insertmacro Locate
|
||||
!insertmacro GetSize
|
||||
!insertmacro DriveSpace
|
||||
!insertmacro GetDrives
|
||||
!insertmacro GetTime
|
||||
!insertmacro GetFileAttributes
|
||||
!insertmacro GetFileVersion
|
||||
!insertmacro GetExeName
|
||||
!insertmacro GetExePath
|
||||
!insertmacro GetParameters
|
||||
!insertmacro GetOptions
|
||||
!insertmacro GetRoot
|
||||
!insertmacro GetParent
|
||||
!insertmacro GetFileName
|
||||
!insertmacro GetBaseName
|
||||
!insertmacro GetFileExt
|
||||
!insertmacro BannerTrimPath
|
||||
!insertmacro DirState
|
||||
!insertmacro RefreshShellIcons
|
||||
|
||||
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 /NOUNLOAD "$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 '35A'
|
||||
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 0
|
||||
SendMessage $1 ${WM_ENABLE} 1 0
|
||||
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
|
||||
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
|
508
Examples/FileFuncTest.nsi
Normal file
508
Examples/FileFuncTest.nsi
Normal file
|
@ -0,0 +1,508 @@
|
|||
;_____________________________________________________________________________
|
||||
;
|
||||
; File Functions Test
|
||||
;_____________________________________________________________________________
|
||||
;
|
||||
; 2005 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)
|
||||
|
||||
Name "File Functions Test"
|
||||
OutFile "FileFuncTest.exe"
|
||||
Caption "$(^Name)"
|
||||
ShowInstDetails show
|
||||
XPStyle on
|
||||
|
||||
Var FUNCTION
|
||||
Var OUT1
|
||||
Var OUT2
|
||||
Var OUT3
|
||||
Var OUT4
|
||||
Var OUT5
|
||||
Var OUT6
|
||||
Var OUT7
|
||||
|
||||
!include "FileFunc.nsh"
|
||||
|
||||
!insertmacro Locate
|
||||
!insertmacro GetSize
|
||||
!insertmacro DriveSpace
|
||||
!insertmacro GetDrives
|
||||
!insertmacro GetTime
|
||||
!insertmacro GetFileAttributes
|
||||
!insertmacro GetFileVersion
|
||||
!insertmacro GetExeName
|
||||
!insertmacro GetExePath
|
||||
!insertmacro GetParameters
|
||||
!insertmacro GetOptions
|
||||
!insertmacro GetRoot
|
||||
!insertmacro GetParent
|
||||
!insertmacro GetFileName
|
||||
!insertmacro GetBaseName
|
||||
!insertmacro GetFileExt
|
||||
!insertmacro BannerTrimPath
|
||||
!insertmacro DirState
|
||||
!insertmacro RefreshShellIcons
|
||||
|
||||
!insertmacro un.Locate
|
||||
!insertmacro un.GetSize
|
||||
!insertmacro un.GetDrives
|
||||
!insertmacro un.DriveSpace
|
||||
!insertmacro un.GetTime
|
||||
!insertmacro un.GetFileAttributes
|
||||
!insertmacro un.GetFileVersion
|
||||
!insertmacro un.GetExeName
|
||||
!insertmacro un.GetExePath
|
||||
!insertmacro un.GetParameters
|
||||
!insertmacro un.GetOptions
|
||||
!insertmacro un.GetRoot
|
||||
!insertmacro un.GetParent
|
||||
!insertmacro un.GetFileName
|
||||
!insertmacro un.GetBaseName
|
||||
!insertmacro un.GetFileExt
|
||||
!insertmacro un.BannerTrimPath
|
||||
!insertmacro un.DirState
|
||||
!insertmacro un.RefreshShellIcons
|
||||
|
||||
|
||||
|
||||
;############### 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
|
||||
|
||||
${GetParameters} $OUT1
|
||||
|
||||
${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} `/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 '' 0 error
|
||||
|
||||
${GetOptions} `/INSTDIR=''C:/Program Files/Common Files'' /SILENT=yes` '' $OUT1
|
||||
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
|
||||
|
||||
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
|
||||
${un.Locate} '$DOCUMENTS' '/L=FD /M=*.* /S=0B /G=0' 'un.LocateCallback'
|
||||
${un.GetSize} '$WINDIR' '/M=Explorer.exe /S=0K /G=0' $OUT1 $OUT2 $OUT3
|
||||
${un.DriveSpace} 'C:\' '/D=F /S=M' $OUT1
|
||||
${un.GetDrives} 'FDD+CDROM' 'un.GetDrivesCallback'
|
||||
${un.GetTime} '' 'L' $OUT1 $OUT2 $OUT3 $OUT4 $OUT5 $OUT6 $OUT7
|
||||
${un.GetFileAttributes} '$WINDIR\explorer.exe' 'ALL' $OUT1
|
||||
${un.GetFileVersion} '$WINDIR\explorer.exe' $OUT1
|
||||
${un.GetExeName} $OUT1
|
||||
${un.GetExePath} $OUT1
|
||||
${un.GetParameters} $OUT1
|
||||
${un.GetOptions} '/INSTDIR=C:\Program Files\Common Files /SILENT=yes' '/INSTDIR=' $OUT1
|
||||
${un.GetRoot} 'C:\Program Files\NSIS' $OUT1
|
||||
${un.GetParent} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
|
||||
${un.GetFileName} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
|
||||
${un.GetBaseName} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
|
||||
${un.GetFileExt} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
|
||||
${un.BannerTrimPath} 'C:\Server\Documents\Terminal\license.htm' '35A' $OUT1
|
||||
${un.DirState} '$TEMP' $OUT1
|
||||
${un.RefreshShellIcons}
|
||||
SectionEnd
|
||||
|
||||
Function un.LocateCallback
|
||||
Push $0
|
||||
FunctionEnd
|
||||
|
||||
Function un.GetDrivesCallback
|
||||
Push $0
|
||||
FunctionEnd
|
130
Examples/TextFunc.ini
Normal file
130
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
|
833
Examples/TextFunc.nsi
Normal file
833
Examples/TextFunc.nsi
Normal file
|
@ -0,0 +1,833 @@
|
|||
;_____________________________________________________________________________
|
||||
;
|
||||
; Text Functions
|
||||
;_____________________________________________________________________________
|
||||
;
|
||||
; 2005 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)
|
||||
|
||||
Name "Text Functions"
|
||||
OutFile "TextFunc.exe"
|
||||
Caption "$(^Name)"
|
||||
XPStyle on
|
||||
|
||||
!include "WinMessages.nsh"
|
||||
!include "TextFunc.nsh"
|
||||
|
||||
!insertmacro LineFind
|
||||
!insertmacro LineRead
|
||||
!insertmacro FileReadFromEnd
|
||||
!insertmacro LineSum
|
||||
!insertmacro FileJoin
|
||||
!insertmacro ConfigRead
|
||||
!insertmacro ConfigWrite
|
||||
!insertmacro FileRecode
|
||||
|
||||
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 /NOUNLOAD "$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 WordFind2X$\r$\n'
|
||||
FileWrite $0 '!insertmacro WordFind3X$\r$\n'
|
||||
FileWrite $0 '!insertmacro WordReplace$\r$\n'
|
||||
FileWrite $0 '!insertmacro WordAdd$\r$\n'
|
||||
FileWrite $0 '!insertmacro WordInsert$\r$\n'
|
||||
FileWrite $0 '!insertmacro StrFilter$\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 " ; Use any of WordFunctions:$\r$\n"
|
||||
FileWrite $0 " ; $7WordFind}|$7WordFind2X}|$7WordFind3X}|$\r$\n"
|
||||
FileWrite $0 " ; $7WordReplace}|$7WordAdd}|$7WordInsert}|$7StrFilter}$\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
|
380
Examples/TextFuncTest.nsi
Normal file
380
Examples/TextFuncTest.nsi
Normal file
|
@ -0,0 +1,380 @@
|
|||
;_____________________________________________________________________________
|
||||
;
|
||||
; Text Functions Test
|
||||
;_____________________________________________________________________________
|
||||
;
|
||||
; 2005 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)
|
||||
|
||||
Name "Text Functions Test"
|
||||
OutFile "TextFuncTest.exe"
|
||||
Caption "$(^Name)"
|
||||
ShowInstDetails show
|
||||
XPStyle on
|
||||
|
||||
Var FUNCTION
|
||||
Var TEMPFILE1
|
||||
Var TEMPFILE2
|
||||
Var TEMPFILE3
|
||||
Var HANDLE
|
||||
Var OUT
|
||||
|
||||
!include "TextFunc.nsh"
|
||||
|
||||
!insertmacro LineFind
|
||||
!insertmacro LineRead
|
||||
!insertmacro FileReadFromEnd
|
||||
!insertmacro LineSum
|
||||
!insertmacro FileJoin
|
||||
!insertmacro TextCompare
|
||||
!insertmacro ConfigRead
|
||||
!insertmacro ConfigWrite
|
||||
!insertmacro FileRecode
|
||||
!insertmacro TrimNewLines
|
||||
|
||||
!insertmacro un.LineFind
|
||||
!insertmacro un.LineRead
|
||||
!insertmacro un.FileReadFromEnd
|
||||
!insertmacro un.LineSum
|
||||
!insertmacro un.FileJoin
|
||||
!insertmacro un.TextCompare
|
||||
!insertmacro un.ConfigRead
|
||||
!insertmacro un.ConfigWrite
|
||||
!insertmacro un.FileRecode
|
||||
!insertmacro un.TrimNewLines
|
||||
|
||||
|
||||
|
||||
;############### 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 $PLUGINSDIR
|
||||
FileOpen $HANDLE $TEMPFILE1 w
|
||||
FileWrite $HANDLE '1=a$\r$\n'
|
||||
FileWrite $HANDLE '2=b$\r$\n'
|
||||
FileWrite $HANDLE '3=c$\r$\n'
|
||||
FileWrite $HANDLE '4=d$\r$\n'
|
||||
FileWrite $HANDLE '5=e$\r$\n'
|
||||
FileClose $HANDLE
|
||||
GetTempFileName $TEMPFILE2 $PLUGINSDIR
|
||||
GetTempFileName $TEMPFILE3 $PLUGINSDIR
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section LineFind
|
||||
${StackVerificationStart} LineFind
|
||||
|
||||
${LineFind} '$TEMPFILE1' '/NUL' '1:-4 3 -1' 'LineFindCallback1'
|
||||
IfErrors error
|
||||
StrCmp $OUT '|1:2|-5|1|1=a$\r$\n|1:2|-4|2|2=b$\r$\n|3:3|-3|3|3=c$\r$\n' 0 error
|
||||
|
||||
StrCpy $OUT ''
|
||||
SetDetailsPrint none
|
||||
${LineFind} '$TEMPFILE1' '$TEMPFILE2' '1:-1' 'LineFindCallback2'
|
||||
SetDetailsPrint both
|
||||
IfErrors error
|
||||
StrCmp $OUT '|1:-1||1|1=a$\r$\n|1:-1||2|4=d$\r$\n|1:-1||3|3=c$\r$\n|1:-1||4|2=x$\r$\n|1:-1||5|5=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 '4=d$\r$\n'
|
||||
StrCmp $R8 4 0 +2
|
||||
StrCpy $R9 '2=x$\r$\n'
|
||||
|
||||
StrCpy $OUT '$OUT|$R6|$R7|$R8|$R9'
|
||||
|
||||
Push $0
|
||||
FunctionEnd
|
||||
|
||||
|
||||
Section LineRead
|
||||
${StackVerificationStart} LineRead
|
||||
|
||||
${LineRead} '$TEMPFILE1' '-1' $OUT
|
||||
IfErrors error
|
||||
StrCmp $OUT '5=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|5=e$\r$\n|-2|4|4=d$\r$\n|-3|3|3=c$\r$\n|-4|2|2=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|4=d$\r$\n|2|2=b$\r$\n|4|2=x$\r$\n|4|4=d$\r$\n' 0 error
|
||||
|
||||
StrCpy $OUT ''
|
||||
${TextCompare} '$TEMPFILE1' '$TEMPFILE2' 'FastEqual' 'TextCompareCallback'
|
||||
StrCmp $OUT '|1|1=a$\r$\n|1|1=a$\r$\n|3|3=c$\r$\n|3|3=c$\r$\n|5|5=e$\r$\n|5|5=e$\r$\n' 0 error
|
||||
|
||||
StrCpy $OUT ''
|
||||
${TextCompare} '$TEMPFILE1' '$TEMPFILE2' 'SlowDiff' 'TextCompareCallback'
|
||||
StrCmp $OUT '|||2|2=b$\r$\n' 0 error
|
||||
|
||||
StrCpy $OUT ''
|
||||
${TextCompare} '$TEMPFILE1' '$TEMPFILE2' 'SlowEqual' 'TextCompareCallback'
|
||||
StrCmp $OUT '|1|1=a$\r$\n|1|1=a$\r$\n|3|3=c$\r$\n|3|3=c$\r$\n|2|4=d$\r$\n|4|4=d$\r$\n|5|5=e$\r$\n|5|5=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' '3=' $OUT
|
||||
StrCmp $OUT 'c' 0 error
|
||||
|
||||
${ConfigRead} '$TEMPFILE1' '6=' $OUT
|
||||
StrCmp $OUT '' 0 error
|
||||
|
||||
goto +2
|
||||
error:
|
||||
SetErrors
|
||||
|
||||
${StackVerificationEnd}
|
||||
SectionEnd
|
||||
|
||||
|
||||
Section ConfigWrite
|
||||
${StackVerificationStart} ConfigWrite
|
||||
|
||||
${ConfigWrite} '$TEMPFILE1' '5=' 'e**' $OUT
|
||||
StrCmp $OUT 'CHANGED' 0 error
|
||||
|
||||
${ConfigWrite} '$TEMPFILE1' '2=' '' $OUT
|
||||
StrCmp $OUT 'DELETED' 0 error
|
||||
|
||||
${ConfigWrite} '$TEMPFILE1' '3=' 'c' $OUT
|
||||
StrCmp $OUT 'SAME' 0 error
|
||||
|
||||
${ConfigWrite} '$TEMPFILE1' '6=' '*' $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
|
||||
goto +2
|
||||
WriteUninstaller '$EXEDIR\un.TextFuncTest.exe'
|
||||
SectionEnd
|
||||
|
||||
|
||||
Function .onInit
|
||||
InitPluginsDir
|
||||
FunctionEnd
|
||||
|
||||
|
||||
;############### UNINSTALL ###############
|
||||
|
||||
Section un.Uninstall
|
||||
${un.LineFind} '$TEMPFILE1' '/NUL' '1:-1' 'un.LineFindCallback'
|
||||
${un.LineRead} '$TEMPFILE1' '-1' $OUT
|
||||
${un.FileReadFromEnd} '$TEMPFILE1' 'un.FileReadFromEndCallback'
|
||||
${un.LineSum} '$TEMPFILE1' $OUT
|
||||
${un.FileJoin} '$TEMPFILE1' '$TEMPFILE2' '$TEMPFILE3'
|
||||
${un.TextCompare} '$TEMPFILE1' '$TEMPFILE2' 'FastDiff' 'un.TextCompareCallback'
|
||||
${un.ConfigRead} '$TEMPFILE1' '3=' $OUT
|
||||
${un.ConfigWrite} '$TEMPFILE1' '5=' 'e**' $OUT
|
||||
${un.FileRecode} '$TEMPFILE1' 'CharToOem'
|
||||
${un.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
|
107
Examples/WordFunc.ini
Normal file
107
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
|
||||
|
543
Examples/WordFunc.nsi
Normal file
543
Examples/WordFunc.nsi
Normal file
|
@ -0,0 +1,543 @@
|
|||
;_____________________________________________________________________________
|
||||
;
|
||||
; Word Functions
|
||||
;_____________________________________________________________________________
|
||||
;
|
||||
; 2005 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)
|
||||
|
||||
Name "Word Functions"
|
||||
OutFile "WordFunc.exe"
|
||||
Caption "$(^Name)"
|
||||
XPStyle on
|
||||
|
||||
Var INI
|
||||
Var HWND
|
||||
Var STATE
|
||||
|
||||
!include "WinMessages.nsh"
|
||||
!include "WordFunc.nsh"
|
||||
|
||||
!insertmacro WordFind
|
||||
!insertmacro WordFind2X
|
||||
!insertmacro WordReplace
|
||||
!insertmacro WordAdd
|
||||
!insertmacro WordInsert
|
||||
!insertmacro StrFilter
|
||||
!insertmacro VersionCompare
|
||||
!insertmacro VersionConvert
|
||||
|
||||
Page Custom ShowCustom LeaveCustom
|
||||
|
||||
Function ShowCustom
|
||||
InstallOptions::initDialog /NOUNLOAD "$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
|
486
Examples/WordFuncTest.nsi
Normal file
486
Examples/WordFuncTest.nsi
Normal file
|
@ -0,0 +1,486 @@
|
|||
;_____________________________________________________________________________
|
||||
;
|
||||
; Word Functions Test
|
||||
;_____________________________________________________________________________
|
||||
;
|
||||
; 2005 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)
|
||||
|
||||
Name "Word Functions Test"
|
||||
OutFile "WordFuncTest.exe"
|
||||
Caption "$(^Name)"
|
||||
ShowInstDetails show
|
||||
XPStyle on
|
||||
|
||||
Var FUNCTION
|
||||
Var OUT
|
||||
|
||||
!include "WordFunc.nsh"
|
||||
|
||||
!insertmacro WordFind
|
||||
!insertmacro WordFind2X
|
||||
!insertmacro WordFind3X
|
||||
!insertmacro WordReplace
|
||||
!insertmacro WordAdd
|
||||
!insertmacro WordInsert
|
||||
!insertmacro StrFilter
|
||||
!insertmacro VersionCompare
|
||||
!insertmacro VersionConvert
|
||||
|
||||
!insertmacro un.WordFind
|
||||
!insertmacro un.WordFind2X
|
||||
!insertmacro un.WordFind3X
|
||||
!insertmacro un.WordReplace
|
||||
!insertmacro un.WordAdd
|
||||
!insertmacro un.WordInsert
|
||||
!insertmacro un.StrFilter
|
||||
!insertmacro un.VersionCompare
|
||||
!insertmacro un.VersionConvert
|
||||
|
||||
|
||||
|
||||
;############### 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 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 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 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' ' ' ' ' '+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} '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 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 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 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 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
|
||||
${un.WordFind} 'C:\io.sys C:\Program Files C:\WINDOWS' ' C:\' '-02' $OUT
|
||||
${un.WordFind2X} '[C:\io.sys];[C:\logo.sys];[C:\WINDOWS]' '[C:\' '];' '+2' $OUT
|
||||
${un.WordFind3X} '[1.AAB];[2.BAA];[3.BBB];' '[' 'AA' '];' '+1' $OUT
|
||||
${un.WordReplace} 'C:\io.sys C:\logo.sys C:\WINDOWS' 'SYS' 'bmp' '+2' $OUT
|
||||
${un.WordAdd} 'C:\io.sys C:\WINDOWS' ' ' '+C:\WINDOWS C:\config.sys' $OUT
|
||||
${un.WordInsert} 'C:\io.sys C:\WINDOWS' ' ' 'C:\logo.sys' '-2' $OUT
|
||||
${un.StrFilter} '123abc 456DEF 7890|%#' '+' '' '' $OUT
|
||||
${un.VersionCompare} '1.1.1.9' '1.1.1.01' $OUT
|
||||
${un.VersionConvert} '9.0a' '' $OUT
|
||||
SectionEnd
|
Loading…
Add table
Add a link
Reference in a new issue