Execute vbs file in Java Problem

S

simon_s_li

Hi,

I have a vbs (Visual Basic Script) file which needs to be executed from
Java.

The vbs file basically needs to read in a list of Word documents, where
each document gets parsed and the individual data isconverted into
HTML.

The problem is that when Java runs the vbs file to start the the
looping of each Word document it creates the usual $ file. So if you
have a Word document called 'test.doc' and when you open it it created
a file called '$test'.

To run the vbs using the following command 'cscript test.doc'.

The problem is that it does not seem to finish looping through all the
Word documents. So If I have 100 Word documents, it will only convert
3 Word documents to HTML.

I believe its these $ files, which are stopping it.

Is there any other way to call the vbs file from Java without creating
these $ files when it reads these Word documents?? Remember I've
already tried the cscript.

Any help is appreciated.

Regards
Simon
 
G

gimme_this_gimme_that

Simon said:
I have a vbs (Visual Basic Script) file which needs to be executed from
Java.

I'd recommend using ANT to control the workflow, not Java.
The vbs file basically needs to read in a list of Word documents, where
each document gets parsed and the individual data isconverted into
HTML.

The problem is that when Java runs the vbs file to start the the
looping of each Word document it creates the usual $ file. So if you
have a Word document called 'test.doc' and when you open it it created
a file called '$test'.

Check the Javadocs, or the source if it is available and check if there
is a way to designate the file name.
To run the vbs using the following command 'cscript test.doc'.

Like I said. I'd recommend calling the VBS from ANT. Also, note that
ANT is
easily customizable and you could create a an ANT task that would call
or
execute your Java code.
The problem is that it does not seem to finish looping through all the
Word documents. So If I have 100 Word documents, it will only convert
3 Word documents to HTML.

I believe its these $ files, which are stopping it.

Is there any other way to call the vbs file from Java without creating
these $ files when it reads these Word documents?? Remember I've
already tried the cscript.

I don't know why you think the problems have anything to do with $
files.
Why do you think that's the case?

I'd fathom that the problem is that the code you are using to parse the
Word document
is not compatible with a newer version of Word. In that case, the
solution is
to get an up-to-date Word parser.

You could look into writing a VBA pluggin with a sub that saves a Word
document
as XML. Then you could have Java parse the document as an XML file.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top