Re: Macro to load and run ppt for impress

2015-07-08 Thread Andrew Douglas Pitonyak
This does work for me, but, only if I define some global variables in 
the defining module. Try setting OptionExplicit at the top of the module 
and it will flag all of those undefined variables for you.


Global oGlob
GLobal oListener
Global boFinished
Global url



On 07/06/2015 04:54 PM, Jerry Geis wrote:


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


--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
Info:  http://www.pitonyak.org/oo.php

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: Macro to load and run ppt for impress

2015-07-07 Thread Miklos Vajna
Hi,

On Mon, Jul 06, 2015 at 04:54:41PM -0400, Jerry Geis  
wrote:
> 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.

Build with debug symbols and get a backtrace in gdb to see where it
crashes.

Or report it as a bug, then it'll be prioritized correctly, etc.

It would be good to (bi)bisect it when it started to be a problem, too.

Regards,

Miklos


signature.asc
Description: Digital signature
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Macro to load and run ppt for impress

2015-07-06 Thread Jerry Geis
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




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


___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice