Hi

You are already working with nant, that makes it all much more easy !

I would echo the result to a file / files
the #include to    c:\temp\Nr_Includes.txt   for example


In nant, load this file into a property :
http://nant.sourceforge.net/release/latest/help/tasks/loadfile.html

now you can easily do any nant magic

I would advise you to learn a bit of C#, Nant supports built in scripts,
so there is no need for X amount of loose batch files floating around.



with kind regards
Ruben Willems


On Thu, Apr 9, 2009 at 3:42 PM, madhu nambiar <[email protected]>wrote:

> Hi ruben,
>         I am able to get the value frm the vb script to a batch file named
> test.bat
>
> My Vb script is as follows
> dim sampletext, objRegExp, SearchPattern, matches
> Dim Flag
>
> Set FSO = CreateObject("Scripting.FileSystemObject")
> Set TS = FSO.OpenTextFile("C:\MyProj\Sources\Application.c", 1)
> s = TS.ReadAll
> TS.Close
> Set TS = Nothing
>
>
> sampletext = s
> flag = 0
> '// enter the search pattern here
> SearchPattern = "#define" ' opening quote
>
> '// create a new instance of the regular expression object
> Set objRegExp = New RegExp
>
> objRegExp.Pattern = searchpattern ' apply the search pattern
> objRegExp.Global = True ' match all instances if the serach pattern
> objRegExp.IgnoreCase = True ' ignore case
>
> '// find all occurences of the search pattern in the sample text
> Set matches = objRegExp.execute(sampletext)
>
> If matches.Count > 0 Then ' there was at least one match to the search
> pattern
>   For Each match in matches
>  flag=flag+1
>   Next
> Else ' there were no matches found
>  msgbox "Nothing Found"
> End If
>
> '// releast the reg exp object
> Set objRegExp = nothing
> 'msgbox flag
> wscript.echo flag
>
> and my batch file ie .bat file which calls my VB script is shown below
>
> @echo off
> for /f "delims=" %%a in ('C:\MyProj\Sources\SearchString.vbs') do (
> set ScriptOut=%%a)
> #echo Script Result = %ScriptOut%
>
> so now u can see that when i run my batch files through command prompt i am
> able to get the number of #defines which is being echoed.Now that is i am
> able to get the result in a variable named "Script Result "
> I want to know is how do we integrate with nant in such a way that i am
> able to get the Script Result value so that i can compare and do the
> neccessary validation??
>
> With kind regards
> Maddy
>
>
>
> On Thu, Apr 9, 2009 at 7:02 PM, Ruben Willems <[email protected]>wrote:
>
>> Hi
>>
>>
>> the logic must be in the script or batch file
>> example
>>
>> total lines      100
>> include lines     5
>>
>> this is ok -> exit with return code 0
>>
>>
>> total lines      100
>> include lines     95
>>
>> this is not ok --> exit with return code different from 0, eg.: 1
>>
>>
>> now when you execute the task, and the result is not ok for the smoke test
>> this will fail the build
>>
>>
>>
>> with kind regards
>> Ruben Willems
>>
>>
>>   On Thu, Apr 9, 2009 at 3:08 PM, madhu nambiar 
>> <[email protected]>wrote:
>>
>>> Hi ruben,
>>>             This is to inform u that i finally got the SB script written
>>> which can search the number of strings in any .c file.Now when i call the
>>> vbs through batch files,i am able to get the return value in a particular
>>> variable.I really need to know if we can pass the return value of the batch
>>> file to any ccnet.config file where i can do my sample smoke test??
>>>
>>> with kind regards
>>> Maddy
>>>
>>>   On Thu, Apr 9, 2009 at 4:23 PM, Ruben Willems <[email protected]
>>> > wrote:
>>>
>>>>
>>>>
>>>> Dim strBuff As String
>>>>
>>>> Dim TotalLines As Integer = 0
>>>> Dim IncludeLines As Integer = 0
>>>>
>>>>
>>>> Open "c:\somefile.vbw" For Input As #1
>>>> Do Until EOF(1)
>>>>    Line Input #1, strBuff
>>>>
>>>>
>>>> if not EOF(1) then
>>>>
>>>>             TotalLines = TotalLines + 1
>>>>
>>>>             If instr(strBuf,"#defines) > 0  Then
>>>>                 IncludeLines = IncludeLines + 1
>>>>             End If
>>>>  endif
>>>>
>>>> Loop
>>>> Close #1
>>>>
>>>>
>>>>
>>>> maybe this version
>>>>
>>>> if not, I have no idea
>>>>
>>>>
>>>> with kind regards
>>>> Ruben Willems
>>>>
>>>>
>>>>   On Thu, Apr 9, 2009 at 12:49 PM, madhu nambiar <
>>>> [email protected]> wrote:
>>>>
>>>>> ruben,
>>>>>          Its not at all working.I am getting that same error.
>>>>> error:Expected end of statement...
>>>>>
>>>>> with kind regards
>>>>> Maddy
>>>>>   On Thu, Apr 9, 2009 at 3:56 PM, Ruben Willems <
>>>>> [email protected]> wrote:
>>>>>
>>>>>>
>>>>>>
>>>>>> it's been a while, but it should be something like this
>>>>>>
>>>>>>
>>>>>> Dim strBuff As String
>>>>>>
>>>>>> Dim TotalLines As Integer = 0
>>>>>> Dim IncludeLines As Integer = 0
>>>>>>
>>>>>>
>>>>>> Open "c:\somefile.vbw" For Input As #1
>>>>>> Do Until EOF(1)
>>>>>>    Line Input #1, strBuff
>>>>>>
>>>>>>             TotalLines = TotalLines + 1
>>>>>>
>>>>>>             If instr(strBuf,"#defines) > 0  Then
>>>>>>                 IncludeLines = IncludeLines + 1
>>>>>>             End If
>>>>>>
>>>>>> Loop
>>>>>> Close #1
>>>>>>
>>>>>>
>>>>>> hope this works, it's been 6 years ;-)
>>>>>>
>>>>>> with kind regards
>>>>>> Ruben Willems
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>   On Thu, Apr 9, 2009 at 12:10 PM, madhu nambiar <
>>>>>> [email protected]> wrote:
>>>>>>
>>>>>>> Hi ruben,
>>>>>>>            I am extensively searching a lot but tats not much of a
>>>>>>> use.Can u please help me out in this??
>>>>>>>
>>>>>>> Thanks
>>>>>>> Maddy
>>>>>>>   On Thu, Apr 9, 2009 at 2:43 PM, madhu nambiar <
>>>>>>> [email protected]> wrote:
>>>>>>>
>>>>>>>> Thanks ruben.
>>>>>>>>
>>>>>>>>
>>>>>>>> On Thu, Apr 9, 2009 at 2:34 PM, Ruben Willems <
>>>>>>>> [email protected]> wrote:
>>>>>>>>
>>>>>>>>> ok,
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> than that code won't work, because a vbs file is VB6 syntax
>>>>>>>>> if you google around on working with files VB6
>>>>>>>>> you'll get more usefull hints
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> with kind regards
>>>>>>>>> Ruben Willems
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>   On Thu, Apr 9, 2009 at 10:44 AM, madhu nambiar <
>>>>>>>>> [email protected]> wrote:
>>>>>>>>>
>>>>>>>>>> its a vbs file
>>>>>>>>>>
>>>>>>>>>> with kind regards
>>>>>>>>>> Maddy
>>>>>>>>>>
>>>>>>>>>>   On Thu, Apr 9, 2009 at 2:12 PM, Ruben Willems <
>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> are you using VB.Net or vb scipt (a vbs file)
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> with kind regards
>>>>>>>>>>> Ruben Willems
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>   On Thu, Apr 9, 2009 at 10:35 AM, madhu nambiar <
>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hi ruben,
>>>>>>>>>>>>                 Thanks.But i am getting error in the first line
>>>>>>>>>>>> of execution.ie "expected end of statement".
>>>>>>>>>>>>
>>>>>>>>>>>> with regards
>>>>>>>>>>>> Maddy
>>>>>>>>>>>>
>>>>>>>>>>>>   On Thu, Apr 9, 2009 at 1:56 PM, Ruben Willems <
>>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Hi
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> in vb.net it is :
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>         Dim SourceFile As New
>>>>>>>>>>>>> IO.StreamReader("d:\temp\data.txt")
>>>>>>>>>>>>>         Dim line As String
>>>>>>>>>>>>>
>>>>>>>>>>>>>         Dim TotalLines As Integer = 0
>>>>>>>>>>>>>         Dim IncludeLines As Integer = 0
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>         While Not SourceFile.EndOfStream
>>>>>>>>>>>>>             line = SourceFile.ReadLine
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>             TotalLines += 1
>>>>>>>>>>>>>
>>>>>>>>>>>>>             If line.Contains("#defines") Then
>>>>>>>>>>>>>                 IncludeLines += 1
>>>>>>>>>>>>>             End If
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>         End While
>>>>>>>>>>>>>
>>>>>>>>>>>>>         SourceFile.Close()
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>         Console.WriteLine("Total Lines {0}", TotalLines)
>>>>>>>>>>>>>         Console.WriteLine("Include Lines {0}", IncludeLines)
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> this should get you started ;-)
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> with kind regards
>>>>>>>>>>>>> Ruben Willems
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>   On Thu, Apr 9, 2009 at 10:17 AM, madhu nambiar <
>>>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> Hi ruben,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>      Thanks a lot ruben.I am just trying to count the nuber of
>>>>>>>>>>>>>> #defines as mentioned before using VB scripts.
>>>>>>>>>>>>>> I am really new to it.Can u suggest me how to write it in VB
>>>>>>>>>>>>>> or any other method is also welcome
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Thanks
>>>>>>>>>>>>>> Maddy
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>   On Thu, Apr 9, 2009 at 12:49 PM, Ruben Willems <
>>>>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Hi
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> it's your demo ;-)
>>>>>>>>>>>>>>> so make it a worthwhile one for your company
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> with kind regards
>>>>>>>>>>>>>>> Ruben Willems
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>   On Thu, Apr 9, 2009 at 9:01 AM, madhu nambiar <
>>>>>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> hi ruben,
>>>>>>>>>>>>>>>>             Thanks a lot for the idea.I have a another
>>>>>>>>>>>>>>>> suggestion .Instead of counting on the number of comment 
>>>>>>>>>>>>>>>> lines,i just made a
>>>>>>>>>>>>>>>> slight change i which like counting the number of '#define' in 
>>>>>>>>>>>>>>>> my three .c
>>>>>>>>>>>>>>>> files.Will that be ok??
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Witk kind regards
>>>>>>>>>>>>>>>> Maddy
>>>>>>>>>>>>>>>>   On Thu, Apr 9, 2009 at 12:17 PM, Ruben Willems <
>>>>>>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Hi
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> if the source files are plain text,
>>>>>>>>>>>>>>>>> you could try the following :
>>>>>>>>>>>>>>>>> ° count all lines
>>>>>>>>>>>>>>>>> ° count all comment lines
>>>>>>>>>>>>>>>>> ° if the percentage is lower than X, throw error
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> the counting of the comment lines does not have to be 100%
>>>>>>>>>>>>>>>>> accurate for a demo project ;-)
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> just an idea
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> with kind regards
>>>>>>>>>>>>>>>>> Ruben Willems
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>   On Thu, Apr 9, 2009 at 8:40 AM, madhu nambiar <
>>>>>>>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Hi ruben,
>>>>>>>>>>>>>>>>>>       Thanks a lot for this input,but there is one thing i
>>>>>>>>>>>>>>>>>> want to tell.I am doing this for my demo purpose,so i am a 
>>>>>>>>>>>>>>>>>> bit confused in
>>>>>>>>>>>>>>>>>> thinking of what kind of validation check can be performed?.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> with kind regards
>>>>>>>>>>>>>>>>>> Maddy
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>   On Thu, Apr 9, 2009 at 11:57 AM, Ruben Willems <
>>>>>>>>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Hi
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> do you mean the following sequence :
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> ° get source
>>>>>>>>>>>>>>>>>>> ° do a validation check
>>>>>>>>>>>>>>>>>>> ° if ok, compile, test, ...
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> if so, place your validation check in the < prebuild>
>>>>>>>>>>>>>>>>>>> section
>>>>>>>>>>>>>>>>>>> There you can put tasks as in the <tasks> section.
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> If the validation fails, the <tasks> section will not be
>>>>>>>>>>>>>>>>>>> executed, the publisher section will be executed.
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> with kind regards
>>>>>>>>>>>>>>>>>>> Ruben Willems
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> On Thu, Apr 9, 2009 at 8:04 AM, Maddy <
>>>>>>>>>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Hi ,
>>>>>>>>>>>>>>>>>>>>       Can anyone please suggest me any type of
>>>>>>>>>>>>>>>>>>>> validation check that
>>>>>>>>>>>>>>>>>>>> can be performed on any type of build.I mean that this
>>>>>>>>>>>>>>>>>>>> type of  test
>>>>>>>>>>>>>>>>>>>> should be valid for any type of build.I need this test
>>>>>>>>>>>>>>>>>>>> to be performed
>>>>>>>>>>>>>>>>>>>> just before my building process starts.I want to show
>>>>>>>>>>>>>>>>>>>> for me demo
>>>>>>>>>>>>>>>>>>>> purpose.
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Thanks
>>>>>>>>>>>>>>>>>>>> Maddy
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

Reply via email to