Execute vbs file in Java Problem

Discussion in 'Java' started by simon_s_li@hotmail.com, Jul 23, 2006.

  1. Guest

    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
     
    , Jul 23, 2006
    #1
    1. Advertising

  2. Guest

    Simon wrote:

    > 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.
     
    , Jul 23, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brad

    Running a VBS file from ASP.NET

    Brad, Aug 28, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    534
  2. =?Utf-8?B?a2lt?=
    Replies:
    3
    Views:
    7,672
    cbDevelopment
    Dec 15, 2005
  3. CTBFalcon
    Replies:
    0
    Views:
    404
    CTBFalcon
    Sep 6, 2006
  4. Leo
    Replies:
    13
    Views:
    237
    Roland Hall
    Oct 22, 2005
  5. AirYT

    wscript.shell does not execute .vbs

    AirYT, Aug 1, 2007, in forum: ASP General
    Replies:
    1
    Views:
    512
    Mark J. McGinty
    Aug 2, 2007
Loading...

Share This Page