Old 13th December 2011, 12:09   #1
NOCaut
Senior Member
 
Join Date: Sep 2011
Posts: 106
parsing txt file problem

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

Quote:
=== 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
NOCaut is offline   Reply With Quote
Old 13th December 2011, 16:11   #2
NOCaut
Senior Member
 
Join Date: Sep 2011
Posts: 106
Quote:
Function Example7
MessageBox MB_OK $R9
StrCpy $0 StopLineFind

Push $0
FunctionEnd

Function .onInit

${LineFind} "C:\2.txt" "/NUL" "15:-15" "Example7"
not help (
NOCaut is offline   Reply With Quote
Old 13th December 2011, 16:21   #3
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
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.
MSG is offline   Reply With Quote
Old 14th December 2011, 07:09   #4
NOCaut
Senior Member
 
Join Date: Sep 2011
Posts: 106
please write example i not understand function return one sumbul

Quote:
"15"
"1:-1"
"-1:1"
"-1:15"
"15:-1"
NOCaut is offline   Reply With Quote
Old 14th December 2011, 07:17   #5
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
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.
MSG is offline   Reply With Quote
Old 14th December 2011, 07:21   #6
NOCaut
Senior Member
 
Join Date: Sep 2011
Posts: 106
problem in the text file function not work with this text!!!!! helps
NOCaut is offline   Reply With Quote
Old 14th December 2011, 07:54   #7
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
"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.
MSG is offline   Reply With Quote
Old 14th December 2011, 08:07   #8
NOCaut
Senior Member
 
Join Date: Sep 2011
Posts: 106
what? it is all my code!!! I repit: "function return one simbul 'a' or 't'"

if i take file

1.txt:
Quote:
111
222
333
2.txt

Quote:
=== 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!!
NOCaut is offline   Reply With Quote
Old 14th December 2011, 08:20   #9
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
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.
MSG is offline   Reply With Quote
Old 14th December 2011, 08:45   #10
NOCaut
Senior Member
 
Join Date: Sep 2011
Posts: 106
Quote:
${LineFind} "C:\2.txt" "/NUL" "1:-1" "Example7"
IfErrors 0 +2
MessageBox MB_OK "Error"
nothing
NOCaut is offline   Reply With Quote
Old 16th December 2011, 17:18   #11
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
Quoted from your other thread:
Quote:
Originally Posted by NOCaut View Post
Quote:
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:
Quote:
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.
MSG is offline   Reply With Quote
Old 16th December 2011, 20:45   #12
demiller9
Senior Member
 
Join Date: Mar 2006
Location: Dallas
Posts: 462
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.
demiller9 is offline   Reply With Quote
Old 19th December 2011, 04:35   #13
T.Slappy
Major Dude
 
T.Slappy's Avatar
 
Join Date: Jan 2006
Location: Slovakia
Posts: 531
Send a message via ICQ to T.Slappy
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.

Cool looking installer with custom design: www.graphical-installer.com
I offer NSIS scripting, C/C++/C#/Delphi programming: www.unsigned.sk
Develop NSIS projects in Visual Studio 2005-2019: www.visual-installer.com
or RAD Studio 2009, 2010, XE-10.3 Rio: www.rad-installer.com
T.Slappy is offline   Reply With Quote
Old 19th December 2011, 07:25   #14
NOCaut
Senior Member
 
Join Date: Sep 2011
Posts: 106
messagebox before opened file not helped. i think problem in unicode
NOCaut is offline   Reply With Quote
Old 23rd December 2011, 08:13   #15
NOCaut
Senior Member
 
Join Date: Sep 2011
Posts: 106
I find problem. *.msi file return log file in unicode encoding. i take unicode file read function end all work good
NOCaut is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast 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