

Note that the value in cell "A1" was incremented by 1. Then choose the increment_cell function under the Macro Name list.Ĭlick Run. To run this script from within a Calc document:Įnter some numeric value into cell "A1" in the current sheet.Ĭhoose My Macros - sf_test in the library selector. Note that g_exportedScripts is a tuple that tells which functions will be displayed in LibreOffice as user scripts. This example creates the increment_cell function. In Basic error messages do not display this information.įrom scriptforge import CreateScriptService UNO objects: All UNO structures are exchanged between Basic and Python without any changes.ĭebugging: Whenever an error occurs in Python scripts that use ScriptForge, the error message provided by the Python execution stack displays the line of code that triggered the error. None: Python's None keyword is equivalent to Basic's Null, Empty or Nothing. Two-dimensional arrays are passed and returned as tuples of tuples. Methods and Property names: In Python, all methods and properties can be used in lowercased, ProperCased or camelCased formats.Īrguments: All keyword arguments passed on to methods are lowercased.ĭates: All date objects are passed and returned as datetime.datetime native Python objects.Īrrays: One-dimensional arrays are passed and returned as tuples (which is an immutable object).

However, due to differences in how each language works, ScriptForge users must be aware of some characteristics of the library when using Python:

Most services, methods and properties work identically in both programming languages. The ScriptForge library is available both for Basic and Python. Creating Python Scripts with ScriptForge Differences between Basic and Python
