scripting/examples/python/InsertText.py | 7 +++++++ 1 file changed, 7 insertions(+)
New commits: commit 84e9a0056967d5c641ec63bf6a4dc6c0f2798e3d Author: Rafael Lima <[email protected]> AuthorDate: Thu Sep 22 16:08:11 2022 +0200 Commit: Hossein <[email protected]> CommitDate: Fri Oct 7 15:13:27 2022 +0200 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 <[email protected]> Reviewed-by: Hossein <[email protected]> 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, )
