summaryrefslogtreecommitdiffstats
path: root/helpcontent2/source/text/sbasic/shared/03/sf_platform.xhp
diff options
context:
space:
mode:
Diffstat (limited to 'helpcontent2/source/text/sbasic/shared/03/sf_platform.xhp')
-rw-r--r--helpcontent2/source/text/sbasic/shared/03/sf_platform.xhp412
1 files changed, 412 insertions, 0 deletions
diff --git a/helpcontent2/source/text/sbasic/shared/03/sf_platform.xhp b/helpcontent2/source/text/sbasic/shared/03/sf_platform.xhp
new file mode 100644
index 000000000..c9283925b
--- /dev/null
+++ b/helpcontent2/source/text/sbasic/shared/03/sf_platform.xhp
@@ -0,0 +1,412 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<helpdocument version="1.0">
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+-->
+<meta>
+ <topic id="SF_Platform" indexer="include" status="PUBLISH">
+ <title id="tit" xml-lang="en-US">ScriptForge.Platform service</title>
+ <filename>/text/sbasic/shared/03/sf_platform.xhp</filename>
+ </topic>
+ </meta>
+<body>
+<section id="ScriptForge-sf_platform">
+ <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id501600788076381">
+ <bookmark_value>Platform service</bookmark_value>
+ </bookmark>
+</section>
+<section id="abstract">
+ <h1 id="bm_id681600788076499"><variable id="PlatformService"><link href="text/sbasic/shared/03/sf_platform.xhp" name="Platform service"><literal>ScriptForge</literal>.<literal>Platform</literal> service</link></variable></h1>
+ <paragraph role="paragraph" id="par_id181600788076612">The <literal>Platform</literal> service provides a collection of properties about the current execution environment and context, such as:</paragraph>
+ <list type="unordered">
+ <listitem>
+ <paragraph id="par_id301600788076785" role="listitem">The hardware platform (architecture, CPU count, machine type, etc)</paragraph>
+ </listitem>
+ <listitem>
+ <paragraph id="par_id1001600788076848" role="listitem">Operating system information (OS type, release, version, etc)</paragraph>
+ </listitem>
+ <listitem>
+ <paragraph id="par_id67160078807676" role="listitem">The %PRODUCTNAME version</paragraph>
+ </listitem>
+ <listitem>
+ <paragraph id="par_id671600788076855" role="listitem">The current user name</paragraph>
+ </listitem>
+ </list>
+</section>
+ <note id="par_id951614903258253">All properties of the <literal>Platform</literal> service are read-only.</note>
+ <h2 id="hd_id281600788076359">Service invocation</h2>
+ <paragraph role="paragraph" id="par_id141609955500101">Before using the <literal>Platform</literal> service the <literal>ScriptForge</literal> library needs to be loaded or imported:</paragraph>
+ <embed href="text/sbasic/shared/03/lib_ScriptForge.xhp#importLibs"/>
+
+ <paragraph role="paragraph" id="par_id321614902851541">The examples below in Basic and Python instantiate the <literal>Platform</literal> service and access the <literal>Architecture</literal> property.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id851600788076202">GlobalScope.BasicLibraries.LoadLibrary("ScriptForge")</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id1001600788076254">Dim platform As Variant</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id721600788076288">platform = CreateScriptService("Platform")</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id791600788431935">MsgBox platform.Architecture</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id631626695710139">from scriptforge import CreateScriptService</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id981626695710433">svc = CreateScriptService("Platform")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id311626695710851">bas = CreateScriptService("Basic")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id391626695711082">bas.MsgBox(svc.Architecture)</paragraph>
+ </pycode>
+ <bookmark xml-lang="en-US" branch="index" localize="false" id="bm_id111614901524769">
+ <bookmark_value>Platform service;Architecture</bookmark_value>
+ <bookmark_value>Platform service;ComputerName</bookmark_value>
+ <bookmark_value>Platform service;CPUCount</bookmark_value>
+ <bookmark_value>Platform service;CurrentUser</bookmark_value>
+ <bookmark_value>Platform service;Extensions</bookmark_value>
+ <bookmark_value>Platform service;Fonts</bookmark_value>
+ <bookmark_value>Platform service;FormatLocale</bookmark_value>
+ <bookmark_value>Platform service;Locale</bookmark_value>
+ <bookmark_value>Platform service;Machine</bookmark_value>
+ <bookmark_value>Platform service;OfficeLocale</bookmark_value>
+ <bookmark_value>Platform service;OfficeVersion</bookmark_value>
+ <bookmark_value>Platform service;OSName</bookmark_value>
+ <bookmark_value>Platform service;OSPlatform</bookmark_value>
+ <bookmark_value>Platform service;OSRelease</bookmark_value>
+ <bookmark_value>Platform service;OSVersion</bookmark_value>
+ <bookmark_value>Platform service;Printers</bookmark_value>
+ <bookmark_value>Platform service;Processor</bookmark_value>
+ <bookmark_value>Platform service;PythonVersion</bookmark_value>
+ <bookmark_value>Platform service;SystemLocale</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id711600788076834">Properties</h2>
+ <table id="tab_id701600788076583">
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id461600788076917" role="tablehead">Name</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id221600788076591" role="tablehead">Readonly</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id761600788076328" role="tablehead">Type</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id67160078807636" role="tablehead">Description</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id491600788076621" role="tablecontent" localize="false">Architecture</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id311600788076756" role="tablecontent">Yes</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id831600788076785" role="tablecontent" localize="false">String</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id441600788076826" role="tablecontent">The hardware bit architecture. Example: '<literal>32bit</literal>' or '<literal>64bit</literal>'</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id941600788076595" role="tablecontent" localize="false">ComputerName</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id49160078807654" role="tablecontent">Yes</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id961600788076376" role="tablecontent" localize="false">String</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id81600788076419" role="tablecontent">The computer's network name.</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id721600788076638" role="tablecontent" localize="false">CPUCount</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id711600788076534" role="tablecontent">Yes</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id911600788076842" role="tablecontent" localize="false">Integer</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id541600788076645" role="tablecontent">The number of central processing units.</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id961600788076890" role="tablecontent" localize="false">CurrentUser</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id891600788076190" role="tablecontent">Yes</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id761600788076562" role="tablecontent" localize="false">String</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id91600788076674" role="tablecontent">The name of the currently logged user.</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id831633021719246" localize="false" role="tablecontent">Extensions</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id561633021747014" role="tablecontent">Yes</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id201633021748566" role="tablecontent">String array</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id831633021749125" role="tablecontent">Returns a zero-based array of strings containing the internal IDs of all installed extensions.</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id831633021716585" localize="false" role="tablecontent">FilterNames</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id561633021747209" role="tablecontent">Yes</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id201633021748322" role="tablecontent">String array</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id831633021749118" role="tablecontent">Returns a zero-based unsorted array of strings containing the available document import and export filter names.</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id831633021719135" localize="false" role="tablecontent">Fonts</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id561633021747903" role="tablecontent">Yes</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id201633021748455" role="tablecontent">String array</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id831633021749007" role="tablecontent">Returns a zero-based array of strings containing the names of all available fonts.</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id831633021710186" localize="false" role="tablecontent">FormatLocale</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id561633021748013" role="tablecontent">Yes</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id201633021749655" localize="false" role="tablecontent">String</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id831633021749297" role="tablecontent">Returns the locale used for numbers and dates as a string in the format "la-CO" (language-COUNTRY).</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id831633021719022" localize="false" role="tablecontent">Locale</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id561633021743188" role="tablecontent">Yes</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id201633021743058" localize="false" role="tablecontent">String</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id831633021749018" role="tablecontent">Returns the locale of the operating system as a string in the format "la-CO" (language-COUNTRY). This is equivalent to the <literal>SystemLocale</literal> property.</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id951600788076443" role="tablecontent" localize="false">Machine</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id391600788076253" role="tablecontent">Yes</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id381600788076799" role="tablecontent" localize="false">String</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id21600788076541" role="tablecontent">The machine type. Examples are: '<literal>i386</literal>' or '<literal>x86_64</literal>'.</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id831633021710156" localize="false" role="tablecontent">OfficeLocale</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id561633021706513" role="tablecontent">Yes</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id201633021746335" localize="false" role="tablecontent">String</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id831633021741117" role="tablecontent">Returns the locale of the user interface as a string in the format "la-CO" (language-COUNTRY).</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id41600788076936" role="tablecontent" localize="false">OfficeVersion</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id211600788076138" role="tablecontent">Yes</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id221600788076518" role="tablecontent" localize="false">String</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id521600788076371" role="tablecontent">The actual %PRODUCTNAME version expressed as<br />' <literal>%PRODUCTNAME w.x.y.z (The Document Foundation)</literal>'.</paragraph>
+ <paragraph role="paragraph" id="par_id621614902220807">Example: '<literal>LibreOffice 7.4.1.2 (The Document Foundation, Debian and Ubuntu)</literal>'</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id161600788076362" role="tablecontent" localize="false">OSName</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id21600788076758" role="tablecontent">Yes</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id871600788076196" role="tablecontent" localize="false">String</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id781600788076694" role="tablecontent">The operating system type. Example: '<literal>Darwin</literal>, <literal>Linux</literal>' or '<literal>Windows</literal>'.</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id471600788076885" role="tablecontent" localize="false">OSPlatform</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id261600788076841" role="tablecontent">Yes</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id661600788076636" role="tablecontent" localize="false">String</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id11600788076757" role="tablecontent">A single string identifying the underlying platform with as much useful and human-readable information as possible.</paragraph>
+ <paragraph role="paragraph" id="par_id501614902381381">Example: '<literal>Linux-5.8.0-44-generic-x86_64-with-glibc2.32</literal>'</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id221600789141781" role="tablecontent" localize="false">OSRelease</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id531600789141795" role="tablecontent">Yes</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id561600789141282" role="tablecontent" localize="false">String</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id301600789141619" role="tablecontent">The operating system's release. Example: '<literal>5.8.0-44-generic</literal>'</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id821600789286339" role="tablecontent" localize="false">OSVersion</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id541600789286532" role="tablecontent">Yes</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id181600789286889" role="tablecontent" localize="false">String</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id701600789286280" role="tablecontent">The operating system's build or version.</paragraph>
+ <paragraph role="paragraph" id="par_id351614902520555">Example: '<literal>#50-Ubuntu SMP Tue Feb 9 06:29:41 UTC 2021</literal>'</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id31600789752717" role="tablecontent" localize="false">Printers</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id941608709527698" role="tablecontent">Yes</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id100100678952791" role="tablecontent" localize="false">String<br/>array</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id661300789527859" role="tablecontent">The list of available printers as a zero-based array.</paragraph>
+ <paragraph role="paragraph" id="par_id111614952098396">The default printer is put in the first position of the list (index = 0).</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id31600789527717" role="tablecontent" localize="false">Processor</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id941600789527698" role="tablecontent">Yes</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id100160078952791" role="tablecontent" localize="false">String</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id631600789527859" role="tablecontent">The real processor name. Example: '<literal>amdk6</literal>'.</paragraph>
+ <paragraph role="paragraph" id="par_id111614902598396">This property may return the same value as the <literal>Machine</literal> property.</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id31600789752228" role="tablecontent" localize="false">PythonVersion</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id941608709527036" role="tablecontent">Yes</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id100100678952208" role="tablecontent" localize="false">String</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id661300789527994" role="tablecontent">Returns the version of the Python interpreter being used as a string in the format "Python major.minor.patchlevel" (ex: "Python 3.9.7").</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id83163302112358" localize="false" role="tablecontent">SystemLocale</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id561633021708547" role="tablecontent">Yes</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id201633021746229" localize="false" role="tablecontent">String</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id831633021741336" role="tablecontent">Returns the locale of the operating system as a string in the format "la-CO" (language-COUNTRY). This is equivalent to the <literal>Locale</literal> property.</paragraph>
+ </tablecell>
+ </tablerow>
+ </table>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <paragraph role="paragraph" id="par_id311633022159446">The following examples in Basic and Python illustrate how to use the <literal>Fonts</literal> property to write the names of all available fonts to the current Calc sheet starting at cell "A1":</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id671633022413022">Dim oDoc as Object</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id721633022413266">Dim allFonts as Object</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id691633022413526">Dim svcPlatform as Object</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id41633022413831">Set oDoc = CreateScriptService("Calc")</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id541633022414069">Set svcPlatform = CreateScriptService("Platform")</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id641633022414366">allFonts = svcPlatform.Fonts</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id651633022414637">oDoc.setArray("~.A1", allFonts)</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id701633022704347">from scriptforge import CreateScriptService</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id841633022704586">svc_platform = CreateScriptService("Platform")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id281633022704771">doc = CreateScriptService("Calc")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id211633022704988">all_fonts = svc_platform.Fonts</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id941633022705212">doc.setArray("~.A1", all_fonts)</paragraph>
+ </pycode>
+ <embed href="text/sbasic/shared/03/lib_ScriptForge.xhp#SF_InternalUse"/>
+ <section id="relatedtopics">
+ <embed href="text/sbasic/python/python_platform.xhp#pythonplatform"/>
+ <paragraph role="paragraph" id="par_id301613065794148"><link href="text/scalc/01/04060104.xhp#bm_id3691824" name="Calc_Info">Platform information with INFO("system") Calc formula</link></paragraph>
+ <embed href="text/sbasic/shared/03132100.xhp#getguitype2"/>
+ <embed href="text/sbasic/shared/03/lib_tools.xhp#tools_lib"/>
+ </section>
+</body>
+</helpdocument>