The common solution to this problem is to reference your @{argvalue} in
the outputproperty name. So something like:
<redirector outputproperty="@{argvalue}.result.property" />
Ben
-----Original Message-----
From: broken connection [mailto:[EMAIL PROTECTED]
Sent: Friday, June 29, 2007 11:57 AM
To: Ant Users List; [EMAIL PROTECTED]
Subject: Re: For loop question
Wow..now thats too much code for me!!!!!
I don't want something that complex,is this the only way to accomplish
this
or some simpler way is also there, I was thinking of something like
this:
<for list="${pass1.property},${pass2.property},${pass3.property}"
param="argvalue">
<sequential>
<exec executable="${ext}" >
<arg value="/c"/>
<arg value="execute.bat @{argvalue}"/>
<redirector outputproperty="result.property" />
</exec>
</sequential>
</for>
<if>
<equals arg1="${pass1.property}" />
<then>
<echo>"Do your stuff here for property1" />
</then>
</if>
.....
.....
.....
If not,I would try to understand your code,modify it and use for my
needs.
Thanks Again.....
On 6/29/07, Scot P. Floess <[EMAIL PROTECTED]> wrote:
Interesting question... I actually had a need to iterate over a list
(using for loop construct) but needed the previous, current and next
elements in the list - certainly similar functionality. Here is my
macro def:
<macrodef
name = "process-list"
description = "Allows one to iterate over a list/files and for
each element in the list know the previous, current and next values."
uri = "http://jplate.sourceforge.net/utility">
<attribute name = "list" default = "" description =
"The
list to process."/>
<attribute name = "delimiter" default = "," description =
"The
delimiter for @{list}."/>
<attribute name = "previous" default =
"jplate-utility.PREVIOUS" description = "Name of property to hold
previous value in list."/>
<attribute name = "current" default =
"jplate-utility.CURRENT" description = "Name of property to hold
current value in list."/>
<attribute name = "next" default =
"jplate-utility.NEXT" description = "Name of property to hold
next
value in list."/>
<element name = "path" optional = "true" description =
"Files to process."/>
<element name = "process" description = "When iterating over
@{list}/@{path}, process the contents contained here."/>
<sequential>
<!--
Initial settings...
-->
<ant-contrib:var name = "@{previous}" value = ""/>
<ant-contrib:var name = "@{current}" value = ""/>
<ant-contrib:var name = "@{next}" value = ""/>
<!--
Iterate over files and/or the list, calling process
for each item. First iteration we skip as we want
to ensure we always have a previous, current and next.
-->
<ant-contrib:for list = "@{list}" delimiter =
"@{delimiter}" param = "processlist">
<ant-contrib:path>
<path/>
</ant-contrib:path>
<ant-contrib:sequential>
<ant-contrib:switch value = "[EMAIL PROTECTED]">
<ant-contrib:case value = "">
<ant-contrib:var name = "@{current}"
value
= "@{processlist}"/>
</ant-contrib:case>
<ant-contrib:default>
<ant-contrib:var name = "@{next}" value
=
"@{processlist}"/>
<process/>
<ant-contrib:var name = "@{previous}"
value = "[EMAIL PROTECTED]"/>
<ant-contrib:var name = "@{current}"
value = "@{processlist}"/>
</ant-contrib:default>
</ant-contrib:switch>
</ant-contrib:sequential>
</ant-contrib:for>
<!--
Need to call process with an empty next - meaning end
of
list.
-->
<ant-contrib:var name = "@{next}" value = ""/>
<process/>
</sequential>
</macrodef>
broken connection wrote:
Hi Friends,
I have a simple "for" task question. I use this for task from
ant-contrib:
<for
list="${pass1.property},${pass2.property},${pass3.property}"
param="argvalue">
<sequential>
<exec executable="${ext}" >
<arg value="/c"/>
<arg value="execute.bat @{argvalue}"/>
<redirector outputproperty="result.property" />
</exec>
</sequential>
</for>
I want to pass in 3 values and store the output in 3 different
properties .
Is there anyway to do this??
Rite now, the output of all the 3 parameters gets overritten in "
result.property"
Your help would be greatly appreciated.
Thanks
--
Scot P. Floess
27 Lake Royale
Louisburg, NC 27549
252-478-8087 (Home)
919-392-6730 (Work)
Chief Architect JPlate http://sourceforge.net/projects/jplate
Chief Architect JavaPIM http://sourceforge.net/projects/javapim
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
********************************************************************************************
This message, including any attachments, contains confidential information intended
for a specific individual and purpose, and is protected by law. If you are not the intended
recipient, please contact the sender immediately by reply e-mail and destroy all copies.
You are hereby notified that any disclosure, copying, or distribution of this
message, or
the taking of any action based on it, is strictly prohibited.
TIAA-CREF
********************************************************************************************
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]