You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Arthur Allen <ar...@hotmail.com> on 2004/02/13 21:34:10 UTC

scriptdef context

I'm trying to reference a task or target from a beanshell scriptdef.
There appears to be a difference between the context of an inline script and 
a scriptdef with respect to access to such objects. In the former case, i 
can use constructs like

theEcho.setMessage(...);

where theEcho serves as the id of an existing task, and in the latter case I 
cannot:
theEcho comes up as undefined!

What should I do?

Thanks, Arthur

_________________________________________________________________
Check out the great features of the new MSN 9 Dial-up, with the MSN Dial-up 
Accelerator. http://click.atdmt.com/AVE/go/onm00200361ave/direct/01/


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: scriptdef context

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
On Fri, 13 Feb 2004 20:34:10 +0000, Arthur Allen 
<ar...@hotmail.com> wrote:

> I'm trying to reference a task or target from a beanshell scriptdef.
> There appears to be a difference between the context of an inline script 
> and a scriptdef with respect to access to such objects. In the former 
> case, i can use constructs like
>
> theEcho.setMessage(...);
>
> where theEcho serves as the id of an existing task, and in the latter 
> case I cannot:
> theEcho comes up as undefined!
>
> What should I do?
>

Use the getReference() method on the project object to get the reference.

project.getReference("theEcho").setMessage(...)

should do it.

Conor

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org