Kinook Software Forum

Go Back   Kinook Software Forum > Visual Build Professional > [VBP] General Discussion
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 08-27-2004, 08:46 AM
mvermeulen mvermeulen is online now
Registered User
 
Join Date: 07-15-2003
Posts: 56
Send a message via Yahoo to mvermeulen
Conditional Text Search

Is there a function built into Visual Build Pro that will perform a text search on a file and based on the results, allow me to make a conditional decision?

If not, any recommendations or has someone done something similar?

Thanks,
Mark
Reply With Quote
  #2  
Old 08-27-2004, 11:46 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
The attached sample shows one way to achieve this.
Attached Files
File Type: bld searchfile.bld (559 Bytes, 1790 views)
Reply With Quote
  #3  
Old 01-14-2005, 05:38 PM
jdavidi jdavidi is online now
Registered User
 
Join Date: 10-27-2003
Posts: 38
Grettings!

I tried to combine the posted sample with a process files action (essentially, I am looking for the string "Client.dll" in a set of txt files), but am running into a syntax error.

Here is the conditional build rule:

[InStr(vbld_FSO().OpenTextFile(%PROCFILES_FULLPATH% ).ReadAll(), "Client.dll") > 0]

and here is the output:

Building global subroutine step 'get all csproj files'...
Loading a list of matching files...
Processing file 1 of 34: n:\netsource\buildlist114.txt
Building global subroutine step 'Write File'...
Error expanding macros in property condexpr: <Error at Line 1, Column 32 (Expected ')')
Code: InStr(vbld_FSO().OpenTextFile(n:\netsource\buildli st114.txt).ReadAll(), "Client.dll") > 0>
Build ended.

I threw some single quotes around %PROCFILES_FULLPATH% but that caused:

Building global subroutine step 'get all txt files'...
Loading a list of matching files...
Processing file 1 of 34: n:\netsource\buildlist114.txt
Building global subroutine step 'Write File'...
Error expanding macros in property condexpr: <Error at Line 1, Column 31 (Syntax error)
Code: InStr(vbld_FSO().OpenTextFile('n:\netsource\buildl ist114.txt').ReadAll(), "Client.dll") > 0>
Build ended.

Any ideas?
Reply With Quote
  #4  
Old 01-14-2005, 06:20 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
Try using double quotes rather than single to delimit the string.
Reply With Quote
  #5  
Old 01-18-2005, 06:11 PM
jdavidi jdavidi is online now
Registered User
 
Join Date: 10-27-2003
Posts: 38
I thank you for the quick response;

[InStr(vbld_FSO().OpenTextFile("%PROCFILES_FULLPATH %").ReadAll(), "Client.dll") > 0]

was indeed all that I needed. I had tried that initally, but had been thrown when I saw the output

Step 'Write File' build rule evaluates false: [InStr(LCase(vbld_FSO().OpenTextFile("%PROCFILES_FU LLPATH%").ReadAll())...

as I thought the %PROCFILES_FULLPATH% was being evaluated literally as a string, but this was not the case.

Works like a charm now, thanks again!

--jdavidi
Reply With Quote
  #6  
Old 01-18-2005, 06:15 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
The value is shown without macros/script expanded to provide more debug info. Otherwise it would only show the result of evaluation (i.e., "evaluates false: False" or "evaluates true: True").
Reply With Quote
Reply


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 02:00 AM.


Copyright © 1999-2023 Kinook Software, Inc.