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
The command line is special. There is an ENV varialble, PATHEXT which
declares which things to start, using ::ShellExecute , which does the
mapping from file ext to program, and runs the program with the program
passed in. If you add something like .mp3 to PATHEXT, then all you need
to do is type in the name of your mp3 file and will autorun in winamp or
other chosen player.
1. look up the binding in the registry to find out which app gets run
next to .vbs. I dont know what it is, but you need to recreate the
command line.
2. I have an exe , "open.exe" that takes any file arg and hands it off
to ShellExecute. I can email it to you if you like, though its only
about three lines of code, something like
#include "shell32.h"
void main(char*[] argv) {
::ShellExecute(NULL,"open",argv[1],NULL,::GetCurrentDirectory(),SW_SHOWDEFAULT);
}
see:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shellexecute.asp
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>
file binding for VBS is, unless changed (I normally bind it to notepad
for security reasons):
C:\WINDOWS\System32\WScript.exe "%1" %*
I wouldnt use the spawn option; all output gets dropped.
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.
its an shell integration problem, which is something java itself is weak
on. There is a limit to what ant can do with the minimal underpinnings,
but as a reward we dont have to worry about windows internals, or care
about what win vista is going to do with unsigned binaries.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]