Kinook Software Forum

Kinook Software Forum (https://www.kinook.com/Forum/index.php)
-   [VBP] General Discussion (https://www.kinook.com/Forum/forumdisplay.php?f=2)
-   -   Replace in File (https://www.kinook.com/Forum/showthread.php?t=380)

chaoconnor 03-29-2004 09:11 AM

Replace in File
 
Good morning! The regular expression

works fine in PowerGREP and other Regular Expression editors, but not in Visual Build Pro. I keep getting:
Error expanding macros in property Find: Code: ^*>

Does Visual Build Pro use some sort of variation of Regular Expressions? Some background, I have a block of text that always starts with , I need to find that block of text and replace it with a standard XML header.

Thank you!

kevina 03-29-2004 01:20 PM

You need to double up the [ and ] symbols:

See this note in the Replace in File Action help file entry:

Note: Bracket characters [ ] and percent sign % characters within this field must be doubled up (just as in any other field), since these are normally interpreted by Visual Build Pro as referencing script code and macros within a field.


Kevin

chaoconnor 03-29-2004 02:47 PM

Ahh... Gotcha! Thanks, I must have completely missed that line in my readings.

One other quick question that seems to be more difficult than it should be. After the find and replace from the previous question is done there are three seperate files (there were three seperate files before hand and the search is run on each of them) Now basically what I want to do is copy the contents of each of those files to one file. What's the best way to go about this? Find and replace seems to just over-write the file, I guess what I need is something with append abilities.

Thank you!

kevina 03-29-2004 03:00 PM

You could interate over each file processed with a Process Files step, and use a Write File step to append each file's contents to a new file (put [vbld_FSO.OpenFile("%PROCFILES_FULLPATH%").ReadAll]
in the 'Text to write to file' textbox). Make sure you check the 'Append to File' checkbox.

Hope this is clear enough. If not I can provide a sample...

Kevin

chaoconnor 03-29-2004 03:22 PM

Thanks for the reply.

So I put a process file step in, which iterates through the three files. Beneath that step and one over I put a write file to the single file I'm trying to write with append checked off. I put [vbld_FSO.OpenFile("%PROCFILES_FULLPATH%").ReadAll] in the Text to write box, but I get the following error message:

Error expanding macros in property Text:

The macro does read as the correct file name, just FYI. Any ideas? Thanks again!

kevina 03-29-2004 03:25 PM

oops, I didn't test my reply very well, it should have been .OpenTextFile(), not .OpenFile()...

Let me know if that doesn't work for you..

Kevin

chaoconnor 03-29-2004 03:30 PM

Thank you! That did the trick! I appreciate all your help today!


All times are GMT -5. The time now is 08:09 PM.


Copyright © 1999-2023 Kinook Software, Inc.