ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <ste...@apache.org>
Subject Re: Problems with exec task
Date Tue, 31 Jan 2006 10:01:53 GMT
Rhino wrote:

> When I did this:
> 
>    <property name="vbs.script" value="'c:\Documents and 
> Settings\Rhino\My Documents\LaunchWdMacro.vbs'"/>
> 
>    <exec executable="cscript.exe" spawn="true">
> 
>    <arg line="${vbs.script} Dudley Doright"/>
> 
>    </exec>
> 
> 
> everything was fine; there were no errors from Ant and the macro wrote 
> Dudley Doright in the document.
> 
> But when I did this (using the same property definition for vbs.script):
> 
>    <exec executable="cscript.exe" spawn="true">
> 
>    <arg value="${vbs.script}"/>
> 
>    <arg value="Bugs"/>
> 
>    <arg value="Bunny"/>
> 
>    </exec>
> 
> I got no errors from Ant but the macro didn't run and Bugs Bunny was not 
> added to the document. When I tried the same thing with the spawn="true" 
> removed, I got an error from Ant:
> 
> [exec] Microsoft (R) Windows Script Host Version 5.6
> 
> [exec] Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
> 
> [exec] Input Error: There is no script engine for file extension ".vbs'".

there's an extra single quote at the end of this line. If that really is 
your file, that is the problem. On <arg line> ant is probably parsing 
and discarding the trailing ' as something it doesnt hand down.

> 
> [exec] Result: 1
> 
> Frankly, I'm not sure why these variations don't work but I've got other 
> problems on my plate and the first variant in this note works fine so 
> I'm inclined to move on to other things rather than work out exactly why 
> the variants are failing.

yeah, that's what I'd do. At the same time, this is interesting; some 
aspect of Windows Scripting host.

A bit of research brings up this file

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnanchor/html/scriptinga.asp

which explains stuff more.

1. you can have multiple engines plugged in; .vbs and .js are the 
default, but I think ActivePerl may fit in too if installed.

2. There is another format. .wsf, that contains WSH jobs in an XML 
representation.

3. if the wrong switch is set in your registry, people can run scripts 
against a remote host.

with #2 you could do some interesting ant integration; create a WSF file 
inline. With #3 you could run it remotely.


I'd use jscript, of course :)

-steve

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


Mime
View raw message