Macro to load and run ppt for impress

Jerry Geis jerry.geis at gmail.com
Mon Jul 6 13:54:41 PDT 2015


I made this macro long time ago, it used to work.
It does not seem to work with 4.X
It simply loads a PPT, and displays it and loops for Impress

can someone help me get it working again. I think it seg faults.

Thanks

I run it by:
export HOME=/home/silentm; export USER=silentm; export DISPLAY=:0.0;
soffice --nolockcheck --nologo --norestore
 "macro:///Standard.Module1.Load(file:////tmp/Clarian.ppt)"


Jerry

------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument
1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script"
script:name="Module1" script:language="StarBasic">REM  *****  BASIC  *****

Sub Load(arg as String)

'register a global event listener, because
'we have to wait until loading has finished
oGlob = CreateUnoService("com.sun.star.frame.GlobalEventBroadcaster")
oListener =
CreateUnoListener("EvList_","com.sun.star.document.XEventListener")
oGlob.addEventListener(oListener)
boFinished = false

'hide the document while loading so that we do not see the loading window
Dim aProps(2) as new com.sun.star.beans.PropertyValue
Dim oDoc as Object
aProps(0).Name  = "Hidden"
aProps(0).Value = true
aProps(1).Name  = "ReadOnly"
aProps(1).Value = true
url = arg
oDoc = StarDesktop.loadComponentFromURL(url, "_default", 0, aProps)

'wait until loading has finished
while (not boFinished)
wait(5)
wend

oGlob.removeEventListener(oListener)

'loading is done, set the presentation parameters
oDoc.Presentation.Pause = 0
'show the window now as presentation cannot be started
'(segmentation faults) if it is not
oDoc.CurrentController.Frame.ContainerWindow.Visible = true
oDoc.CurrentController.Frame.ContainerWindow.setVisible(false)
'start the presentation
oDoc.Presentation.Start

End Sub

Sub EvList_notifyEvent( o as object )
if o.EventName = "OnLoadFinished" then
if url = o.Source.Location then
boFinished = true
endif
endif

End Sub

Sub EvList_disposing()
End Sub

</script:module>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20150706/04817683/attachment.html>


More information about the LibreOffice mailing list