Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run vbscript function from java?

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!!

like image 554
yamini harinathan Avatar asked Sep 22 '26 08:09

yamini harinathan


1 Answers

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.

like image 194
Frederik.L Avatar answered Sep 24 '26 10:09

Frederik.L



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!