[Solved] OObasic Macros to Import and Export Libraries

Keyboard macros or custom scripts

[Solved] OObasic Macros to Import and Export Libraries

Postby slang4201 » Fri Nov 21, 2008 4:36 pm

HI All,

I am looking for a method to automate the process of exporting and importing code libraries from a network source location. Following the dialog boxes manually is easy enough, but I will pretty much need to do it through code at some point. I've found the process to load libraries once they are imported, but haven't found the import functionality. Any pointers?

Thanks and have a great day.

Steve
Last edited by slang4201 on Thu Dec 04, 2008 11:11 pm, edited 1 time in total.
----------------
-Steve
OOo 3.1 on Ms Windows XP
slang4201
 
Posts: 35
Joined: Wed Nov 12, 2008 9:21 pm

Re: OObasic Macros to Import and Export Libraries

Postby slang4201 » Fri Nov 21, 2008 6:31 pm

OK, Part 1 I think is complete. To import a networked library location and make it active:

Code: Select all   Expand viewCollapse view
Sub foo
test_LoadLibrary("lib_tectonics")
End Sub
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sub test_LoadLibrary(byval strLibName as string)
Dim oLib as object
Const cLibSourcePath as String =  "Y:\D0097\oo_code_library\"

'add a link to the library referenced
With GlobalScope
   .BasicLibraries.CreateLibraryLink(strLibName, convertToURL(cLibSourcePath & strLibName), False)
   .BasicLibraries.LoadLibrary(strLibName)
End With

End Sub


Now to figure out how to macroize export...

Steve
----------------
-Steve
OOo 3.1 on Ms Windows XP
slang4201
 
Posts: 35
Joined: Wed Nov 12, 2008 9:21 pm

Re: OObasic Macros to Import and Export Libraries

Postby Villeroy » Fri Nov 21, 2008 8:04 pm

Store your code in a library other than "Standard". Get the organizer and export the librarie(s) as add-on. Installation should be a double-click then.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 27221
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: OObasic Macros to Import and Export Libraries

Postby slang4201 » Sat Nov 22, 2008 12:18 am

@Villeroy - thanks for the suggestion.
I look at the Standard library the way I look at Normal.dot in the MS Word world... something to be avoided when possible from a code perspective. Other than a minimalist bootstrap script to load development and utility libraries, I don't see it being a repository for much else.
I hadn't explored the possibilities of an extension, since I am going to be loading and unloading libraries based on the document the user has open and active - behind the scenes - and avoid user interaction completely and it didn't seem to fit that bill. I may be wrong, though. (I am new to OOBasic).

A few of the things I am still looking to solve/discover:

1. a watcher that triggers every time the active document changes;
2. a way to embed a menu into a toolbar;
3. a way to change menus dynamically during run time.

It's always fun to learn a new environment!

Steve
----------------
-Steve
OOo 3.1 on Ms Windows XP
slang4201
 
Posts: 35
Joined: Wed Nov 12, 2008 9:21 pm

Re: OObasic Macros to Import and Export Libraries

Postby Villeroy » Sat Nov 22, 2008 12:29 am

1. a watcher that triggers every time the active document changes;
2. a way to embed a menu into a toolbar;
3. a way to change menus dynamically during run time.

As far as I know this is not possible in Basic. You need an object oriented language to implement listeners and dispatch interceptors.
Code: Select all   Expand viewCollapse view
from com.sun.star.frame import XDispatchProviderInterceptor,  \
XDispatchProviderInterception, XInterceptorInfo, XDispatchProvider, XDispat
ch, \
     XNotifyingDispatch, XDispatchResultListener, XStatusListener
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 27221
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: OObasic Macros to Import and Export Libraries

Postby slang4201 » Thu Dec 04, 2008 11:10 pm

If anyone is tracking, I have solved the dynamic menus problem. Every time the active document changes I can have a specific menu commands appropriate to that document type available under a custom menu. Calling the thread solved.
----------------
-Steve
OOo 3.1 on Ms Windows XP
slang4201
 
Posts: 35
Joined: Wed Nov 12, 2008 9:21 pm


Return to OpenOffice Basic, Python, BeanShell, JavaScript

Who is online

Users browsing this forum: No registered users and 3 guests