Kinook Software Forums

Go Back   Kinook Software Forums > Visual Build Professional > [VBP] User Tips, Tricks and Samples

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 01-20-2011, 10:10 AM
CREvans CREvans is online now
Registered User
 
Join Date: 03-10-2008
Location: Iowa
Posts: 28
Suggestion needed for updating .bld file

Have an interesting scenario where I'm wanting to parse a VBPro .bld file and for every vbscript step, check for the instance of a given line and if that line is present, to put a new line just below it, while maintaining the original line. Like this:

Original:

Line 1
Line 2
Line 3

Desired output, with "Line 2" as the instance line:

Line 1
Line 2
Added Line
Line 3

It looks like the search/replace function isn't going to do what I want, since that will replace the existing line, not add a line after it. I don't know if this is possible from within vbpro itself, or if I'll need to develop something external to parse the .bld file.

Thanks in advance!
Scott
Reply With Quote
  #2  
Old 01-20-2011, 10:48 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 5,642
You should be able to use the object model for that. See the attached sample.
Attached Files
File Type: bld searchandreplace.bld (3.3 KB, 991 views)
Reply With Quote
  #3  
Old 01-20-2011, 02:43 PM
CREvans CREvans is online now
Registered User
 
Join Date: 03-10-2008
Location: Iowa
Posts: 28
That almost does what I need, but I'm actually only looking for a substring of the whole line, so what I actually need is:

Original lines:
ABCDE
FGHIJ
KLMNO

Search for FG

Final lines:
ABCDE
FGHIJ
PQRST
KLMNO

I'm sure I'm just mangling the regexp syntax and there should be an easy solution within the searchandreplace.bld framework that's you've already provided, I'm just not able to figure it out.

Scott
Reply With Quote
  #4  
Old 01-20-2011, 02:55 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 5,642
See attached.
Attached Files
File Type: bld searchandreplace2.bld (3.2 KB, 984 views)
Reply With Quote
  #5  
Old 01-20-2011, 03:07 PM
CREvans CREvans is online now
Registered User
 
Join Date: 03-10-2008
Location: Iowa
Posts: 28
Works perfectly! Thanks a ton!
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 Off
HTML code is Off



All times are GMT -5. The time now is 10:52 AM.


Copyright 1999-2019 Kinook Software, Inc.