Thank you, that works and gets me going. Until I learn more about UNO I’ll take your word for it.
.
The APSO shortcut key is Ctrl+Shift+F11 as you say but I probably won’t remember it.
.
For toolbar button:
- Create macro: Tools, Macro, Edit, and paste it into a module.
- Create toolbar button: Tools, Customise, Toolbars, Category Macros - select macro and position it, Modify, Change icon, Select icon, OK
Now, we’re not going to launch a python IDE with Basic are we? Unlike Basic the context needs to be set up (Python : Programming with Python):
# launch APSO - Alternative Python Script Organiser
import uno
def context():
# set global variables for context
global desktop
global model
global active_sheet
# get the doc from the scripting context
desktop = XSCRIPTCONTEXT.getDesktop()
model = desktop.getCurrentComponent()
active_sheet = model.CurrentController.ActiveSheet
def trigger_apso(*args):
# call function context()
context()
s = "apso.python.script.organizer.impl"
#oService = createUnoService(s)
ctx = uno.getComponentContext()
smgr = ctx.getServiceManager()
o_service = smgr.createInstanceWithContext(s, ctx)
o_service.trigger("execute")
Comments on launcher code welcome.