ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tommy Nordgren <tommy.nordg...@chello.se>
Subject Re: Problems with exec task
Date Mon, 30 Jan 2006 16:37:42 GMT
One thing you might try is to enclose the path name of the vbs  
executable in single quotes in the property def,

also run ant with the command line option -debug or -verbose, since  
ant by default won't print errors that occur during
running of the exec task.

On Jan 30, 2006, at 5:11 PM, Rhino wrote:

> Thank you both for your suggestions, Clifton and Brian, but I'm  
> afraid neither one worked!
>
> When I tried this from my command line:
>
>    cmd.exe start "C:\Documents and Settings\Rhino\My Documents 
> \LaunchWdMacro.vbs" Fred Flintstone
>
> All I got was:
>
>    Microsoft Windows XP [Version 5.1.2600]
>
> The VBScript, which I've changed slightly to make Word visible  
> (previously, the script said to make Word invisible), did not even  
> bring up Word, let alone run the Word macro. Yet the VBScript works  
> fine if I do this on the command line:
>
>    "C:\Documents and Settings\Rhino\My Documents\LaunchWdMacro.vbs"  
> Fred Flintstone
>
>
> Also, when I tried doing 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} Fred Flintstone"/>
>
>    </exec>
>
>
> The exec ran without any error messages but the Word document was  
> unchanged. Word was not launched and the macro obviously was not run.
>
> Why won't any of these approaches work, except for the batch file  
> that runs the VBScript??
>
> I've never worked with VBScript before and I've only started  
> working with Word and Visual Basic for the first time in the last  
> couple of days so maybe there is some kind of fundamental thing I  
> have not done in terms of setting up my environment but everything  
> works dandy from the command line so this feels like an Ant  
> problem, not a Windows problem.
>
>
> Rhino
>
> ----- Original Message ----- From: "Dick, Brian E."  
> <Brian.Dick@FMR.com>
> To: "Ant Users List" <user@ant.apache.org>
> Sent: Monday, January 30, 2006 9:37 AM
> Subject: RE: Problems with exec task
>
>
> You could also try cscript.exe. That's the actual command processor  
> for
> vbs and other Windows scripting languages.
>
> -----Original Message-----
> From: Clifton Craig [mailto:ccraig@gbg.com]
> Sent: Monday, January 30, 2006 8:52 AM
> To: Ant Users List
> Subject: Re: Problems with exec task
>
>
> Rhino,
>
> Here's another shot in the dark. Try using the start command to invoke
> the
> vbs. On the command line use:
> cmd.exe start /path/to/LaunchWdMacro.vbs
> ...then try the equivalent in Ant.
> --------------------------------------------------- Clifton C.  
> Craig, Software Engineer
> Intelligent Computer Systems -  A Division of GBG
> ccc@icsaward.com
> ccraig@gbg.com
>
> On Sunday 29 January 2006 11:47 am, Rhino wrote:
>> For what it's worth, I finally got my VBScript to run via the Ant  
>> exec
> task
>> via some indirection: I created a batch file that executed the
> VBScript,
>> then had Ant run the batch file.
>>
>> This is the batch file (Word_Resume.bat):
>> ===================================================
>> rem Batch file to run a VBscript.
>>
>> rem This variable is the drive that contains the VBScript.
>> set progdrive=c:
>>
>> rem This variable sets the path to the VBScript.
>> set Script=Documents and Settings\Rhino\My Documents
>>
>> rem Get into the directory containing the program.
>> %progdrive%
>> cd %Script%
>>
>> rem This command runs the VBScript.
>> LaunchWdMacro.vbs Fred Flintstone
>> ===================================================
>>
>> This is the exec task and the property it uses:
>> ===================================================
>> <property name="batch.file" value="c:\Documents and Settings\Rhino\My
>> Documents\Word_Resume.bat"/>
>>
>> <exec executable="${batch.file}" spawn="true"/>
>>
>> ===================================================
>>
>> I'd still prefer to run the VBScript directly from Ant so if anyone
> has any
>> ideas how I can accomplish that, I'd love to hear from you.
>>
>> Rhino
>>
>> ----- Original Message -----
>> From: "Rhino" <rhino1@sympatico.ca>
>> To: "Ant Users List" <user@ant.apache.org>
>> Sent: Sunday, January 29, 2006 8:28 AM
>> Subject: Re: Problems with exec task
>>
>> > Well, nothing else has worked so I'm game to try this if you can do
> any
>> > one of these things:
>> > - tell me what I need to do
>> > - give me a link to the knowledgebase article that describes the
>> > technique - tell me what keywords to use to find the article
>> >
>> > Otherwise, I have no idea what I'll need to do to try this idea.
>> >
>> > Rhino
>> >
>> > ----- Original Message -----
>> > From: "Ken Gentle" <j.kenneth.gentle@acm.org>
>> > To: "Ant Users List" <user@ant.apache.org>
>> > Sent: Sunday, January 29, 2006 4:01 AM
>> > Subject: Re: Problems with exec task
>> >
>> >> Rhino, this is a shot in the dark, but I recently went through a
> rather
>> >> painful rebuild of my wife's XP box and in the process wanted to
> run
>> >> some script from Microsoft to help edit acls.  The knowledgebase
> article
>> >> had me register a different "script runner" for lack of a better
> term so
>> >> that I could run the script from the command line.
>> >>
>> >> #1 - this may be a red herring.
>> >> #2 - Invocation from Ant may be a different ball game than
> invocation
>> >> from the command shell
>> >> #3 - With XP, all bets are off. ;)
>> >>
>> >>         Ken
>> >>
>> >> At 16:33 2006-01-28, you wrote:
>> >>>Unfortunately, that doesn't work either. When I do this:
>> >>>
>> >>><exec executable="${vbs.script}" spawn="true"
> resolveExecutable="true">
>> >>>
>> >>><arg value="Fred"/>
>> >>>
>> >>><arg value="Flintstone"/>
>> >>>
>> >>></exec>
>> >>>
>> >>>The result is:
>> >>>
>> >>>BUILD FAILED
>> >>>
>>
>>>> E:\eclipse\3.1.1\eclipse\workspace\Resume_JDK_1.5.0\xml\word.xml: 
>>>> 40:
>> >>>Execute failed: java.io.IOException: CreateProcess: "C:\Documents
> and
>> >>>Settings\Rhino\My Documents\LaunchWdMacro.vbs" Fred Flintstone
> error=193
>> >>>
>> >>>I did a bit of digging and I had myself half-convinced that the
> blanks
>> >>> in the value of the 'vbs.script' property were the ultimate cause
> of
>> >>> the 193 error. However, when I copied the VBS file to "F:\Temp
>> >>>\LaunchWdMacro.vbs" and adjusted the property to match that
> location, I
>> >>>got the exact same error again. Therefore, I don't think the  
>> blanks
> in
>> >>>the path is the problem after all.
>> >>>
>> >>>I wonder if Windows objects to directly running a VBScript? I've
> never
>> >>>dealt with these before; maybe they have to be invoked in some
> different
>> >>>way? Perhaps I have to run a different program that is given the
> name of
>> >>>the VBScript as an argument?? But if that is true, then I'm not
> sure why
>> >>>I can run it directly from the command line, just by typing the
> name of
>> >>>the VBScript.
>> >>>
>> >>>Any other ideas?
>> >>>
>> >>>--
>> >>>Rhino
>> >>>
>> >>>----- Original Message ----- From: "Tommy Nordgren"
>> >>><tommy.nordgren@chello.se>
>> >>>To: "Ant Users List" <user@ant.apache.org>
>> >>>Sent: Saturday, January 28, 2006 1:48 PM
>> >>>Subject: Re: Problems with exec task
>> >>>
>> >>>>I just remembered something about the exec task:
>> >>>>On Windows, the Execute class, used by the ExecTask,
>> >>>>itself launches cmd.exe to handle the command.
>> >>>>
>> >>>>You might try executable="${vbs.script}"
>> >>>>
>> >>>>On Jan 28, 2006, at 7:35 PM, Rhino wrote:
>> >>>>>I tried adding resolveExecutable="true" and it made no
> difference.
>> >>>>>
>> >>>>>What do you mean when you say to use an absolute path? I am
> already
>> >>>>>using one in the 'vbs.script' property so I added the absolute
> path
>> >>>>> to 'cmd.exe'. This made no difference either; the task still
 
