Branch name and version with all digits

Shared Libraries
Forum rules
For sharing working examples of macros / scripts. These can be in any script language supported by OpenOffice.org [Basic, Python, Netbean] or as source code files in Java or C# even - but requires the actual source code listing. This section is not for asking questions about writing your own macros.
Post Reply
User avatar
Lupp
Volunteer
Posts: 3542
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Branch name and version with all digits

Post by Lupp »

This is old stuff, and the code is next to completely taken from Andrew Pitonyaks famous "Useful Macro Information". Already there the credits went to Laurent Godard.

However that text didn't even mention the branching between OO.o/AOO and LibreOffice, and users needing to make distinctions concerning the branches and the versions still ask for a solution. Sometimes they develop rather specialized code then themselves.

Therefore I now post an updated version of the mentioned old solution.
As mostly in such cases I ask you, to also download the example if you consider to actually use the code. This helps me gauge the usefulness of my contributions.

Code: Select all

Function ooSetupAllDigitVersion(Optional pNumbersOnly As Boolean) As String
If IsMissing(pNumbersOnly) Then pNumbersOnly = False
REM Functionally the code below is is completely from Laurent Godard as published in "Useful Macro Information" by Andrew Pitonyak. It's only adapted to my personal style and to the current situation.
Dim structNode, providerSrv
Dim arguments(0) As New com.sun.star.beans.PropertyValue
Const providerSrvN = "com.sun.star.configuration.ConfigurationProvider"
Const structNodeN  = "com.sun.star.configuration.ConfigurationAccess"
providerSrv        = createUnoService(providerSrvN)
arguments(0).Name  = "nodepath"
arguments(0).Value = "/org.openoffice.Setup/Product"
structNode         = providerSrv.createInstanceWithArguments(structNodeN, arguments())
Dim out As String
out                = structNode.ooSetupVersionAboutBox
If NOT pNumbersOnly Then
 out                = structNode.ooName & " V" & out
EndIf
ooSetupAllDigitVersion = out
End Function
ooSetupAllDigitsVersionSnippet.ods
(14.41 KiB) Downloaded 54 times
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
Post Reply