root / tmp / org.txm.setups / nsis / Examples / TextFunc.nsi @ 3098
Historique | Voir | Annoter | Télécharger (23,66 ko)
1 |
;_____________________________________________________________________________ |
---|---|
2 |
; |
3 |
; Text Functions |
4 |
;_____________________________________________________________________________ |
5 |
; |
6 |
; 2006 Shengalts Aleksander aka Instructor (Shengalts@mail.ru) |
7 |
|
8 |
Name "Text Functions" |
9 |
OutFile "TextFunc.exe" |
10 |
Caption "$(^Name)" |
11 |
XPStyle on |
12 |
RequestExecutionLevel user |
13 |
|
14 |
!include "WinMessages.nsh" |
15 |
!include "TextFunc.nsh" |
16 |
|
17 |
Var HWND |
18 |
Var INI |
19 |
Var LOG |
20 |
Var PROJECT |
21 |
Var CALLBACK |
22 |
Var VIEW |
23 |
Var FUNCTION |
24 |
Var LINEFIND1 |
25 |
Var LINEFIND2 |
26 |
Var LINEFIND3 |
27 |
Var LINEREAD1 |
28 |
Var LINEREAD2 |
29 |
Var FILEREADFROMEND1 |
30 |
Var LINESUM1 |
31 |
Var FILEJOIN1 |
32 |
Var FILEJOIN2 |
33 |
Var FILEJOIN3 |
34 |
Var TEXTCOMPARE1 |
35 |
Var TEXTCOMPARE2 |
36 |
Var TEXTCOMPARE3 |
37 |
Var CONFIGREAD1 |
38 |
Var CONFIGREAD2 |
39 |
Var CONFIGWRITE1 |
40 |
Var CONFIGWRITE2 |
41 |
Var CONFIGWRITE3 |
42 |
Var FILERECODE1 |
43 |
Var FILERECODE2 |
44 |
|
45 |
Page Custom ShowCustom LeaveCustom |
46 |
|
47 |
Function ShowCustom |
48 |
InstallOptions::initDialog "$INI" |
49 |
Pop $hwnd |
50 |
GetDlgItem $0 $HWND 1206 |
51 |
ShowWindow $0 0 |
52 |
GetDlgItem $0 $HWND 1208 |
53 |
ShowWindow $0 0 |
54 |
GetDlgItem $0 $HWND 1209 |
55 |
ShowWindow $0 0 |
56 |
StrCpy $FUNCTION LineFind |
57 |
StrCpy $LINEREAD2 10 |
58 |
StrCpy $TEXTCOMPARE3 FastDiff |
59 |
StrCpy $CONFIGREAD1 "$WINDIR\system.ini" |
60 |
StrCpy $CONFIGREAD2 "shell=" |
61 |
StrCpy $FILERECODE2 CharToOem |
62 |
InstallOptions::show |
63 |
Pop $0 |
64 |
FunctionEnd |
65 |
|
66 |
Function LeaveCustom |
67 |
ReadINIStr $0 $INI "Settings" "State" |
68 |
ReadINIStr $R0 $INI "Field 1" "State" |
69 |
ReadINIStr $R1 $INI "Field 2" "State" |
70 |
ReadINIStr $R2 $INI "Field 3" "State" |
71 |
ReadINIStr $R3 $INI "Field 4" "State" |
72 |
ReadINIStr $R4 $INI "Field 5" "State" |
73 |
ReadINIStr $R5 $INI "Field 6" "State" |
74 |
StrCpy $R4 $R4 8 |
75 |
StrCpy $R5 $R5 8 |
76 |
StrCpy $6 0 |
77 |
StrCpy $7 '$${' |
78 |
StrCpy $8 'r' |
79 |
StrCpy $9 'n' |
80 |
|
81 |
StrCmp $0 10 Log |
82 |
StrCmp $0 9 ViewOrEdit |
83 |
StrCmp $0 0 Enter |
84 |
goto MainSend |
85 |
|
86 |
Log: |
87 |
Exec 'notepad.exe $LOG' |
88 |
Abort |
89 |
|
90 |
ViewOrEdit: |
91 |
StrCmp $FUNCTION FileReadFromEnd 0 Edit |
92 |
StrCmp $VIEW '' 0 ViewFileReadFromEndCallback |
93 |
GetTempFileName $VIEW $PLUGINSDIR |
94 |
StrCpy $7 '$$' |
95 |
FileOpen $0 $VIEW w |
96 |
FileWrite $0 `Function FileReadFromEndCallback$\r$\n` |
97 |
FileWrite $0 ` MessageBox MB_OKCANCEL '$7$$9 "Line"=[$$9]$7\$9$7$$8 "#"=[$$8]$7\$9$7$$7 "-#"=[$$7]' IDOK +2$\r$\n` |
98 |
FileWrite $0 ` StrCpy $$R0 StopFileReadFromEnd$\r$\n$\r$\n` |
99 |
FileWrite $0 ` Push $$R0$\r$\n` |
100 |
FileWrite $0 `FunctionEnd$\r$\n` |
101 |
FileClose $0 |
102 |
StrCpy $7 '$${' |
103 |
SetFileAttributes $VIEW READONLY |
104 |
ViewFileReadFromEndCallback: |
105 |
Exec 'notepad.exe $VIEW' |
106 |
Abort |
107 |
|
108 |
Edit: |
109 |
StrCmp $CALLBACK '' +5 |
110 |
StrCmp $6$R6 '0$R0$R4$R5' showproject |
111 |
StrCmp $R6 '$R0$R4$R5' +3 |
112 |
Delete $CALLBACK |
113 |
StrCpy $CALLBACK '' |
114 |
StrCpy $R6 '$R0$R4$R5' |
115 |
|
116 |
#Project# |
117 |
StrCmp $6$R0 "01. LineFind" 0 +5 |
118 |
IfFileExists $CALLBACK +2 |
119 |
GetTempFileName $CALLBACK $PLUGINSDIR |
120 |
FileOpen $0 $CALLBACK w |
121 |
goto function |
122 |
IfFileExists $PROJECT +2 |
123 |
GetTempFileName $PROJECT $PLUGINSDIR |
124 |
FileOpen $0 $PROJECT w |
125 |
|
126 |
#Name# |
127 |
FileWrite $0 'Name "$FUNCTION"$\r$\n' |
128 |
FileWrite $0 'OutFile "$PROJECT.exe"$\r$\n$\r$\n' |
129 |
|
130 |
#!include# |
131 |
StrCmp $R0$R4 '1. LineFindExample5' 0 TextFuncInclude |
132 |
IfFileExists '$EXEDIR\WordFunc.nsh' 0 +3 |
133 |
FileWrite $0 '!include "$EXEDIR\WordFunc.nsh"$\r$\n' |
134 |
goto +2 |
135 |
FileWrite $0 '!include "WordFunc.nsh"$\r$\n' |
136 |
FileWrite $0 '!insertmacro WordFind$\r$\n' |
137 |
FileWrite $0 '!insertmacro WordFindS$\r$\n' |
138 |
FileWrite $0 '!insertmacro WordFind2X$\r$\n' |
139 |
FileWrite $0 '!insertmacro WordFind2XS$\r$\n' |
140 |
FileWrite $0 '!insertmacro WordFind3X$\r$\n' |
141 |
FileWrite $0 '!insertmacro WordFind3XS$\r$\n' |
142 |
FileWrite $0 '!insertmacro WordReplace$\r$\n' |
143 |
FileWrite $0 '!insertmacro WordReplaceS$\r$\n' |
144 |
FileWrite $0 '!insertmacro WordAdd$\r$\n' |
145 |
FileWrite $0 '!insertmacro WordAddS$\r$\n' |
146 |
FileWrite $0 '!insertmacro WordInsert$\r$\n' |
147 |
FileWrite $0 '!insertmacro WordInsertS$\r$\n' |
148 |
FileWrite $0 '!insertmacro StrFilter$\r$\n' |
149 |
FileWrite $0 '!insertmacro StrFilterS$\r$\n' |
150 |
TextFuncInclude: |
151 |
IfFileExists '$EXEDIR\TextFunc.nsh' 0 +3 |
152 |
FileWrite $0 '!include "$EXEDIR\TextFunc.nsh"$\r$\n' |
153 |
goto +2 |
154 |
FileWrite $0 '!include "TextFunc.nsh"$\r$\n' |
155 |
FileWrite $0 '!insertmacro $FUNCTION$\r$\n' |
156 |
StrCmp $FUNCTION TextCompare +2 |
157 |
FileWrite $0 '!insertmacro TrimNewLines$\r$\n' |
158 |
|
159 |
#Section# |
160 |
FileWrite $0 '$\r$\nSection -empty$\r$\n' |
161 |
FileWrite $0 'SectionEnd$\r$\n$\r$\n' |
162 |
|
163 |
#Function .onInit# |
164 |
FileWrite $0 'Function .onInit$\r$\n' |
165 |
StrCmp $R0$R5 "6. TextCompareExample1" 0 TextCompareExample235 |
166 |
FileWrite $0 ' StrCpy $$R0 ""$\r$\n' |
167 |
FileWrite $0 ' $7TextCompare} "$R1" "$R2" "$R3" "$R5"$\r$\n' |
168 |
FileWrite $0 ' IfErrors error$\r$\n' |
169 |
FileWrite $0 ' StrCmp $$R0 NotEqual 0 +2$\r$\n' |
170 |
FileWrite $0 ' MessageBox MB_OK " Files differ" IDOK +2$\r$\n' |
171 |
FileWrite $0 ' MessageBox MB_OK " Files identical"$\r$\n' |
172 |
FileWrite $0 ' goto end$\r$\n$\r$\n' |
173 |
goto endoninit |
174 |
TextCompareExample235: |
175 |
StrCmp $R0$R5 "6. TextCompareExample2" +3 |
176 |
StrCmp $R0$R5 "6. TextCompareExample3" +2 |
177 |
StrCmp $R0$R5 "6. TextCompareExample5" 0 TextCompareExample4 |
178 |
FileWrite $0 ' StrCpy $$R0 "$R1"$\r$\n' |
179 |
FileWrite $0 ' StrCpy $$R1 "$R2"$\r$\n$\r$\n' |
180 |
FileWrite $0 ' GetTempFileName $$R2$\r$\n' |
181 |
FileWrite $0 ' FileOpen $$R3 $$R2 w$\r$\n' |
182 |
FileWrite $0 ' FileWrite $$R3 "$$R0 | $$R1$$\$8$$\$9"$\r$\n' |
183 |
FileWrite $0 ' $7TextCompare} "$$R0" "$$R1" "$R3" "$R5"$\r$\n' |
184 |
FileWrite $0 ' IfErrors error$\r$\n' |
185 |
FileWrite $0 ' Exec "notepad.exe $$R2"$\r$\n' |
186 |
FileWrite $0 ' goto end$\r$\n$\r$\n' |
187 |
goto endoninit |
188 |
TextCompareExample4: |
189 |
StrCmp $R0$R5 "6. TextCompareExample4" 0 LineFindExample123456 |
190 |
FileWrite $0 ' StrCpy $$R0 "$R1"$\r$\n' |
191 |
FileWrite $0 ' StrCpy $$R1 "$R2"$\r$\n$\r$\n' |
192 |
FileWrite $0 ' GetTempFileName $$R2$\r$\n' |
193 |
FileWrite $0 ' FileOpen $$R3 $$R2 w$\r$\n' |
194 |
FileWrite $0 ' FileWrite $$R3 "$$R0 | $$R1$$\$8$$\$9"$\r$\n' |
195 |
FileWrite $0 ' $7TextCompare} "$$R0" "$$R1" "$R3" "$R5"$\r$\n' |
196 |
FileWrite $0 ' IfErrors error$\r$\n' |
197 |
FileWrite $0 ' FileWrite $$R3 "$$\$8$$\$9$$R1 | $$R0$$\$8$$\$9"$\r$\n' |
198 |
FileWrite $0 ' $7TextCompare} "$$R1" "$$R0" "$R3" "$R5"$\r$\n' |
199 |
FileWrite $0 ' FileClose $$R3$\r$\n' |
200 |
FileWrite $0 ' IfErrors error$\r$\n' |
201 |
FileWrite $0 ' Exec "notepad.exe $$R2"$\r$\n$\r$\n' |
202 |
FileWrite $0 ' goto end$\r$\n$\r$\n' |
203 |
goto endoninit |
204 |
LineFindExample123456: |
205 |
FileWrite $0 ' $7$FUNCTION} "$R1" "$R2" "$R3" "$R4"$\r$\n' |
206 |
FileWrite $0 ' IfErrors error$\r$\n' |
207 |
FileWrite $0 ' MessageBox MB_YESNO " Open output file?" IDNO end$\r$\n' |
208 |
FileWrite $0 ' StrCmp "$R2" "" 0 +3$\r$\n' |
209 |
FileWrite $0 ` Exec 'notepad.exe "$R1"'$\r$\n` |
210 |
FileWrite $0 ' goto end$\r$\n' |
211 |
FileWrite $0 ' SearchPath $$R2 "$R2"$\r$\n' |
212 |
FileWrite $0 ` Exec 'notepad.exe "$$R2"'$\r$\n` |
213 |
FileWrite $0 ' goto end$\r$\n$\r$\n' |
214 |
endoninit: |
215 |
FileWrite $0 ' error:$\r$\n' |
216 |
FileWrite $0 ' MessageBox MB_OK "Error"$\r$\n$\r$\n' |
217 |
FileWrite $0 ' end:$\r$\n' |
218 |
FileWrite $0 ' Quit$\r$\n' |
219 |
FileWrite $0 'FunctionEnd$\r$\n$\r$\n' |
220 |
#FunctionEnd# |
221 |
|
222 |
|
223 |
#Function CallBack# |
224 |
StrCmp $CALLBACK '' 0 close |
225 |
function: |
226 |
StrCmp $R0 '1. LineFind' 0 +8 |
227 |
FileWrite $0 'Function $R4$\r$\n' |
228 |
StrCmp $R4 "Example1" Example1LF |
229 |
StrCmp $R4 "Example2" Example2LF |
230 |
StrCmp $R4 "Example3" Example3LF |
231 |
StrCmp $R4 "Example4" Example4LF |
232 |
StrCmp $R4 "Example5" Example5LF |
233 |
StrCmp $R4 "Example6" Example6LF |
234 |
|
235 |
FileWrite $0 'Function $R5$\r$\n' |
236 |
StrCmp $R5 "Example1" Example1TC |
237 |
StrCmp $R5 "Example2" Example2TC |
238 |
StrCmp $R5 "Example3" Example3TC |
239 |
StrCmp $R5 "Example4" Example4TC |
240 |
StrCmp $R5 "Example5" Example3TC |
241 |
|
242 |
Example1LF: |
243 |
FileWrite $0 " $7TrimNewLines} '$$R9' $$R9$\r$\n" |
244 |
FileWrite $0 " StrCpy $$R9 $$R9 '' 2 ;delete first two symbols$\r$\n" |
245 |
FileWrite $0 " StrCpy $$R9 '$$R9$$\$8$$\$9'$\r$\n$\r$\n" |
246 |
goto endwrite |
247 |
Example2LF: |
248 |
FileWrite $0 " $7TrimNewLines} '$$R9' $$R9$\r$\n" |
249 |
FileWrite $0 " StrCpy $$R9 '$$R9 ~Changed line ($$R8)~$$\$8$$\$9'$\r$\n$\r$\n" |
250 |
goto endwrite |
251 |
Example3LF: |
252 |
FileWrite $0 " StrCpy $$0 SkipWrite$\r$\n$\r$\n" |
253 |
goto endwrite |
254 |
Example4LF: |
255 |
FileWrite $0 " FileWrite $$R4 '---First Line---$$\$8$$\$9'$\r$\n" |
256 |
FileWrite $0 " FileWrite $$R4 '---Second Line ...---$$\$8$$\$9'$\r$\n$\r$\n" |
257 |
goto endwrite |
258 |
Example5LF: |
259 |
FileWrite $0 " ; You can use:$\r$\n" |
260 |
FileWrite $0 " ; $7WordFind}|$7WordFindS}|$7WordFind2X}|$7WordFind2XS}|$\r$\n" |
261 |
FileWrite $0 " ; $7WordFind3X}|$7WordFind3XS}|$7WordReplace}|$7WordReplaceS}|$\r$\n" |
262 |
FileWrite $0 " ; $7WordAdd}|$7WordAddS}|$7WordInsert}|$7WordInsertS}|$\r$\n" |
263 |
FileWrite $0 " ; $7StrFilter}|$7StrFilterS}$\r$\n$\r$\n" |
264 |
FileWrite $0 " $7WordReplace} '$$R9' ' ' '_' '+*' $$R9$\r$\n$\r$\n" |
265 |
goto endwrite |
266 |
Example6LF: |
267 |
FileWrite $0 ' ;(Cut lines from a line to another line (also including that line))$\r$\n' |
268 |
FileWrite $0 ' StrCmp $$R0 finish stop$\r$\n' |
269 |
FileWrite $0 ' StrCmp $$R0 start finish$\r$\n' |
270 |
FileWrite $0 ' StrCmp $$R9 "Start Line$$\$8$$\$9" 0 skip$\r$\n' |
271 |
FileWrite $0 ' StrCpy $$R0 start$\r$\n' |
272 |
FileWrite $0 ' StrCpy $$R1 $$R9$\r$\n' |
273 |
FileWrite $0 ' goto code$\r$\n' |
274 |
FileWrite $0 ' finish:$\r$\n' |
275 |
FileWrite $0 ' StrCmp $$R9 "Finish Line$$\$8$$\$9" 0 code$\r$\n' |
276 |
FileWrite $0 ' StrCpy $$R0 finish$\r$\n' |
277 |
FileWrite $0 ' StrCpy $$R2 $$R8$\r$\n' |
278 |
FileWrite $0 ' goto code$\r$\n' |
279 |
FileWrite $0 ' skip:$\r$\n' |
280 |
FileWrite $0 ' StrCpy $$0 SkipWrite$\r$\n' |
281 |
FileWrite $0 ' goto output$\r$\n' |
282 |
FileWrite $0 ' stop:$\r$\n' |
283 |
FileWrite $0 ' StrCpy $$0 StopLineFind$\r$\n' |
284 |
FileWrite $0 ' goto output$\r$\n$\r$\n' |
285 |
FileWrite $0 ' ;;(Delete lines from a line to another line (also including that line))$\r$\n' |
286 |
FileWrite $0 ' ; StrCmp $$R0 finish code$\r$\n' |
287 |
FileWrite $0 ' ; StrCmp $$R0 start finish$\r$\n' |
288 |
FileWrite $0 ' ; StrCmp $$R9 "Start Line$$\$8$$\$9" 0 code$\r$\n' |
289 |
FileWrite $0 ' ; StrCpy $$R0 start$\r$\n' |
290 |
FileWrite $0 ' ; StrCpy $$R1 $$R8$\r$\n' |
291 |
FileWrite $0 ' ; goto skip$\r$\n' |
292 |
FileWrite $0 ' ; finish:$\r$\n' |
293 |
FileWrite $0 ' ; StrCmp $$R9 "Finish Line$$\$8$$\$9" 0 skip$\r$\n' |
294 |
FileWrite $0 ' ; StrCpy $$R0 finish$\r$\n' |
295 |
FileWrite $0 ' ; StrCpy $$R2 $$R8$\r$\n' |
296 |
FileWrite $0 ' ; skip:$\r$\n' |
297 |
FileWrite $0 ' ; StrCpy $$0 SkipWrite$\r$\n' |
298 |
FileWrite $0 ' ; goto output$\r$\n$\r$\n' |
299 |
FileWrite $0 ' code:$\r$\n' |
300 |
FileWrite $0 ' ;...$\r$\n$\r$\n' |
301 |
FileWrite $0 ' output:$\r$\n' |
302 |
goto endwrite |
303 |
Example1TC: |
304 |
FileWrite $0 " StrCpy $$R0 NotEqual$\r$\n" |
305 |
FileWrite $0 " StrCpy $$0 StopTextCompare$\r$\n$\r$\n" |
306 |
goto endwrite |
307 |
Example2TC: |
308 |
FileWrite $0 " FileWrite $$R3 '$$8=$$9'$\r$\n" |
309 |
FileWrite $0 " FileWrite $$R3 '$$6=$$7$$\$8$$\$9'$\r$\n$\r$\n" |
310 |
goto endwrite |
311 |
Example3TC: |
312 |
FileWrite $0 " FileWrite $$R3 '$$8|$$6=$$9'$\r$\n$\r$\n" |
313 |
goto endwrite |
314 |
Example4TC: |
315 |
FileWrite $0 " FileWrite $$R3 '$$8=$$9'$\r$\n$\r$\n" |
316 |
goto endwrite |
317 |
endwrite: |
318 |
FileWrite $0 ' Push $$0$\r$\n' |
319 |
FileWrite $0 'FunctionEnd$\r$\n' |
320 |
close: |
321 |
FileClose $0 |
322 |
goto $6 |
323 |
#FunctionEnd# |
324 |
|
325 |
showproject: |
326 |
StrCmp $R0 '1. LineFind' 0 +3 |
327 |
ExecWait 'notepad.exe $CALLBACK' |
328 |
goto +4 |
329 |
SetFileAttributes $PROJECT READONLY |
330 |
ExecWait 'notepad.exe $PROJECT' |
331 |
SetFileAttributes $PROJECT NORMAL |
332 |
Abort |
333 |
|
334 |
MainSend: |
335 |
GetDlgItem $0 $HWND 1210 |
336 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:" |
337 |
GetDlgItem $0 $HWND 1203 |
338 |
ShowWindow $0 1 |
339 |
EnableWindow $0 1 |
340 |
GetDlgItem $0 $HWND 1204 |
341 |
ShowWindow $0 1 |
342 |
EnableWindow $0 1 |
343 |
GetDlgItem $0 $HWND 1205 |
344 |
EnableWindow $0 1 |
345 |
GetDlgItem $0 $HWND 1206 |
346 |
ShowWindow $0 0 |
347 |
GetDlgItem $0 $HWND 1207 |
348 |
ShowWindow $0 0 |
349 |
GetDlgItem $0 $HWND 1208 |
350 |
ShowWindow $0 0 |
351 |
GetDlgItem $0 $HWND 1209 |
352 |
ShowWindow $0 0 |
353 |
GetDlgItem $0 $HWND 1211 |
354 |
EnableWindow $0 1 |
355 |
|
356 |
StrCmp $FUNCTION LineFind 0 +5 |
357 |
StrCpy $LINEFIND1 $R1 |
358 |
StrCpy $LINEFIND2 $R2 |
359 |
StrCpy $LINEFIND3 $R3 |
360 |
goto LineFindSend |
361 |
StrCmp $FUNCTION LineRead 0 +4 |
362 |
StrCpy $LINEREAD1 $R1 |
363 |
StrCpy $LINEREAD2 $R2 |
364 |
goto LineFindSend |
365 |
StrCmp $FUNCTION FileReadFromEnd 0 +3 |
366 |
StrCpy $FILEREADFROMEND1 $R1 |
367 |
goto LineFindSend |
368 |
StrCmp $FUNCTION LineSum 0 +3 |
369 |
StrCpy $LINESUM1 $R1 |
370 |
goto LineFindSend |
371 |
StrCmp $FUNCTION FileJoin 0 +5 |
372 |
StrCpy $FILEJOIN1 $R1 |
373 |
StrCpy $FILEJOIN2 $R2 |
374 |
StrCpy $FILEJOIN3 $R3 |
375 |
goto LineFindSend |
376 |
StrCmp $FUNCTION TextCompare 0 +5 |
377 |
StrCpy $TEXTCOMPARE1 $R1 |
378 |
StrCpy $TEXTCOMPARE2 $R2 |
379 |
StrCpy $TEXTCOMPARE3 $R3 |
380 |
goto LineFindSend |
381 |
StrCmp $FUNCTION ConfigRead 0 +4 |
382 |
StrCpy $CONFIGREAD1 $R1 |
383 |
StrCpy $CONFIGREAD2 $R2 |
384 |
goto LineFindSend |
385 |
StrCmp $FUNCTION ConfigWrite 0 +5 |
386 |
StrCpy $CONFIGWRITE1 $R1 |
387 |
StrCpy $CONFIGWRITE2 $R2 |
388 |
StrCpy $CONFIGWRITE3 $R3 |
389 |
goto LineFindSend |
390 |
StrCmp $FUNCTION FileRecode 0 +3 |
391 |
StrCpy $FILERECODE1 $R1 |
392 |
StrCpy $FILERECODE2 $R2 |
393 |
|
394 |
LineFindSend: |
395 |
StrCmp $R0 "1. LineFind" 0 LineReadSend |
396 |
StrCmp $FUNCTION LineFind 0 LineFindSend2 |
397 |
StrCmp $R4 "Example1" 0 +3 |
398 |
StrCpy $LINEFIND3 "3:-1" |
399 |
goto LineFindSend2 |
400 |
StrCmp $R4 "Example2" 0 +3 |
401 |
StrCpy $LINEFIND3 "{5:12 15 -6:-5 -1}" |
402 |
goto LineFindSend2 |
403 |
StrCmp $R4 "Example3" 0 +3 |
404 |
StrCpy $LINEFIND3 "2:3 10:-5 -3:-2" |
405 |
goto LineFindSend2 |
406 |
StrCmp $R4 "Example4" 0 +3 |
407 |
StrCpy $LINEFIND3 "10" |
408 |
goto LineFindSend2 |
409 |
StrCmp $R4 "Example5" 0 +3 |
410 |
StrCpy $LINEFIND3 "1:-1" |
411 |
goto LineFindSend2 |
412 |
StrCmp $R4 "Example6" 0 +3 |
413 |
StrCpy $LINEFIND3 "" |
414 |
goto LineFindSend2 |
415 |
StrCmp $R4 "Example7" 0 +2 |
416 |
StrCpy $LINEFIND3 "1:-1" |
417 |
|
418 |
LineFindSend2: |
419 |
StrCpy $FUNCTION LineFind |
420 |
StrCmp $LINEFIND2 '/NUL' 0 +2 |
421 |
StrCpy $LINEFIND2 '' |
422 |
GetDlgItem $0 $HWND 1201 |
423 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:$LINEFIND1" |
424 |
GetDlgItem $0 $HWND 1203 |
425 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:$LINEFIND2" |
426 |
GetDlgItem $0 $HWND 1205 |
427 |
ShowWindow $0 1 |
428 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:$LINEFIND3" |
429 |
GetDlgItem $0 $HWND 1207 |
430 |
ShowWindow $0 1 |
431 |
GetDlgItem $0 $HWND 1211 |
432 |
ShowWindow $0 1 |
433 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:Edit" |
434 |
GetDlgItem $0 $HWND 1212 |
435 |
ShowWindow $0 1 |
436 |
StrCmp $LOG '' +2 |
437 |
EnableWindow $0 1 |
438 |
GetDlgItem $0 $HWND 1213 |
439 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:InputFile" |
440 |
GetDlgItem $0 $HWND 1214 |
441 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:OutputFile" |
442 |
GetDlgItem $0 $HWND 1215 |
443 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:Range" |
444 |
GetDlgItem $0 $HWND 1216 |
445 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:Function" |
446 |
|
447 |
StrCmp $R4 "Example7" 0 +9 |
448 |
GetDlgItem $0 $HWND 1203 |
449 |
EnableWindow $0 0 |
450 |
SendMessage $0 ${WM_ENABLE} 1 0 |
451 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:/NUL" |
452 |
GetDlgItem $0 $HWND 1204 |
453 |
EnableWindow $0 0 |
454 |
GetDlgItem $0 $HWND 1211 |
455 |
EnableWindow $0 0 |
456 |
abort |
457 |
|
458 |
|
459 |
LineReadSend: |
460 |
StrCmp $R0 "2. LineRead" 0 FileReadFromEndSend |
461 |
StrCpy $FUNCTION LineRead |
462 |
GetDlgItem $0 $HWND 1201 |
463 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:$LINEREAD1" |
464 |
GetDlgItem $0 $HWND 1203 |
465 |
ShowWindow $0 1 |
466 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:$LINEREAD2" |
467 |
GetDlgItem $0 $HWND 1204 |
468 |
ShowWindow $0 0 |
469 |
GetDlgItem $0 $HWND 1205 |
470 |
ShowWindow $0 0 |
471 |
GetDlgItem $0 $HWND 1211 |
472 |
ShowWindow $0 0 |
473 |
GetDlgItem $0 $HWND 1212 |
474 |
ShowWindow $0 0 |
475 |
GetDlgItem $0 $HWND 1213 |
476 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:InputFile" |
477 |
GetDlgItem $0 $HWND 1214 |
478 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:Line #" |
479 |
GetDlgItem $0 $HWND 1215 |
480 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:" |
481 |
GetDlgItem $0 $HWND 1216 |
482 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:" |
483 |
Abort |
484 |
|
485 |
FileReadFromEndSend: |
486 |
StrCmp $R0 "3. FileReadFromEnd" 0 LineSumSend |
487 |
StrCpy $FUNCTION FileReadFromEnd |
488 |
GetDlgItem $0 $HWND 1201 |
489 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:$FILEREADFROMEND1" |
490 |
GetDlgItem $0 $HWND 1203 |
491 |
ShowWindow $0 0 |
492 |
GetDlgItem $0 $HWND 1204 |
493 |
ShowWindow $0 0 |
494 |
GetDlgItem $0 $HWND 1205 |
495 |
ShowWindow $0 0 |
496 |
GetDlgItem $0 $HWND 1209 |
497 |
ShowWindow $0 1 |
498 |
GetDlgItem $0 $HWND 1211 |
499 |
ShowWindow $0 1 |
500 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:View" |
501 |
GetDlgItem $0 $HWND 1212 |
502 |
ShowWindow $0 0 |
503 |
GetDlgItem $0 $HWND 1213 |
504 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:InputFile" |
505 |
GetDlgItem $0 $HWND 1214 |
506 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:" |
507 |
GetDlgItem $0 $HWND 1215 |
508 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:" |
509 |
GetDlgItem $0 $HWND 1216 |
510 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:Function" |
511 |
Abort |
512 |
|
513 |
LineSumSend: |
514 |
StrCmp $R0 "4. LineSum" 0 FileJoinSend |
515 |
StrCpy $FUNCTION LineSum |
516 |
GetDlgItem $0 $HWND 1201 |
517 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:$LINESUM1" |
518 |
GetDlgItem $0 $HWND 1203 |
519 |
ShowWindow $0 0 |
520 |
GetDlgItem $0 $HWND 1204 |
521 |
ShowWindow $0 0 |
522 |
GetDlgItem $0 $HWND 1205 |
523 |
ShowWindow $0 0 |
524 |
GetDlgItem $0 $HWND 1211 |
525 |
ShowWindow $0 0 |
526 |
GetDlgItem $0 $HWND 1212 |
527 |
ShowWindow $0 0 |
528 |
GetDlgItem $0 $HWND 1213 |
529 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:InputFile" |
530 |
GetDlgItem $0 $HWND 1214 |
531 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:" |
532 |
GetDlgItem $0 $HWND 1215 |
533 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:" |
534 |
GetDlgItem $0 $HWND 1216 |
535 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:" |
536 |
Abort |
537 |
|
538 |
FileJoinSend: |
539 |
StrCmp $R0 "5. FileJoin" 0 TextCompareSend |
540 |
StrCpy $FUNCTION FileJoin |
541 |
GetDlgItem $0 $HWND 1201 |
542 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:$FILEJOIN1" |
543 |
GetDlgItem $0 $HWND 1203 |
544 |
ShowWindow $0 1 |
545 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:$FILEJOIN2" |
546 |
GetDlgItem $0 $HWND 1204 |
547 |
ShowWindow $0 1 |
548 |
GetDlgItem $0 $HWND 1205 |
549 |
ShowWindow $0 1 |
550 |
EnableWindow $0 1 |
551 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:$FILEJOIN3" |
552 |
GetDlgItem $0 $HWND 1206 |
553 |
ShowWindow $0 1 |
554 |
GetDlgItem $0 $HWND 1211 |
555 |
ShowWindow $0 0 |
556 |
GetDlgItem $0 $HWND 1212 |
557 |
ShowWindow $0 0 |
558 |
GetDlgItem $0 $HWND 1213 |
559 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:InputFile1" |
560 |
GetDlgItem $0 $HWND 1214 |
561 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:InputFile2" |
562 |
GetDlgItem $0 $HWND 1215 |
563 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:OutputFile" |
564 |
GetDlgItem $0 $HWND 1216 |
565 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:" |
566 |
Abort |
567 |
|
568 |
TextCompareSend: |
569 |
StrCmp $R0 "6. TextCompare" 0 ConfigReadSend |
570 |
StrCmp $FUNCTION TextCompare 0 TextCompareSend2 |
571 |
StrCmp $R5 "Example1" 0 +3 |
572 |
StrCpy $TEXTCOMPARE3 "FastDiff" |
573 |
goto TextCompareSend2 |
574 |
StrCmp $R5 "Example2" 0 +3 |
575 |
StrCpy $TEXTCOMPARE3 "FastDiff" |
576 |
goto TextCompareSend2 |
577 |
StrCmp $R5 "Example3" 0 +3 |
578 |
StrCpy $TEXTCOMPARE3 "FastEqual" |
579 |
goto TextCompareSend2 |
580 |
StrCmp $R5 "Example4" 0 +3 |
581 |
StrCpy $TEXTCOMPARE3 "SlowDiff" |
582 |
goto TextCompareSend2 |
583 |
StrCmp $R5 "Example5" 0 +2 |
584 |
StrCpy $TEXTCOMPARE3 "SlowEqual" |
585 |
|
586 |
TextCompareSend2: |
587 |
StrCpy $FUNCTION TextCompare |
588 |
GetDlgItem $0 $HWND 1201 |
589 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:$TEXTCOMPARE1" |
590 |
GetDlgItem $0 $HWND 1203 |
591 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:$TEXTCOMPARE2" |
592 |
GetDlgItem $0 $HWND 1204 |
593 |
ShowWindow $0 1 |
594 |
GetDlgItem $0 $HWND 1205 |
595 |
ShowWindow $0 1 |
596 |
EnableWindow $0 0 |
597 |
SendMessage $0 ${WM_ENABLE} 1 0 |
598 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:$TEXTCOMPARE3" |
599 |
GetDlgItem $0 $HWND 1208 |
600 |
ShowWindow $0 1 |
601 |
GetDlgItem $0 $HWND 1211 |
602 |
ShowWindow $0 1 |
603 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:View" |
604 |
GetDlgItem $0 $HWND 1212 |
605 |
ShowWindow $0 1 |
606 |
GetDlgItem $0 $HWND 1213 |
607 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:TextFile1" |
608 |
GetDlgItem $0 $HWND 1214 |
609 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:TextFile2" |
610 |
GetDlgItem $0 $HWND 1215 |
611 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:Option" |
612 |
GetDlgItem $0 $HWND 1216 |
613 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:Function" |
614 |
abort |
615 |
|
616 |
ConfigReadSend: |
617 |
StrCmp $R0 "7. ConfigRead" 0 ConfigWriteSend |
618 |
StrCpy $FUNCTION ConfigRead |
619 |
GetDlgItem $0 $HWND 1201 |
620 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:$CONFIGREAD1" |
621 |
GetDlgItem $0 $HWND 1203 |
622 |
ShowWindow $0 1 |
623 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:$CONFIGREAD2" |
624 |
GetDlgItem $0 $HWND 1204 |
625 |
ShowWindow $0 0 |
626 |
GetDlgItem $0 $HWND 1205 |
627 |
ShowWindow $0 0 |
628 |
GetDlgItem $0 $HWND 1211 |
629 |
ShowWindow $0 0 |
630 |
GetDlgItem $0 $HWND 1212 |
631 |
ShowWindow $0 0 |
632 |
GetDlgItem $0 $HWND 1213 |
633 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:InputFile" |
634 |
GetDlgItem $0 $HWND 1214 |
635 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:Entry" |
636 |
GetDlgItem $0 $HWND 1215 |
637 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:" |
638 |
GetDlgItem $0 $HWND 1216 |
639 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:" |
640 |
Abort |
641 |
|
642 |
ConfigWriteSend: |
643 |
StrCmp $R0 "8. ConfigWrite" 0 FileRecodeSend |
644 |
StrCpy $FUNCTION ConfigWrite |
645 |
GetDlgItem $0 $HWND 1201 |
646 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:$CONFIGWRITE1" |
647 |
GetDlgItem $0 $HWND 1203 |
648 |
ShowWindow $0 1 |
649 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:$CONFIGWRITE2" |
650 |
GetDlgItem $0 $HWND 1204 |
651 |
ShowWindow $0 0 |
652 |
GetDlgItem $0 $HWND 1205 |
653 |
ShowWindow $0 1 |
654 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:$CONFIGWRITE3" |
655 |
GetDlgItem $0 $HWND 1211 |
656 |
ShowWindow $0 0 |
657 |
GetDlgItem $0 $HWND 1212 |
658 |
ShowWindow $0 0 |
659 |
GetDlgItem $0 $HWND 1213 |
660 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:InputFile" |
661 |
GetDlgItem $0 $HWND 1214 |
662 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:Entry" |
663 |
GetDlgItem $0 $HWND 1215 |
664 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:Value" |
665 |
GetDlgItem $0 $HWND 1216 |
666 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:" |
667 |
Abort |
668 |
|
669 |
FileRecodeSend: |
670 |
StrCmp $R0 "9. FileRecode" 0 Abort |
671 |
StrCpy $FUNCTION FileRecode |
672 |
GetDlgItem $0 $HWND 1201 |
673 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:$FILERECODE1" |
674 |
GetDlgItem $0 $HWND 1203 |
675 |
ShowWindow $0 1 |
676 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:$FILERECODE2" |
677 |
GetDlgItem $0 $HWND 1204 |
678 |
ShowWindow $0 0 |
679 |
GetDlgItem $0 $HWND 1205 |
680 |
ShowWindow $0 0 |
681 |
GetDlgItem $0 $HWND 1211 |
682 |
ShowWindow $0 0 |
683 |
GetDlgItem $0 $HWND 1212 |
684 |
ShowWindow $0 0 |
685 |
GetDlgItem $0 $HWND 1213 |
686 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:InputFile" |
687 |
GetDlgItem $0 $HWND 1214 |
688 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:Format" |
689 |
GetDlgItem $0 $HWND 1215 |
690 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:" |
691 |
GetDlgItem $0 $HWND 1216 |
692 |
SendMessage $0 ${WM_SETTEXT} 1 "STR:" |
693 |
Abort |
694 |
|
695 |
;=Enter= |
696 |
Enter: |
697 |
StrCmp $R1 '' 0 +3 |
698 |
StrCpy $0 'Choose InputFile' |
699 |
goto send |
700 |
IfFileExists $R1 +3 |
701 |
StrCpy $0 'InputFile is not exist' |
702 |
goto send |
703 |
|
704 |
StrCmp $R0 "1. LineFind" LineFindRead |
705 |
StrCmp $R0 "2. LineRead" LineRead |
706 |
StrCmp $R0 "3. FileReadFromEnd" FileReadFromEnd |
707 |
StrCmp $R0 "4. LineSum" LineSum |
708 |
StrCmp $R0 "5. FileJoin" FileJoin |
709 |
StrCmp $R0 "6. TextCompare" LineFind-TextCompare |
710 |
StrCmp $R0 "7. ConfigRead" ConfigRead |
711 |
StrCmp $R0 "8. ConfigWrite" ConfigWrite |
712 |
StrCmp $R0 "9. FileRecode" FileRecode |
713 |
Abort |
714 |
|
715 |
LineFindRead: |
716 |
StrCmp $R4 "Example7" 0 LineFind-TextCompare |
717 |
${LineFind} '$R1' '/NUL' '$R3' LineFindCallback |
718 |
IfErrors error |
719 |
StrCmp $R0 StopLineFind 0 done |
720 |
StrCpy $0 'stopped' |
721 |
goto send |
722 |
|
723 |
LineFind-TextCompare: |
724 |
GetLabelAddress $6 LineFindBack |
725 |
goto Edit |
726 |
LineFindBack: |
727 |
FileClose $0 |
728 |
StrCmp $R0 "6. TextCompare" Compile |
729 |
StrCmp $CALLBACK '' Compile |
730 |
${FileJoin} "$PROJECT" "$CALLBACK" "" |
731 |
|
732 |
Compile: |
733 |
StrCmp $LOG '' 0 +4 |
734 |
GetTempFileName $LOG $PLUGINSDIR |
735 |
GetDlgItem $0 $HWND 1212 |
736 |
EnableWindow $0 1 |
737 |
ReadRegStr $0 HKLM "SOFTWARE\NSIS" "" |
738 |
IfErrors 0 +2 |
739 |
StrCpy $0 "${NSISDIR}" |
740 |
nsExec::Exec '"$0\makensis.exe" /O$LOG $PROJECT' |
741 |
Pop $0 |
742 |
StrCmp $0 0 0 +6 |
743 |
ExecWait '$PROJECT.exe' $0 |
744 |
Delete $PROJECT |
745 |
Delete $PROJECT.exe |
746 |
StrCpy $PROJECT '' |
747 |
goto done |
748 |
MessageBox MB_YESNO|MB_ICONEXCLAMATION "Compile error. Open log?" IDNO +2 |
749 |
Exec 'notepad.exe $LOG' |
750 |
StrCpy $0 "Compile Error" |
751 |
goto send |
752 |
|
753 |
LineRead: |
754 |
${LineRead} "$R1" "$R2" $0 |
755 |
IfErrors error send |
756 |
|
757 |
FileReadFromEnd: |
758 |
${FileReadFromEnd} "$R1" "FileReadFromEndCallback" |
759 |
IfErrors error |
760 |
StrCmp $R0 StopFileReadFromEnd 0 done |
761 |
StrCpy $0 'stopped' |
762 |
goto send |
763 |
|
764 |
LineSum: |
765 |
${LineSum} "$R1" $0 |
766 |
IfErrors error send |
767 |
|
768 |
FileJoin: |
769 |
${FileJoin} "$R1" "$R2" "$R3" |
770 |
IfErrors error |
771 |
MessageBox MB_YESNO " Open output file?" IDNO done |
772 |
StrCmp $R3 '' 0 +3 |
773 |
Exec '"notepad.exe" "$R1"' |
774 |
goto done |
775 |
Exec '"notepad.exe" "$R3"' |
776 |
goto done |
777 |
|
778 |
ConfigRead: |
779 |
${ConfigRead} "$R1" "$R2" $0 |
780 |
IfErrors error send |
781 |
|
782 |
ConfigWrite: |
783 |
${ConfigWrite} "$R1" "$R2" "$R3" $0 |
784 |
IfErrors error |
785 |
MessageBox MB_YESNO " Open output file?" IDNO send |
786 |
Exec '"notepad.exe" "$R1"' |
787 |
goto send |
788 |
|
789 |
FileRecode: |
790 |
${FileRecode} "$R1" "$R2" |
791 |
IfErrors error |
792 |
MessageBox MB_YESNO " Open output file?" IDNO done |
793 |
Exec '"notepad.exe" "$R1"' |
794 |
goto done |
795 |
|
796 |
error: |
797 |
StrCpy $0 'error' |
798 |
goto send |
799 |
|
800 |
done: |
801 |
StrCpy $0 'Done' |
802 |
|
803 |
send: |
804 |
GetDlgItem $1 $HWND 1210 |
805 |
SendMessage $1 ${WM_SETTEXT} 1 "STR:$0" |
806 |
|
807 |
abort: |
808 |
Abort |
809 |
FunctionEnd |
810 |
|
811 |
Function LineFindCallback |
812 |
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 |
813 |
StrCpy $R0 StopLineFind |
814 |
|
815 |
Push $R0 |
816 |
FunctionEnd |
817 |
|
818 |
Function FileReadFromEndCallback |
819 |
MessageBox MB_OKCANCEL '$$9 "Line"=[$9]$\n$$8 "#"=[$8]$\n$$7 "-#"=[$7]' IDOK +2 |
820 |
StrCpy $R0 StopFileReadFromEnd |
821 |
|
822 |
Push $R0 |
823 |
FunctionEnd |
824 |
|
825 |
Function .onInit |
826 |
InitPluginsDir |
827 |
GetTempFileName $INI $PLUGINSDIR |
828 |
File /oname=$INI "TextFunc.ini" |
829 |
FunctionEnd |
830 |
|
831 |
Page instfiles |
832 |
|
833 |
Section -Empty |
834 |
SectionEnd |