>> has
> no
>> >>>>> errors but the name didn't get added to the Word document.
>> >>>>>
>> >>>>>This is the current version of the task:
>> >>>>>
>> >>>>><property name="vbs.script" value="c:\Documents and
> Settings\Rhino \My
>> >>>>>Documents\LaunchWdMacro.vbs"/>
>> >>>>>
>> >>>>><exec executable="C:\Windows\system32\cmd.exe" spawn="true"
>> >>>>>resolveexecutable="true">
>> >>>>>
>> >>>>>    <arg line="\c ${vbs.script} Fred Flintstone"/>
>> >>>>>
>> >>>>></exec>
>> >>>>>
>> >>>>>
>> >>>>>
>> >>>>>I'm not sure what else to try....
>> >>>>>
>> >>>>>
>> >>>>>Rhino
>> >>>>>----- Original Message ----- From: "Tommy Nordgren"
>> >>>>><tommy.nordgren@chello.se>
>> >>>>>To: "Ant Users List" <user@ant.apache.org>
>> >>>>>Sent: Saturday, January 28, 2006 12:24 PM
>> >>>>>Subject: Re: Problems with exec task
>> >>>>>
>> >>>>>>Use the exec attribute resolveExecutable="true",
>> >>>>>>or use an absolute path.
>> >>>>>>
>> >>>>>>On Jan 28, 2006, at 5:55 PM, Rhino wrote:
>> >>>>>>>I'm having a bit of trouble with an exec task in Windows
XP
>> >>>>>>>Professional and I would appreciate a bit of help from
the
> experts
>> >>>>>>>on this mailing list.
>> >>>>>>>
>> >>>>>>>I have created a short VBScript that invokes a Microsoft
Word
>> >>>>>>>macro; the macro expects exactly two parameters on the
command
> line
>> >>>>>>>and adds the values of these two parameters to a Word
> document.
>> >>>>>>>
>> >>>>>>>When I do this on my Win XP command line, regardless
of  
>> where I
> am
>> >>>>>>>in the file system:
>> >>>>>>>
>> >>>>>>>    "C:\Documents and Settings\Rhino\My Documents
>> >>>>>>> \LaunchWdMacro.vbs" Fred Flintstone
>> >>>>>>>
>> >>>>>>>the VBScript works fine and "Fred Flinstone" is written
into
> the
>> >>>>>>> Word document.
>> >>>>>>>
>> >>>>>>>However, when I try to do the same thing in Ant, I run
into
>> >>>>>>>problems.
>> >>>>>>>
>> >>>>>>>When I try the exec this way:
>> >>>>>>>
>> >>>>>>><property name="vbs.script" value="c:\Documents and
Settings
> \Rhino
>> >>>>>>>\My Documents\LaunchWdMacro.vbs""/>
>> >>>>>>>
>> >>>>>>>    <exec executable="cmd.exe" spawn="true">
>> >>>>>>>        <arg line="\c ${vbs.script} Fred Flintstone"/>
>> >>>>>>>
>> >>>>>>>    </exec>
>> >>>>>>>
>> >>>>>>>I get no errors from Ant but the name Fred Flintstone
has not
> been
>> >>>>>>>added to the Word document either. I've also tried the
exec
> this
>> >>>>>>>way but with the same result; Fred Flintstone does not
get
> added to
>> >>>>>>>the Word document:
>> >>>>>>>
>> >>>>>>>    <exec executable="cmd.exe" spawn="true">
>> >>>>>>>
>> >>>>>>>        <arg value="${vbs.script}"/>
>> >>>>>>>
>> >>>>>>>        <arg value="Fred"/>
>> >>>>>>>
>> >>>>>>>        <arg value="Flinstone"/>
>> >>>>>>>
>> >>>>>>>    </exec>
>> >>>>>>>
>> >>>>>>>
>> >>>>>>>
>> >>>>>>>Can anyone help me figure out what I need to change to
make  
>> the
>> >>>>>>>exec task work correctly? I need the exec task to run
without
>> >>>>>>>errors _and_ I need the parameters passed from the command
 
