diff options
author | Rafael Lima <rafael.palma.lima@gmail.com> | 2022-09-22 16:08:11 +0200 |
---|---|---|
committer | Hossein <hossein@libreoffice.org> | 2022-10-07 15:13:27 +0200 |
commit | 84e9a0056967d5c641ec63bf6a4dc6c0f2798e3d (patch) | |
tree | fff89f83988ba6535bc134eb7f1d04c7d19487fb /scripting | |
parent | e005259a6d4e237411c1b4adfb1b63313bcc5980 (diff) |
tdf#151076 Create callable Python script using InsertText
As reported by the user, if you go to Tools - Macro - Run Macro and select the InsertText macro (under Application Macros), you'll get an error.
The reason for this is that the InsertText macro is not meant to be called from the Macro Selector since it requires 1 positional argument.
Therefore, this patch creates a simple callable Python macro that uses the InsertText funcion, so that this error message no longer happens.
Change-Id: I63f766795bda2d2ae1b95a7c0d8110f41f9fbea2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140384
Tested-by: Jenkins
Tested-by: Hossein <hossein@libreoffice.org>
Reviewed-by: Hossein <hossein@libreoffice.org>
Diffstat (limited to 'scripting')
-rw-r--r-- | scripting/examples/python/InsertText.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/scripting/examples/python/InsertText.py b/scripting/examples/python/InsertText.py index 801b8190860a..d68d538cb5f6 100644 --- a/scripting/examples/python/InsertText.py +++ b/scripting/examples/python/InsertText.py @@ -63,3 +63,10 @@ def InsertText(text): xSelectionSupplier.select(xTextRange) i += 1 + +def InsertHello(event=None): + # Calls the InsertText function to insert the "Hello" string + InsertText("Hello") + +# Make InsertHello visible by the Macro Selector +g_exportedScripts = (InsertHello, ) |