The arrival of the ScriptForge Libraries will greatly help macro programming in LibreOffice.
By Jean-Pierre Ledure
What is ScriptForge?
ScriptForge libraries are an extensible and robust collection of macro scripting resources for LibreOffice to be invoked from user Basic macros. Users familiar with other BASIC macro variants often face hard times to dig into the extensive LibreOffice Application Programming Interface even for the simplest operations. By collecting most-demanded document operations in a set of easy to use, easy to read routines, users can now program document macros with much less hassle and get quicker results.
ScriptForge abundant methods are organized in reusable modules that cleanly isolate Basic programming language constructs from ODF document content accesses and user interface(UI) features.
What is in ScriptForge?
ScriptForge libraries hold:
- an extensive set of primitives for array handling, including sorts, set operations and interfaces with csv files
- an extensive set of primitives for string handling, including replacements, regular expressions, encodings, hashing and localization
- a Dictionary mapping class
- a class to help internationalize Basic scripts
- a coherent error handling for both user and ScriptForge scripts
- complete FileSystem and TextStream classes for file and directory handling, plus text files read & write
- detailed context information: platform, operating system, directories, …
- interconnection between Basic and Python modules
Document-based and UI ready-made examples help overcome LibreOffice Application Programming Interface (API) steep learning curve. They offer easy access to and management of actual windows and documents, with specific modules for automation on Calc sheets, cells and ranges of cells, management of dialogs and their controls and access to data contained in databases, among many other services.
The described features are invoked from user scripts as “Services” that can be extended. ScriptForge libraries build up an extensible ecosystem that combines with standard libraries, libraries published as extensions or libraries distributed as enterprise extensions.
ScriptForge libraries documentation is undergoing review and translation and will be available from LibreOffice 7.2 onwards, but you can use ScriptForge services and scripts right away with LibreOffice release 7.1. A glimpse of the ScriptForge documentation is already online at this Help page.
A lecture on ScriptForge was delivered by Jean-Pierre Ledure at the LibreOffice 2020 conference. A PDF presentation document is available for download.
ScriptForge is a community contribution by Jean-Pierre Ledure, Alain Romedenne and Rafael Lima.
Scripting LibreOffice macros with Basic just got easier with ScriptForge libraries!