>> line
> to
>> >>>>>>>wind up in the Word document.
>> >>>>>>>
>> >>>>>>>I'm sure my VBScript is working fine since it works from
the
>> >>>>>>>Windows command line; I just can't quite get it to work
from
> Ant.
>> >>>>>>>
>> >>>>>>>---
>> >>>>>>>Rhino
>> >>>>>>>
>> >>>>>>>
>> >>>>>>>
>> >>>>>>>--
>> >>>>>>>No virus found in this outgoing message.
>> >>>>>>>Checked by AVG Free Edition.
>> >>>>>>>Version: 7.1.375 / Virus Database: 267.14.23/243 - Release
> Date:
>> >>>>>>>27/01/2006
>> >>>>>>>
>> >>>>>>>
>>
>>>>>>>> ---------------------------------------------------------------

>>>>>>>> --
> ---
>> >>>>>>>-
>> >>>>>>>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> >>>>>>>For additional commands, e-mail: user-help@ant.apache.org
>> >>>>>>
>> >>>>>>"Home is not where you are born, but where your heart finds
> peace" -
>> >>>>>>Tommy Nordgren, "The dying old crone"
>> >>>>>>
>> >>>>>>
>>
>>>>>>> ----------------------------------------------------------------

>>>>>>> --
> ---
>> >>>>>>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> >>>>>>For additional commands, e-mail: user-help@ant.apache.org
>> >>>>>>
>> >>>>>>
>> >>>>>>--
>> >>>>>>No virus found in this incoming message.
>> >>>>>>Checked by AVG Free Edition.
>> >>>>>>Version: 7.1.375 / Virus Database: 267.14.23/243 - Release
 
