目次
索引 🔎︎

# ScriptForge.Platform service

The Platform service provides a collection of properties about the current execution environment and context, such as:

- The hardware platform (architecture, CPU count, machine type, etc)

- Operating system information (OS type, release, version, etc)

- The LibreOffice version

- The current user name

All properties of the Platform service are read-only.

## Service invocation

The examples below in Basic and Python instantiate the Platform service and access the Architecture property.

##### In Basic

          GlobalScope.BasicLibraries.LoadLibrary("ScriptForge")
          Dim platform As Variant
          platform = CreateScriptService("Platform")
          MsgBox platform.Architecture

##### In Python

          from scriptforge import CreateScriptService
          svc = CreateScriptService("Platform")
          bas = CreateScriptService("Basic")
          bas.MsgBox(svc.Architecture)

## Properties

Name | Readonly | Type | Description
Architecture | Yes | String | The hardware bit architecture. Example: '32bit' or '64bit'
ComputerName | Yes | String | The computer's network name.
CPUCount | Yes | Integer | The number of central processing units.
CurrentUser | Yes | String | The name of the currently logged user.
Fonts | Yes | String array | Returns a zero-based array of strings containing the names of all available fonts.
Locale | Yes | String | Returns the operating system locale as a string in the format language-COUNTRY (la-CO). Examples: "en-US", "pt-BR", "fr-BE".
Machine | Yes | String | The machine type. Examples are: 'i386' or 'x86_64'.
OfficeVersion | Yes | String | The actual LibreOffice version expressed as ' LibreOffice w.x.y.z (The Document Foundation)'. Example: 'LibreOffice 7.1.1.2 (The Document Foundation, Debian and Ubuntu)'
OSName | Yes | String | The operating system type. Example: 'Darwin, Linux' or 'Windows'.
OSPlatform | Yes | String | A single string identifying the underlying platform with as much useful and human-readable information as possible. Example: 'Linux-5.8.0-44-generic-x86_64-with-glibc2.32'
OSRelease | Yes | String | The operating system's release. Example: '5.8.0-44-generic'
OSVersion | Yes | String | The operating system's build or version. Example: '#50-Ubuntu SMP Tue Feb 9 06:29:41 UTC 2021'
Printers | Yes | String array | The list of available printers as a zero-based array. The default printer is put in the first position of the list (index = 0).
Processor | Yes | String | The real processor name. Example: 'amdk6'. This property may return the same value as the Machine property.
PythonVersion | Yes | String | Returns the version of the Python interpreter being used as a string in the format "Python major.minor.patchlevel" (ex: "Python 3.9.7").

### Example:

The following examples in Basic and Python illustrate how to use the Fonts property to write the names of all available fonts to the current Calc sheet starting at cell "A1":

##### In Basic

          Dim oDoc as Object
          Dim allFonts as Object
          Dim svcPlatform as Object
          Set oDoc = CreateScriptService("Calc")
          Set svcPlatform = CreateScriptService("Platform")
          allFonts = svcPlatform.Fonts
          oDoc.setArray("~.A1", allFonts)

##### In Python

          from scriptforge import CreateScriptService
          svc_platform = CreateScriptService("Platform")
          doc = CreateScriptService("Calc")
          all_fonts = svc_platform.Fonts
          doc.setArray("~.A1", all_fonts)

All ScriptForge Basic routines or identifiers that are prefixed with an underscore character "_" are reserved for internal use. They are not meant be used in Basic macros or Python scripts.

関連項目

オペレーティングシステムの特定

Platform information with INFO("system") Calc formula

GetGuiType Function

The Tools Library