Podpořte nás!

scriptforge module

Pro přístup k tomuto příkazu...

Open Tools - Macros - Macro Manager menu.


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.

Metody

Seznam metod v modulu scriptforge

CreateScriptService

ScriptForge


CreateScriptService

Vytvoří instance zdrojů ScriptForge jako „služby“. Slouží jako generický konstruktor pro všechny metody vlastností nebo třídy služeb ScriptForge.

Syntaxe:

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

Parametry:

servicename: Název služby ScriptForge, například „ScriptForge.FileSystem“, „SFDialogs.Dialog“ nebo jiný.

arg0, arg1, ...: Volitelné parametry týkající se instance služby.

Příklad:


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

Metoda Dispose je k dispozici ve všech službách a měla by být volána pro uvolnění zdrojů po použití.

Ikona poznámky

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


ScriptForge class

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.

Syntaxe:

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

Pipe and socket connections exclude one another.

Parametry:

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

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

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

Příklad:

Providing LibreOfficeDev was started from the command line as:


      from scriptforge import CreateScriptService as getSvc
      ui = getSvc('ScriptForge.Basic')

      def my_script():  # user code goes here
          response = ui.MsgBox('Do you want to continue?',ui.MB_YESNOCANCEL,'A message from Python')
          ui.MsgBox('scriptforge module',ui.MB_OK,response)
      g_exportedScripts = (my_script,)  # LibreOffice entry points
      if __name__ == "__main__":  # entry point for IDEs
          # from scriptforge import ScriptForge # as session manager
          # ScriptForge(pipe='PIPE2LIBREOFFICE')  # performed in the background
          my_script()
    
Ikona tipu

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


Ikona upozornění

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.