| View previous topic :: View next topic |
| Author |
Message |
acapola General User

Joined: 23 Jun 2008 Posts: 7
|
Posted: Sat Jul 12, 2008 7:43 pm Post subject: How to embed application events records in an extension ? |
|
|
Hello,
I am preparing an extension which use the "On open document" event to run an OOBASIC script. Does any one knows how to include such assignation in an extension ?
Alternatively does any one knows how to programatically assign a OOBASIC script to application events ?
Best regards,
Sebastien |
|
| Back to top |
|
 |
hanya Super User

Joined: 04 May 2005 Posts: 543 Location: Japan
|
|
| Back to top |
|
 |
hanya Super User

Joined: 04 May 2005 Posts: 543 Location: Japan
|
Posted: Sun Jul 13, 2008 8:43 am Post subject: Re: How to embed application events records in an extension |
|
|
| acapola wrote: | Alternatively does any one knows how to programatically assign a OOBASIC script to application events ?
|
Here is an example to assign an event to global event container.
| Code: | Sub globalevent_1
oGlobalEB = CreateUnoService("com.sun.star.frame.GlobalEventBroadcaster")
oEvents = oGlobalEB.getEvents()
Dim oProps(1) As New com.sun.star.beans.PropertyValue
oProps(0).Name = "EventType"
oProps(1).Name = "Script"
oProps(0).Value = "Script"
oProps(1).Value = _
"vnd.sun.star.script:Standard.Module1.message?language=Basic&location=application"
oEvents.replaceByName("OnLoad",oProps)
End Sub
|
Supported event names can be found in the link written above. |
|
| Back to top |
|
 |
hanya Super User

Joined: 04 May 2005 Posts: 543 Location: Japan
|
Posted: Sun Jul 13, 2008 8:59 am Post subject: |
|
|
| Oops, I'm sorry. Jobs configuration can not allow to invoke any Basic macro... It needs an UNO component implementation. |
|
| Back to top |
|
 |
acapola General User

Joined: 23 Jun 2008 Posts: 7
|
Posted: Mon Jul 14, 2008 4:05 am Post subject: |
|
|
Thanks you very much, your sample code works fine and is simple understand, perfect
Now only one mystery remains: how to launch a script contained in an extension just after its installation ?
any idea is very welcome !
Best regards,
Sebastien |
|
| Back to top |
|
 |
|