diff --git a/doc/source/main/intro.rst b/doc/source/main/intro.rst index 9da2a8d..aaf4178 100644 --- a/doc/source/main/intro.rst +++ b/doc/source/main/intro.rst @@ -25,9 +25,9 @@ Requirements In: * ArchLinux - * sudo pacman -S libreoffice-fresh-sdk + * ``sudo pacman -S libreoffice-fresh-sdk`` * Ubuntu 20.04+ - * sudo apt install libreoffice-script-provider-python libreoffice-dev + * ``sudo apt install libreoffice-script-provider-python libreoffice-dev`` Installation diff --git a/doc/source/main/tools.rst b/doc/source/main/tools.rst index 1050dea..888f2ec 100644 --- a/doc/source/main/tools.rst +++ b/doc/source/main/tools.rst @@ -299,3 +299,48 @@ Json app.msgbox(data) + +Call Macros +^^^^^^^^^^^ + +You can any macro, for default call macros Python. + +.. code-block:: python + + def show_message(): + app.msgbox(app.INFO_DEBUG) + return + + def main(args=None): + args = { + 'library': 'test', + 'name': 'show_message', + } + app.call_macro(args) + return + +Of course is better call directly if both macros are the same languaje, but, you can call macro in Basic too. + +.. code-block:: vbnet + + Sub show_message() + MsgBox "Basic from Python" + End Sub + +Call from Python with. + +.. code-block:: python + + args = { + 'language': 'Basic', + 'library': 'Standard', + 'module': 'Module1', + 'name': 'show_message', + } + app.call_macro(args) + +Execute macro in other thread + +.. code-block:: python + + app.call_macro(args, True) diff --git a/source/easymacro.py b/source/easymacro.py index 0ec38f0..7c933ff 100644 --- a/source/easymacro.py +++ b/source/easymacro.py @@ -557,10 +557,10 @@ def _struct_to_date(value): def _get_url_script(args: dict): library = args['library'] - module = '.' name = args['name'] language = args.get('language', 'Python') location = args.get('location', 'user') + module = args.get('module', '.') if language == 'Python': module = '.py$' @@ -587,7 +587,7 @@ def _call_macro(args: dict): return result -# ~ TODO + def call_macro(args, in_thread=False): result = None if in_thread: @@ -597,7 +597,7 @@ def call_macro(args, in_thread=False): result = _call_macro(args) return result - +# ~ TODO def run(command, capture=False, split=True): if not split: return subprocess.check_output(command, shell=True).decode()