--- "Ortiz Garrudo, Alvaro" <[EMAIL PROTECTED]> wrote:
> Hello, excuse me for my English:
You did fine :)
> I`am in troubles. I need that Somebody tell me how write script for
> create ftp task, dynamic.
>
> <!--THIS FILE FILE CONTAINS VARIABLES FOR CREATE TASK FTP -->
> <property file = "c:\java\ftp.properties"/>
Can you provide an example of what your ftp.hosts property looks like in
this file? (You can change the hostnames to phoney ones if you want -- I
just want to see the form of what the value looks like.)
>
> <target name="sub">
^replace with: depends="createftp"/>
(Also, you may want to give the target a better name, eg., "runftp".)
> <ftp id="ftp"></ftp>
Not needed, since you're creating the task in your script.
> <target name="createftp">
> <script language="javascript"> <![CDATA[
> for (i=1; i<=${ftp.hosts}; i++) {
You can't access properties this way from inside a script. You need to get
their value via getProperty().
> ftp = squares.createTask("ftp");
> main.addTask(ftp);
^^^^
Should be: ftp
Also, you may want to give your project a different name (I'm guessing you
just picked&put the example from the manual, yes? :)
> ftp.setServer( ${server[i]} );
> ftp.Userid( ${userid[i]} );
> ftp.pass( ${pass[i]} );
> ftp.remotedir( ${ftp.remotedir[i]});
Again, you can't reference properties with ${propname} inside a script.
Also, you need the "set" for the last three, the way you have it for the
first one.
Alternatively, you may want to consider just using the ant-contrib
<foreach> task instead of writing a script to loop through the hosts.
Diane
=====
([EMAIL PROTECTED])
__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>