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

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


Gli esempi sottostanti in Basic e Python istanziano il servizio Platform e accedono alla proprietà Architecture.

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.

Extensions

Sì

Matrice di stringhe

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

Fonts

Sì

Matrice di stringhe

Restituisce una matrice di stringhe, con indice a partire da zero, che contiene i nomi di tutti i caratteri disponibili.

FormatLocale

Sì

String

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

Locale

Sì

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

Sì

String

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

OfficeLocale

Sì

String

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

OfficeVersion

Sì

String

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

Example: 'LibreOffice 7.4.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

Sì

String
array

L'elenco delle stampanti disponibili in una matrice con indice a partire da zero.

La stampante predefinita è inserita nella prima posizione dell'elenco (index=0)

Processor

Sì

String

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

Questa proprietà potrebbe restituire lo stesso valore della proprietà Machine.

PythonVersion

Sì

String

Restituisce la versione dell'interprete di Python in uso come stringa nel formato "Python versione_principale.minore.livello_di_patch" (es: "Python 3.9.7").

SystemLocale

Sì

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.


Esempio:

Gli esempi seguenti in Basic e Python illustrano come usare la proprietà Fonts per scrivere i nomi di tutti i caratteri disponibili nel foglio corrente di Calc a partire dalla cella "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

Tutte le routine e gli identificatori Basic di ScriptForge che iniziano con un carattere di sottolineatura "_" sono riservati per uso interno. Non è previsto il loro utilizzo nelle macro in Basic o negli script in Python.