Tenesta ScriptForge.Platform

Tenesta Platform inneheld ei samling eigenskapar om gjeldande køyringsmiljø og samanheng, for eksempel:

note

Alle eigenskapane i tenesta Platform er skriveverna.


Oppkall av teneste

Before using the Platform service the ScriptForge library needs to be loaded or imported:

note

• Basic macros require to load ScriptForge library using the following statement:
GlobalScope.BasicLibraries.loadLibrary("ScriptForge")

• Python scripts require an import from scriptforge module:
from scriptforge import CreateScriptService


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

I Basic

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

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

Eigenskapar

Namn

Skriveverna

Type

Beskriving

Architecture

Ja

String

Bit-arkitekturen for maskinvaren. Eksempel: «32bit» eller «64bit»

ComputerName

Ja

String

Datamaskinen sitt nettverksnamn.

CPUCount

Ja

Integer

Talet på sentralprosessorar (CPU-ar)

CurrentUser

Ja

String

Namnet på den gjeldande innlogga brukaren.

Extensions

Yes

String array

Returns a zero-based array of strings containing the internal IDs of all installed extensions.

Fonts

Yes

String array

Returns a zero-based array of strings containing the names of all available fonts.

FormatLocale

Yes

String

Returns the locale used for numbers and dates as a string in the format "la-CO" (language-COUNTRY).

Locale

Yes

String

Returns the locale of the operating system as a string in the format "la-CO" (language-COUNTRY). This is equivalent to the SystemLocale property.

Machine

Ja

String

Maskintype. Eksempel er: «i386» eller «x86_64».

OfficeLocale

Yes

String

Returns the locale of the user interface as a string in the format "la-CO" (language-COUNTRY).

OfficeVersion

Ja

String

Den aktuelle LibreOfficeDev-versjonen, uttrykt som
« LibreOfficeDev w.x.y.z (The Document Foundation)».

Example: 'LibreOffice 7.4.1.2 (The Document Foundation, Debian and Ubuntu)'

OSName

Ja

String

Typen av operativsystem. Eksempel: «Darwin, Linux» eller «Windows».

OSPlatform

Ja

String

Ein enkelt streng som identifiserer den underliggjande plattforma med så mykje nyttig og lesbar informasjon som mogleg.

Eksempel: «Linux-5.8.0-44-generic-x86_64-with-glibc2.32»

OSRelease

Ja

String

Versjon av operativsystemet. Eksempel: «5.8.0-44-generic»

OSVersion

Ja

String

Operativsystemet sitt byggjenummer eller versjon.

Eksempel: «#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

Ja

String

Det verkelege prosessornamnet. «Eksempel: 'amdk6».

Denne eigenskapen kan returnere den same verdien som eigenskapen Machine.

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").

SystemLocale

Yes

String

Returns the locale of the operating system as a string in the format "la-CO" (language-COUNTRY). This is equivalent to the Locale property.


Eksempel:

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":

I 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)
    
I Python

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

Alle ScriptForge Basic-rutinane og -identifikatorane som vert innleidde med understrek «_» er reserverte for internt bruk. Dei er ikkje meint brukte i Basic-makroar.