Archive: Wordfind is not working properly


Wordfind is not working properly
hello Friends,
Wordfind is not working properly for me.
I have a big text file I would like to read one word in the text file. While finding application is not giving proper results.

Code
;--------------------------------
;Include Modern UI

!include "MUI.nsh"

;--------------------------------
;General

Outfile test.exe

;--------------------------------
;Pages

!insertmacro MUI_PAGE_INSTFILES

;--------------------------------
;including files

!include TextFunc.nsh
!insertmacro LineFind
!include WordFunc.nsh
!insertmacro WordReplace
!insertmacro WordFind

Function "MyFunction"
; $R9 current line
; $R8 current line number
; $R7 current line negative number
; $R6 current range of lines
; $R5 handle of a file opened to read
; $R4 handle of a file opened to write ($R4="" if "/NUL")

; you can use any string functions
; $R0-$R3 are not used (save data in them).
; ...
; var R0 "C:\Windows\Installer"

${WordFind} "$R9" " " "1" "$R0" ; get the First word
MessageBox MB_ICONQUESTION|MB_YESNO "$R0"

Push $0 ; If $var="StopLineFind" Then exit from function
; If $var="SkipWrite" Then skip current line (ignored if "/NUL")
FunctionEnd


Section "secDummy"
${LineFind} "test5.txt" "" "12" "MyFunction" ;12 = line number

SectionEnd

;--------------------------------
;Languages

!insertmacro MUI_LANGUAGE "English"


---------------My Text file sample
MSI (s) (04:54) [15:50:28:750]: Package we're running from ==> C:\WINDOWS\Installer\16a9af71.msi
MSI (s) (04:54) [15:50:28:750]: Package we're running from ==> C:\WINDOWS\Installer\16a9af72.msi
MSI (s) (04:54) [15:50:28:750]: Package we're running from ==> C:\WINDOWS\Installer\16a9af73.msi
MSI (s) (04:54) [15:50:28:750]: Package we're running from ==> C:\WINDOWS\Installer\16a9af74.msi
MSI (s) (04:54) [15:50:28:750]: Package we're running from ==> C:\WINDOWS\Installer\16a9af75.msi
MSI (s) (04:54) [15:50:28:750]: Package we're running from ==> C:\WINDOWS\Installer\16a9af76.msi
MSI (s) (04:54) [15:50:28:750]: Package we're running from ==> C:\WINDOWS\Installer\16a9af77.msi
v8
v9

=================================================

here it should display the result as "MSI", but it is displaying the result like below

MSI (s) (04:54) [15:50:28:750]: Package we're running from ==> C:\WINDOWS\Installer\16a9af71.msi



On a sample text file it is working fine, on big text file it is not giving the correct result also, it is just displaying some junk characters.

Any thing missing in my code. Please do the needfull.


It might be as simple as the "+" that you don't have in the call to WordFind:

 ${WordFind} "$R9" " " "+1" "$R0" ; get the First word

And the documentation says the second parameter for LineFind should be either a file or "/NUL"; you have an empty string.

Don

Opps - Sorry, I got it. Thanks Don.

But while trying with my original file it is not giving me the result. it is just displaying a Junk character.

Any file size limit, even I tried with a small file also..it is still giving me the errors.

I am enclosing the fiel for reference, Please verify.


sample text file


That file has Unicode in it. I don't know what you can use to read Unicode text. Perhaps the Unicode builds of NSIS could read it?

Don

Unicode build thread