Servicio ScriptForge.Platform

El servicio Platform ofrece una colección de propiedades sobre el entorno y el contexto de ejecución actuales, tales como:

note

Todas las propiedades del servicio Platform son de solo lectura.


Invocación del servicio

Antes de utilizar el servicio Platform, es necesario cargar o importar la biblioteca ScriptForge:

note

• Para cargar la biblioteca ScriptForge que necesitan las macros de Basic se debe usar la siguiente declaración:
GlobalScope.BasicLibraries.loadLibrary("ScriptForge")

• Los scripts de Python necesitan importar el módulo scriptforge:
from scriptforge import CreateScriptService


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

En BASIC

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

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

Propiedades

Nombre

De solo lectura

Tipo

Descripción

Architecture

Sí

String

La arquitectura de bits del equipo. Ejemplo: «32bit» y «64bit»

ComputerName

Sí

String

El nombre en red del equipo.

CPUCount

Sí

Integer

El número de unidades centrales de procesamiento.

CurrentUser

Sí

String

El nombre de la cuenta de usuario activa.

Extensions

Sí

Matriz de cadenas

Devuelve una matriz de cadenas indizada a partir de cero que contiene los identificadores internos de todas las extensiones instaladas.

FilterNames

Sí

Matriz de cadenas

Returns a zero-based unsorted array of strings containing the available document import and export filter names.

Fonts

Sí

Matriz de cadenas

Devuelve una matriz de cadenas indizada a partir de cero que contiene los nombres de todos los tipos de letra disponibles.

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

El tipo de máquina. Algunos ejemplos son: «i386» o «x86_64».

OfficeLocale

Sí

String

Devuelve la configuración regional de la interfaz de usuario en el formato «xx-XX» (idioma-PAÍS).

OfficeVersion

Sí

String

The actual LibreOffice version expressed as
' LibreOffice w.x.y.z (The Document Foundation)'.

Ejemplo: «LibreOffice 7.4.1.2 (The Document Foundation, Debian and Ubuntu)»

OSName

Sí

String

The operating system type. Example: 'Darwin, Linux' or 'Windows'.

OSPlatform

Sí

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

Sí

String

The operating system's release. Example: '5.8.0-44-generic'

OSVersion

Sí

String

The operating system's build or version.

Example: '#50-Ubuntu SMP Tue Feb 9 06:29:41 UTC 2021'

Printers

Sí

String
array

La lista de impresoras disponibles devueltas como una matriz indizada a partir de cero.

The default printer is put in the first position of the list (index = 0).

Processor

Sí

String

El nombre real del procesador. Ejemplo: «amdk6».

Es posible que esta propiedad devuelva el mismo valor que la propiedad Machine.

PythonVersion

Sí

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

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.


Ejemplo:

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

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

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

Todas las rutinas o identificadores BASIC de ScriptForge precedidas por guion bajo «_» están reservadas para uso interno. No deben utilizarse en macros BASIC o secuencias Python.