Analyze text: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
No edit summary
Line 15: Line 15:
;Section
;Section
Section
Section
   ReadIniStr $0 "exe txt bmp jpg end" ;input
   StrCpy $0 "exe txt bmp jpg end" ;input string
    
    
  Loop:
  Loop:

Revision as of 00:02, 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"
 
;Includes
  !include "WordFunc.nsh"
  !insertmacro WordFind
  !insertmacro WordFind2X
 
;Section
Section
  StrCpy $0 "exe txt bmp jpg end" ;input string
 
 Loop:
  ${WordFind} $0 " " "+1" $1
  MessageBox MB_OK "'$1'" ;replace with your function
 
  ${WordFind2X} $0 $1 " " "-1}}" $0
  StrCmp $0 $1 End Loop
 
 End:
  MessageBox MB_OK "Game Over!"
 
SectionEnd