Archive: parsing txt file problem


parsing txt file problem
Please help parsing this file. greedy function did not help me.

=== Logging started: 13.12.2011 13:39:00 ===
Action 13:39:00: INSTALL.
Action start 13:39:00: INSTALL.
=== Logging started: 13.12.2011 13:39:00 ===
Action start 13:39:00: INSTALL.
Action start 13:39:00: FindRelatedProducts.
Action ended 13:39:00: FindRelatedProducts. Return value 0.
Action start 13:39:00: CA_SystemFolder_x86.3643236F_FC70_11D3_A536_0090278A1BB8.
Action ended 13:39:00: CA_SystemFolder_x86.3643236F_FC70_11D3_A536_0090278A1BB8. Return value 1.
Action start 13:39:00: CA_WindowsFolder_x86.3643236F_FC70_11D3_A536_0090278A1BB8.
Action ended 13:39:00: CA_WindowsFolder_x86.3643236F_FC70_11D3_A536_0090278A1BB8. Return value 1.
Action start 13:39:00: LaunchConditions.
Action ended 13:39:00: LaunchConditions. Return value 0.
Action start 13:39:00: AppSearch.
Action ended 13:39:00: AppSearch. Return value 1.
i want check AppSearch 1 or 0

Function Example7
MessageBox MB_OK $R9
StrCpy $0 StopLineFind

Push $0
FunctionEnd

Function .onInit

${LineFind} "C:\2.txt" "/NUL" "15:-15" "Example7"
not help (

Of course it doesn't help. You're telling it to start looking at line 15, and stop looking at line -15 (this means: 15 lines before the end of the file). If there are only 15 lines in the file, that ends up not looking at any line at all.


please write example i not understand function return one sumbul

"15"
"1:-1"
"-1:1"
"-1:15"
"15:-1"

There are examples in the manual: http://nsis.sourceforge.net/Docs/AppendixE.html#E.2.2

The line range works like this: First number is the starting line, second number is the ending line. The function will search the file between those two lines. Obviously, if the ending line is before the starting line, no lines will be searched at all.

Negative numbers simply mean: So many lines before the end of the file. So -1 is the last line, -2 is the line before that.


problem in the text file function not work with this text!!!!! helps


"not work" doesn't mean anything.

1. What did you try? (Hint: a small code example would help.)
2. What did you expect to happen?
3. What actually happened?

This is the last time I'm going to explain to you how to ask a question. Next time, if you just say "HELP" without giving any information, I'm just going to ignore you.


what? it is all my code!!! I repit: "function return one simbul 'a' or 't'"

if i take file

1.txt:

111
222
333
2.txt

=== Logging started: 13.12.2011 13:39:00 ===
Action 13:39:00: INSTALL.
Action start 13:39:00: INSTALL.
=== Logging started: 13.12.2011 13:39:00 ===
${LineFind} "C:\1.txt" "/NUL" "1:-1" "Example7" -function return "1111" - it is means -work!!
${LineFind} "C:\2.txt" "/NUL" "1:-1" "Example7" -function return "a" - it is means -not work!!

Stop shouting please. You are the one being unclear, not I.

The syntax in your last post seems ok. If it works on one file but not another, this suggests that there is a problem opening the file. I suggest you pause the installer just before the linefind command using a MessageBox. Then first manually check whether or not the file exists, and what it contains. Then allow linefind to try and read it.

Also, check the error flag.


${LineFind} "C:\2.txt" "/NUL" "1:-1" "Example7"
IfErrors 0 +2
MessageBox MB_OK "Error"
nothing

Quoted from your other thread:

Originally posted by NOCaut
FileOpen $R4 "e:\vc_log.txt" r
StrCpy $R8 0
Top:
FileRead $R4 $R7
IntOp $R8 $R8 + 1
MEssagebox MB_OK R7 ; return= a or t or 3....

vc_log.txt:
=== Logging started: 16.12.2011 18:17:49 ===
Action 18:17:49: INSTALL.
Action start 18:17:49: INSTALL.
=== Logging started: 16.12.2011 18:17:49 ==
(etc...)
First of all, there is no MessageBox command in the code you posted. I am going to assume that this is what you meant:
FileOpen $R4 "e:\vc_log.txt" r
StrCpy $R8 0
Top:
FileRead $R4 $R7
IntOp $R8 $R8 + 1
MEssagebox MB_OK R7 ; return= a or t or 3....
My reply to this is the same as before: The syntax in your last post seems ok. If it works on one file but not another, this suggests that there is a problem opening the file. I suggest you pause the installer just before the linefind command using a MessageBox. Then first manually check whether or not the file exists, and what it contains. Then allow linefind to try and read it.

It sounds to me like the file is Unicode encoded, but processing thinks it will be Ansi. The high part of the first unicode char looks like a null terminator, and the single character is the entire line.


Writing simple C plug-in would solve all your problems.
There may be some catch in your text files [like Unicode format] which can be handled easily in C.


messagebox before opened file not helped. i think problem in unicode


I find problem. *.msi file return log file in unicode encoding. i take unicode file read function end all work good