OO-Snippets: Using Dispatch API

Commons

Keywordsdispatch
LanguagePython
ApplicationOffice
AuthorsDarragh Sherwin (initial)
Tom Schindl (initial)
Supported Versions
Supported OSAll  
QuestionHow do I use the dispatch API in pyuno
Answer

Code is taken from a mail from Darragh Sherwin on dev@api.openoffice.org

Code-Snippet-Listing (snippet-source)

# A wrapper function to wrap around OpenOffice's
# Dispatch API.
# islot is a Slot ID ( aka Command Name )
# For all Slot IDs see
# http://framework.openoffice.org/servlets/ProjectDocumentList?folderID=72&expandFolder=72&folderID=71
def executeSlot( ctx, controller, islot ):

        dispatchHelper = ctx.ServiceManager.createInstanceWithContext( "com.sun.star.frame.DispatchHelper", ctx )
        frame = controller.getFrame()

        dispatchHelper.executeDispatch( frame, islot, "", 0, () )

Changelog

DateUserModification
2005-10-15tomsontomInitial version

and