>> Date:
>> >>>>>>27/01/2006
>> >>>>>
>> >>>>>--
>> >>>>>No virus found in this outgoing message.
>> >>>>>Checked by AVG Free Edition.
>> >>>>>Version: 7.1.375 / Virus Database: 267.14.23/243 - Release Date:
>> >>>>>27/01/2006
>> >>>>>
>> >>>>>
>>
>>>>>> -----------------------------------------------------------------

>>>>>> --
> --
>> >>>>>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> >>>>>For additional commands, e-mail: user-help@ant.apache.org
>> >>>>
>> >>>>"Home is not where you are born, but where your heart finds  
>> peace"
> -
>> >>>>Tommy Nordgren, "The dying old crone"
>> >>>>
>> >>>>
>>
>>>>> ------------------------------------------------------------------ 
>>>>> --
> -
>> >>>>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> >>>>For additional commands, e-mail: user-help@ant.apache.org
>> >>>>
>> >>>>
>> >>>>--
>> >>>>No virus found in this incoming message.
>> >>>>Checked by AVG Free Edition.
>> >>>>Version: 7.1.375 / Virus Database: 267.14.23/243 - Release Date:
>> >>>>27/01/2006
>> >>>
>> >>>--
>> >>>No virus found in this outgoing message.
>> >>>Checked by AVG Free Edition.
>> >>>Version: 7.1.375 / Virus Database: 267.14.23/243 - Release Date:
>> >>>27/01/2006
>> >>>
>> >>>
>>
>>>> ------------------------------------------------------------------- 
>>>> --
>> >>>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> >>>For additional commands, e-mail: user-help@ant.apache.org
>> >>
>> >>
> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> >> For additional commands, e-mail: user-help@ant.apache.org
>> >>
>> >>
>> >> --
>> >> No virus found in this incoming message.
>> >> Checked by AVG Free Edition.
>> >> Version: 7.1.375 / Virus Database: 267.14.23/243 - Release Date:
>> >> 27/01/2006
>> >
>> > --
>> > No virus found in this outgoing message.
>> > Checked by AVG Free Edition.
>> > Version: 7.1.375 / Virus Database: 267.14.23/243 - Release Date:
>> > 27/01/2006
>> >
>> >
>> >
> ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> > For additional commands, e-mail: user-help@ant.apache.org
>> >
>> >
>> > --
>> > No virus found in this incoming message.
>> > Checked by AVG Free Edition.
>> > Version: 7.1.375 / Virus Database: 267.14.23/243 - Release Date:
>> > 27/01/2006
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.375 / Virus Database: 267.14.23/243 - Release Date:  
> 27/01/2006
>
>
>
>
> -- 
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.1.375 / Virus Database: 267.14.23/243 - Release Date:  
> 27/01/2006
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>

"Home is not where you are born, but where your heart finds peace" -
Tommy Nordgren, "The dying old crone"


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


Mime
View raw message