Servizio ScriptForge.Platform

Il servizio Platform fornisce una raccolta di proprietà relative all'ambiente e al contesto di esecuzione correnti, come:

note

Tutte le proprietà del servizio Platform sono di sola lettura.


Invocare il servizio

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)
    

Proprietà

Nome

Sola lettura

Tipo

Descrizione

Architecture

Sì

String

I bit dell'architettura hardware. Esempio: '32bit' o '64bit'

ComputerName

Sì

String

Il nome di rete del computer.

CPUCount

Sì

Integer

Il numero di processori.

CurrentUser

Sì

String

Il nome dell'utente attualmente connesso.

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

Sì

String

Il tipo di macchina. Esempi: 'i386' o 'x86_64'.

OfficeVersion

Sì

String

La versione in uso di LibreOffice espressa come
' LibreOffice w.x.y.z (The Document Foundation)'.

Esempio: 'LibreOffice 7.1.1.2 (The Document Foundation, Debian and Ubuntu)'

OSName

Sì

String

Il tipo di sistema operativo. Esempio: 'Darwin, Linux' o 'Windows'.

OSPlatform

Sì

String

Una stringa singola che identifica la piattaforma sottostante con quante più informazioni utili possibili in un formato leggibile dagli umani.

Esempio: 'Linux-5.8.0-44-generic-x86_64-with-glibc2.32'

OSRelease

Sì

String

La versione di rilascio del sistema operativo. Esempio: '5.8.0-44-generic'

OSVersion

Sì

String

La versione o il numero di compilazione del sistema operativo.

Esempio: '#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

Sì

String

Il nome reale del processore. Esempio: 'amdk6'.

Questa proprietà potrebbe restituire lo stesso valore della proprietà 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").


Esempio:

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)
    
warning

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.