How to run vbscript function from java?

11,276

This should make you happy :) Go to the WScript section : http://technet.microsoft.com/library/ee156618.aspx

Here's my idea... in your vbscript file, make your script listen to a command line parameter that would specify which method to call. Then, in Java, you could only have to use this parameter whenever you want to call a specific method in the file.

Otherwise, if you want to access powerpoint in java, you will need to access its API like you did in vbscript, which is possible if vbscript can do it but the approach / syntax may change.

Share:
11,276
yamini harinathan
Author by

yamini harinathan

Updated on June 04, 2022

Comments

  • yamini harinathan
    yamini harinathan almost 2 years

    From java code i am able to run the vbscript by using this code

    Runtime.getRuntime().exec("wscript C:\\ppt\\test1.vbs ");
    

    But want to know how to call the method of vbscript from java..for example in test1.vbs

    Set objPPT = CreateObject("PowerPoint.Application")
        objPPT.Visible = True
        Set objPresentation = objPPT.Presentations.Open("C:\ppt\Labo.ppt")
        Set objSlideShow = objPresentation.SlideShowSettings.Run.View
        sub ssn1()
          objPPT.Run "C:\ppt\Labo.ppt!.SSN"
        End sub
    

    how to call only ssn1() method from java.Otherwise can we run the macro of a power point from java code..kindly help!!