|
|
#1 |
|
Major Dude
Join Date: Jul 2004
Posts: 655
|
TextReplace plugin
Features:
- Fast replacement in text file - Case sensitive/insensitive replacement - Supports strings and pointers to the buffer - If no changes possible, output file will be untouched - Checks before replacement, if input file is a binary file Rough estimate perfomance info: 50 Mb text file with 4.000.000 strings to replace processed with option "/S=1" 4 sec, with option "/S=0" 37 sec "TextReplace" plugin v1.0 Removed attachment 18 July 2006 - Afrow UK. See last post for latest version. |
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Aug 2005
Location: Brazil
Posts: 108
|
Great and useful plugin, thanks a lot Instructor
|
|
|
|
|
|
#3 |
|
Major Dude
Join Date: Jul 2004
Posts: 655
|
You are welcome
|
|
|
|
|
|
#4 |
|
Major Dude
Join Date: Jul 2004
Posts: 655
|
New: "FindInFile" only search in file without replacements
New: "ReplaceInFile" options: /AI=[1|0] -Copy attributes from the InputFile to OutputFile or not /AO=[0|1] -Change OutputFile attributes to normal before writting or not "TextReplace" plugin v1.1 |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Jan 2006
Posts: 9
|
Thanks for the great plugin Instructor!
I'm a bit confused to what the options are. If AI is true, does that mean read/write/execute/other attributes of the InputFile will be kept the same when written out? If AO is true, does it mean change attributes to some standard? Not taking any risks in life, is taking the biggest risk. |
|
|
|
|
|
#6 | ||
|
Major Dude
Join Date: Jul 2004
Posts: 655
|
Quote:
Quote:
-9 can't open output file for writting For example: If "/AO=0" and OutputFile has read-only attribute, then error -9 will be returned. If "/AO=1" and OutputFile has read-only attribute, then no error will be returned. |
||
|
|
|
|
|
#7 |
|
Junior Member
Join Date: Jan 2006
Posts: 9
|
Thanks for the quick reply.
That clears things up! Not taking any risks in life, is taking the biggest risk. |
|
|
|
|
|
#8 |
|
Guest
Posts: n/a
|
Hi Instructor can i get the source code please
I'm taking C++ now. Actually this is first course, so i need something to practice, you know. |
|
|
|
#9 | |
|
Major Dude
Join Date: Jul 2004
Posts: 655
|
Quote:
|
|
|
|
|
|
|
#10 |
|
Guest
Posts: n/a
|
I didn't see it before....
|
|
|
|
#11 |
|
Major Dude
Join Date: Jul 2004
Posts: 655
|
Fixed: Now plugin doesn't read all file if it is binary.
Updated: "StrFunc.h" to v1.7 Updated: "ConvFunc.h" to v1.7 Update from previous versions: - Insert line in script: !incl ude "TextReplace.nsh" - Replace: textrepl ace::FindInFile -> ${textreplace::FindInFile} ... - Replace: .r0 -> $0, .r1 -> $1 ... .R0 -> $R0, .R1 -> $R1 ... "TextReplace" plugin v1.2 |
|
|
|
|
|
#12 |
|
Senior Member
Join Date: Aug 2005
Location: Brazil
Posts: 108
|
Instructor, there is a bug in the plugin that makes files bigger than 128 bytes readonly|hidden|system|archive|temporary|offline|not_content_indexed.
|
|
|
|
|
|
#13 |
|
Major Dude
Join Date: Jul 2004
Posts: 655
|
Don't understand. If file size equal to 128 then after processing it attributes changed to readonly|hidden|system|archive|temporary|offline|not_content_indexed? And what plugin parameters you use?
|
|
|
|
|
|
#14 |
|
Senior Member
Join Date: Aug 2005
Location: Brazil
Posts: 108
|
Yes, I am just using TextReplaceTest.nsi that comes with the plugin. Attached are the input.txt and output.txt files and the exe.
|
|
|
|
|
|
#15 |
|
Major Dude
Join Date: Jul 2004
Posts: 655
|
Fixed: Buffer overflow (thanks zeeh3)
"TextReplace" plugin v1.3 |
|
|
|
|
|
#16 |
|
Major Dude
Join Date: Jul 2004
Posts: 655
|
Fixed: crash when using long string (> 1024) with 8192 special build (thanks zeeh3)
"TextReplace" plugin v1.4 |
|
|
|
|
|
#17 |
|
Major Dude
Join Date: Jul 2004
Posts: 655
|
Forgot to remove debug MessageBox in release.
"TextReplace" plugin v1.4 |
|
|
|
|
|
#18 |
|
Junior Member
Join Date: Oct 2006
Posts: 1
|
Thank you very much. You plugin just saved me much valuable time.
|
|
|
|
|
|
#19 |
|
Major Dude
Join Date: Jul 2004
Posts: 655
|
Changed: algorithm optimized - replacement speed increased.
"TextReplace" plugin v1.5 |
|
|
|
|
|
#20 |
|
Junior Member
Join Date: Apr 2008
Posts: 1
|
Replace one line with two lines
I am trying to replace one line of a text file with two lines, using TextReplace. The arrangement of info in the file looks something like this -
Line 1 Line 2 Line 3 Line 4 I am searching for "Line 3" and want to replace it with Line 3a Line 3b for a final file arrangement that looks like - Line 1 Line 2 Line 3a Line 3b Line 4 Here is the actual TextReplace line ${textreplace::ReplaceInFile} "$PROGRAMFILES\OpenOffice.org 2.4\share\dict\ooo\dictionary.lst" "$PROGRAMFILES\OpenOffice.org 2.4\share\dict\ooo\dictionary.lst" "THES en US th_en_US_v2" "THES en US th_en_US_v2 \r DICT en US en_US_OpenMedSpel \r" "/S=1" $0 This of course, does not produce the desired output. It looks like this Line 1 Line 2 Line 3a \r Line 3b \r Line 4 Any help with this problem would be appreciated. Thanks. |
|
|
|
|
|
#21 |
|
Major Dude
Join Date: Jul 2004
Posts: 655
|
\r -> $\r$\n
|
|
|
|
|
|
#22 |
|
Junior Member
Join Date: Jun 2004
Posts: 6
|
Hi,
What license the TextReplace v1.5 plugin is distributed under ? I can't find any license notice in the zip file or the home page (http://nsis.sourceforge.net/TextReplace_plugin). Thanks. |
|
|
|
|
|
#23 |
|
Major Dude
Join Date: Jul 2004
Posts: 655
|
nduboc
NSIS license. |
|
|
|
|
|
#24 | |
|
Junior Member
Join Date: Jun 2004
Posts: 6
|
Quote:
page of the NSIS web site, right ? |
|
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|