Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 4th January 2008, 14:24   #1
ameer
Junior Member
 
ameer's Avatar
 
Join Date: Jul 2007
Location: India
Posts: 30
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.
ameer is offline   Reply With Quote
Old 4th January 2008, 14:40   #2
demiller9
Senior Member
 
Join Date: Mar 2006
Location: Dallas
Posts: 442
It might be as simple as the "+" that you don't have in the call to WordFind:
code:
${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
demiller9 is offline   Reply With Quote
Old 4th January 2008, 14:50   #3
ameer
Junior Member
 
ameer's Avatar
 
Join Date: Jul 2007
Location: India
Posts: 30
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.
ameer is offline   Reply With Quote
Old 4th January 2008, 14:53   #4
ameer
Junior Member
 
ameer's Avatar
 
Join Date: Jul 2007
Location: India
Posts: 30
sample text file
Attached Files
File Type: txt test2.txt (17.1 KB, 267 views)
ameer is offline   Reply With Quote
Old 4th January 2008, 18:28   #5
demiller9
Senior Member
 
Join Date: Mar 2006
Location: Dallas
Posts: 442
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
demiller9 is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump