LibreOffice SymbolLibreOffice Symbol

Please support us!

khwv8‖scriptforge module

sNVkj‖

To access this command...

PQXsd‖Open Tools - Macros - Macro Manager menu.


yrGCA‖scriptforge module holds an extensible collection or scripting resources for LibreOfficeDev to be invoked from Python scripts. A complete description of these resources is available from ScriptForge libraries help page.

Fb6tG‖Methods

9qchG‖List of Methods in scriptforge module

CreateScriptService

ScriptForge


CreateScriptService

rwHDh‖Instantiates ScriptForge resources as "Services". It serves as a generic constructor to all properties methods or classes of ScriptForge services.

FVEx2‖Syntax:

CreateScriptService(servicename: str [, arg0, arg1, ...]): svc

WADQ4‖Parameters:

hQ6Y9‖servicename: A ScriptForge service name such as 'ScriptForge.FileSystem', 'SFDialogs.Dialog' or else.

RDRuW‖arg0, arg1, ...: Optional parameters with regards to the instantiated service.

EFSA4‖Example:


      from scriptforge import CreateScriptService as getSvc
      svc = getSvc('ScriptForge.Basic')
	  svc.MsgBox('Hello')
      svc.Dispose()
    

AnCi9‖The Dispose method is available in all services and should be called to free up resources after usage.

Note Icon

GkvCZ‖'ScripForge.Basic' service contains dedicated properties and methods that access UNO objects and services, as well as other facilities.


ScriptForge class

3hGGr‖Connects to a running LibreOfficeDev service started with the command line. ScriptForge class can bind IDE-based Python scripts to a remote LibreOfficeDev process for debugging purpose.

FVEx2‖Syntax:

opt ScriptForge(pipe = 'PIPE2LIBREOFFICE'): obj
opt ScriptForge(hostname = '', port = 0): obj

HAFZS‖Pipe and socket connections exclude one another.

WADQ4‖Parameters:

dmPWv‖pipe: Named pipe used to start the LibreOfficeDev remote service. Default name is 'PIPE2LIBREOFFICE'.

tYeGi‖hostname: '', 'localhost' or the IP address of the machine hosting the remote LibreOfficeDev service.

BSEAE‖port: The port number used to start LibreOfficeDev as a service.

EFSA4‖Example:

ATngB‖Providing LibreOfficeDev was started from the command line as:


      from scriptforge import CreateScriptService as getSvc
      ui = getSvc('ScriptForge.Basic')
      
      DFHZi‖def my_script():  # user code goes here
      RVc4n‖    response = ui.MsgBox('Do you want to continue?',ui.MB_YESNOCANCEL,'A message from Python')
      JNMN8‖    ui.MsgBox('scriptforge module',ui.MB_OK,response)
      
      kUmpA‖g_exportedScripts = (my_script,)  # LibreOffice entry points
      
      rptCV‖if __name__ == "__main__":  # entry point for IDEs
      CupuT‖    # from scriptforge import ScriptForge # as session manager
      yHQez‖    # ScriptForge(pipe='PIPE2LIBREOFFICE')  # performed in the background
          my_script()
    
Tip Icon

hzGeR‖To learn more about how to create and execute Python scripts using scriptforge module, read the help page Creating Python Scripts with ScriptForge.


Warning Icon

bfs34‖All scriptforge methods or identifiers that are prefixed with an underscore character "_" are reserved for internal use. They are not meant be used in Python scripts.