I am have been having some serious trouble working my way through the documentation for Python Macros and Extensions for Open Office, and was wondering if anyone had some beginner-level resources or solutions to some problems I am having with an extension I am working on.
I am using the BasicAddonBuilder 0.5.0 to reduce the number of variables that could be causing things to fail (as it takes care of all the XML and packaging and all that, I just provide the functions and layout of the extension).
Specifically, I am having trouble with the simple act of getting a Python macro to run through the extension. I have copied the basic Hello World code from the sample scripts folder to my extension folder, and have called it in my extension. The extension fully compiles and saves to a .oxt package and can be installed into Open Office, but when I press the menu item, I always get the error:
Code: Select all
A Scripting Framework error occurred while running the Python script vnd.sun.star.script:extension.oxt|PythonFiles|HelloWorld.py$Hello?
language=Python&location=user:uno_packages.
Message: <type 'exceptions.KeyError'>: u'extension.oxt
C:\Program Files (x86)\OpenOffice4\program\pythonscript.py:380 in funtion getStorageUrlFromPersistentUrl() [package = self.mapPackageName2Pathh[ packageName]]
C:\Program Files (x86)\OpenOffice4\program\pythonscript.py:984 in function getScript()
[self.pprovCtx.uriHelper.getStorageURI(scriptUri) );]
My code for the extension looks like this:
Code: Select all
Sub myExtension
' ___________________________________________________________________
beginDescription("NONNAd", "1.2.1")
setLicense("en")
setPublisherName("en", "NONNAd", "http://www.NONNAd.com")
setDisplayName("en", "NONNAd")
setReleaseNotes("en", "http://www.NONNAd.com/notes/ReadMe120.txt")
beginUpdateInformation("direct", "direct")
setUpdateSource("http://www.NONNAd.com/", "http://www.NONNAd.com/") ' first choice
setUpdateSource("http://www.NONNAd.cn/", "http://wwwNONNAd.cn/") ' fallback on another server (optional)
endUpdateInformation
setHelp("en") ' should be after setDisplayName instructions
endDescription
beginAnnexes
endAnnexes
beginAddonUI
beginOfficeMenuBar
beginTitles
setTitle("Authors Aid", "en")
endTitles
beginMenuItems
beginCommand
beginTitles("Writer")
setTitle("Hello World", "en")
endTitles
setURL("Python", "PythonFiles/HelloWorld.py", "HelloWorldPython")
endCommand
endMenuItems
endOfficeMenuBar
endAddonUI