Analyze text: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
Line 7: | Line 7: | ||
<highlight-nsis> | <highlight-nsis> | ||
OutFile "AnalyzeWords.exe" | OutFile "AnalyzeWords.exe" | ||
ShowInstDetails show | |||
;Includes | ;Includes | ||
Line 15: | Line 16: | ||
;Section | ;Section | ||
Section | Section | ||
StrCpy $0 " | StrCpy $0 "EXE TXT BMP JPG END" ;input | ||
DetailPrint "The input-string '$0' consists of:" | |||
Loop: | Loop: | ||
Sleep 1000 | |||
${WordFind} $0 " " "+1" $1 | ${WordFind} $0 " " "+1" $1 | ||
Detailprint "'$1'" ;replace with your function | |||
${WordFind2X} $0 $1 " " "-1}}" $0 | ${WordFind2X} $0 $1 " " "-1}}" $0 | ||
StrCmp $0 $1 End Loop | StrCmp $0 $1 End Loop | ||
End: | End: | ||
SectionEnd | SectionEnd | ||
</highlight-nsis> | </highlight-nsis> | ||
[[Category:Text Files Manipulation Functions]] | [[Category:Text Files Manipulation Functions]] |
Revision as of 00:07, 2 November 2006
Author: Jan (talk, contrib) |
Description
A function that analyzes every word from a sequence of words (i.e. a sentence). To give a scenario for using this, think of an InstallOptions page, where the user can specify extensions the installed application should be associated with. The example script below reads the file-types from a sequence of extensions seperated by spaces.
The Script
OutFile "AnalyzeWords.exe" ShowInstDetails show ;Includes !include "WordFunc.nsh" !insertmacro WordFind !insertmacro WordFind2X ;Section Section StrCpy $0 "EXE TXT BMP JPG END" ;input DetailPrint "The input-string '$0' consists of:" Loop: Sleep 1000 ${WordFind} $0 " " "+1" $1 Detailprint "'$1'" ;replace with your function ${WordFind2X} $0 $1 " " "-1}}" $0 StrCmp $0 $1 End Loop End: SectionEnd