1.Solution found (although if somebody knows more elegant one please share).
Script below starts external program and parses output.
I attach the script, may be it will be useful for somebody
2. Are official ftp task and webdav task planed? I have found an ftp task,
which works somewhere in internet, but I am wondering that nant still has no
such tasks.
With best regards,
Boni

<target name="md5sum" >
<property name="TempRes" value='c:\path\file.zip'/>

                    <script language="VB">
          <code>
            <![CDATA[
              public shared function ScriptMain(Project as project) as
integer
                                                
                                                dim pd as
PropertyDictionary= project.Properties
                                                dim proj_dir as string=
pd("nant.project.basedir")
                                                dim arg as string=
pd("TempRes")
                                                
                                                        Dim _ret As Integer
= 0



        Dim si As New System.Diagnostics.ProcessStartInfo
        si.UseShellExecute = False
        si.RedirectStandardOutput = True
        si.RedirectStandardError = True

        si.FileName = "md5sum.exe"
        si.Arguments = arg
        Dim p As New System.Diagnostics.Process
        p.StartInfo = si
        p.Start()

        
        p.WaitForExit()
        Dim se As String = p.StandardError.ReadToEnd
        Dim so As String = p.StandardOutput.ReadToEnd
        If so.Length = 0 Then Throw New Exception("We are not in working
copy directory")
        
        
        Dim arr() As String = so.Split("
"+microsoft.VisualBasic.Constants.vbLf)
        For i As Integer = 0 To arr.Length - 1 'the loop is for debug only
            Dim s As String = arr(i)
              Console.WriteLine("s=" + s)
        Next
          pd("TempRes")=arr(0).Substring(1,arr(0).length-1)

        _ret = p.ExitCode


        p.Close()


        Return _ret
                        end function    
            ]]>
          </code>
      </script>
<echo message="MDHash=${TempRes}"/>

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Bonio Lopez
Sent: Montag, 14. August 2006 15:55
To: nant-users@lists.sourceforge.net
Subject: [NAnt-users] How to read program output into property

Hi,
1. Is it possible to read exec output into a property?
I need to compare md hashes of 2 files
<exec program="md5sum.exe"
        commandline='my_prog1.exe'
        />
<exec program="md5sum.exe"
        commandline='my_prog2.exe'
        />
What is the simplest way to do it

2.Just wanted to let nant admins to know that I have been using
WriteRegistryTask and DeleteRegistryTask from Scott Hernandez 2 month now
without any problems. I have found a old discussion in nant group about
those tasks and about including them into nantcontrib. So my vote is to
include them.


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job
easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to