__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
<!DOCTYPE html>
<html lang="es" dir="ltr">
<head>
<base href="../../../../">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Python: clase Platform</title>
<link rel="shortcut icon" href="media/navigation/favicon.ico">
<link type="text/css" href="normalize.css" rel="Stylesheet">
<link type="text/css" href="prism.css" rel="Stylesheet">
<link type="text/css" href="default.css" rel="Stylesheet">
<script type="text/javascript" src="polyfills.js"></script><script type="text/javascript" src="languages.js"></script><script type="text/javascript" src="es/langnames.js"></script><script type="text/javascript" src="flexsearch.debug.js"></script><script type="text/javascript" src="prism.js"></script><script type="text/javascript" src="help2.js" defer></script><script type="text/javascript" src="a11y-toggle.js" defer></script><script type="text/javascript" src="paginathing.js" defer></script><script type="text/javascript" src="es/bookmarks.js" defer></script><script type="text/javascript" src="es/contents.js" defer></script><script type="text/javascript" src="help.js" defer></script><meta name="viewport" content="width=device-width,initial-scale=1">
</head>
<body>
<header id="TopLeftHeader"><a class="symbol" href="es/text/shared/05/new_help.html"><div></div></a><a class="logo" href="es/text/shared/05/new_help.html"><p dir="auto">Ayuda de LibreOffice 25.2</p></a><div class="dropdowns"><div class="modules">
<button type="button" data-a11y-toggle="modules-nav" id="modules" aria-haspopup="true" aria-expanded="false" aria-controls="modules-nav">Módulo</button><nav id="modules-nav" hidden=""></nav>
</div></div></header><aside class="leftside"><input id="accordion-1" name="accordion-menu" type="checkbox"><label for="accordion-1" dir="auto">Contenido</label><div id="Contents" class="contents-treeview"></div></aside><div id="SearchFrame"><div id="Bookmarks">
<input id="search-bar" type="search" class="search" placeholder="Buscar en los marcadores del módulo elegido" dir="auto"><div class="nav-container" tabindex="0"><nav class="index" dir="auto"></nav></div>
</div></div>
<div id="DisplayArea" itemprop="softwareHelp" itemscope="true" itemtype="http://schema.org/SoftwareApplication">
<noscript><div id="WarnJS"><h1 dir="auto">Active JavaScript en el navegador para mostrar las páginas de ayuda de LibreOffice.</h1></div></noscript>
    <a id="N0508"></a>        <meta itemprop="keywords" content="Platform,isLinux">        <meta itemprop="keywords" content="Platform,isMacOsX">        <meta itemprop="keywords" content="Platform,isWindows">        <meta itemprop="keywords" content="Platform,ComputerName">        <meta itemprop="keywords" content="Platform,OSName">        <meta itemprop="keywords" content="API,ConfigurationAccess">        <meta itemprop="keywords" content="Tools,GetRegistryContent">
    <h1 id="N0509" dir="auto">
<a id="pythonplatform"></a>Identificar el sistema operativo</h1>
    <p id="N0510" class="paragraph" dir="auto">Es posible identificar el sistema operativo a través de los lenguajes Python y Basic.</p>
    <h2 id="N0512" dir="auto">Mediante una clase de Python:</h2>
    <div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
        """ the_module """
        import os, platform
        class Platform():
            @property
            def ComputerName(self): return platform.node()
            @property
            def DirSeparator(self): return os.sep
            @property
            def isLinux(self): return (self.OSName=='Linux')
            @property
            def isMacOSX(self): return (self.OSName=='Darwin')
            @property
            def isWindows(self): return (self.OSName=='Windows')
            @property
            def OSName(self): return platform.system()
            @property
            def PathDelimiter(self): return os.pathsep
    </code></pre></div>
    <h2 id="N0529" dir="auto">Mediante un módulo de clase de Basic:</h2>
    <div class="tip">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/tip.svg" alt="tip" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="NO529b" dir="auto">LibreOffice Basic lacks MacOS X native recognition. Platform identification is possible using LibreOffice Application Programming Interface (API).</p></div>
</div>
<br>
      <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
        ''' Module name: Platform '''
        Option Compatible
        Option ClassModule
        Option Explicit
        
        Public Property Get ComputerName As String
            If isWindows Then ComputerName = Environ("ComputerName")
        End Property ' Platform.ComputerName
        
        Public Property Get DirSeparator As String
            DirSeparator = GetPathSeparator()
        End Property ' Platform.DirSeparator
        
        Public Property Get IsLinux As Boolean
            isLinux = ( GetGUIType()=4 ) ' Applies to macOS as well 
        End Property ' Platform.isLinux
        
        Public Property Get IsMacOSX As Boolean
            isMacOSX = ( OSName="MAC" )
        End Property ' Platform.isMacOSX
        
        Public Property Get IsWindows As Boolean
            isWindows = ( GetGUIType()=1 )
        End Property ' Platform.isWindows
        
        Public Property Get OSName As String
            ' Return platform name as "MAC", "UNIX", "WIN"
            ' Inferred from "Tools.UCB.ShowHelperDialog" function
            With GlobalScope.Basiclibraries
                If Not .IsLibraryLoaded("Tools") Then .LoadLibrary("Tools")
            End With
            Dim keyNode As Object ' com.sun.star.configuration.ConfigurationAccess
            keyNode = Tools.Misc.GetRegistryKeyContent("org.openoffice.Office.Common/Help")
            OSName = keyNode.GetByName("System")
        End Property ' Platform.OSName
        
        Public Property Get PathDelimiter As String
            Select Case OSName
                Case "MAC", "UNIX" : PathDelimiter = ":"
                Case "WIN" : PathDelimiter = ";"
             End Select
        End Property ' Platform.PathDelimiter
    </code></pre></div>
    <div class="note">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/note.svg" alt="note" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="N0511" dir="auto">ComputerName environment variable is solely available for Windows. Basic calls to Python macros help overcome LibreOffice Basic limitations.</p></div>
</div>
<br>
    <h2 id="N0564" dir="auto">Ejemplos:</h2>
    <p id="N0565" class="paragraph" dir="auto">Con Python</p>
    <p id="N0566" class="paragraph" dir="auto"><span class="literal">&gt;&gt;&gt; from &lt; the_module &gt; import Platform</span></p>
    <p id="N0567" class="paragraph" dir="auto"><span class="literal">&gt;&gt;&gt; print(Platform().isMacOSX)  # propiedad de objeto</span></p>
    <p id="N0568" class="paragraph" dir="auto"><span class="literal">True</span></p>
    <p id="N0569" class="paragraph" dir="auto"><span class="literal">&gt;&gt;&gt; input(Platform().OSName)  # propiedad de objeto</span></p>
    <p id="N0570" class="paragraph" dir="auto"><span class="literal">Darwin</span></p>
    <p id="N0571" class="paragraph" dir="auto">        Desde el menú <span class="menuitem">Herramientas ▸ Macros ▸ Ejecutar macro</span>.</p>
    <div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
        from &lt; the_module &gt; import Platform
        import screen_io as ui
        p = Platform()
        ui.MsgBox(''.join(['isMacOS: ',str(p.isMacOSX)]),0,p.OSName)
    </code></pre></div>
    <p id="N0576" class="paragraph" dir="auto">Con LibreOffice Basic</p>
    <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
        Sub Platform_example()
            Dim p As New Platform ' instancia de la clase Platform
            MsgBox p.isLinux ' propiedad de objeto
            Print p.isWindows, p.OSName ' propiedades de objeto
        End Sub ' Platform_example
    </code></pre></div>
    <a id="relatedtopics"></a><div class="relatedtopics">
<p class="related" itemprop="mentions" dir="auto"><a id="related"></a><span class="emph">Temas relacionados</span></p>
<div class="relatedbody" itemprop="mentions">
        <div class="embedded"><p class="embedded" dir="auto"><a target="_top" href="es/text/sbasic/python/python_screen.html">Entrada y salida de y hacia la pantalla</a></p></div>
        <div class="embedded"><p class="embedded" dir="auto"><a target="_top" href="es/text/sbasic/shared/03132100.html">Función GetGuiType</a></p></div>
        <div class="embedded"><p class="embedded" dir="auto"><a target="_top" href="es/text/sbasic/shared/GetPathSeparator.html">Función GetPathSeparator</a></p></div>
        <div class="embedded"><p class="embedded" dir="auto"><a target="_top" href="es/text/sbasic/guide/basic_2_python.html">Invocar secuencias de Python desde Basic</a></p></div>
        <div class="embedded"><p class="embedded" dir="auto"><a target="_top" href="es/text/sbasic/python/python_examples.html">Ejemplos de programación en Python</a></p></div>
        <div class="embedded"><p class="embedded" dir="auto"><a target="_top" href="es/text/sbasic/python/main0000.html">Ayuda con las macros en Python en LibreOffice</a></p></div>
    </div>
</div>
</div>
<div id="DonationFrame"></div>
<footer><h2 style="text-align: center;"><a href="https://books.libreoffice.org" target="_blank">Libros de LibreOffice</a></h2>
<div class="noteicon" dir="auto" style="display:flex;justify-content:center;flex-wrap:wrap;row-gap:15px;">
<img src="media/navigation/libo-writer.svg" alt="Writer Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-calc.svg" alt="Calc Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-impress.svg" alt="Impress Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-draw.svg" alt="Draw Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-base.svg" alt="Base Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-math.svg" alt="Math Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-symbol-black.svg" alt="Getting Started Icon" style="width:60px;height:60px;">
</div>
<div id="DEBUG" class="debug">
<h3 class="bug">Help content debug info:</h3>
<p dir="auto">This page is: <a href="https://opengrok.libreoffice.org/xref/help/source/text/sbasic/python/python_platform.xhp" target="_blank">/text/sbasic/python/python_platform.xhp</a></p>
<p dir="auto">Title is: Python: clase Platform</p>
<p id="bm_module" dir="auto"></p>
<p id="bm_system" dir="auto"></p>
<p id="bm_HID" dir="auto"></p>
</div></footer>
</body>
</html>

Filemanager

Name Type Size Permission Actions
main0000.html File 9.78 KB 0644
python_2_basic.html File 16.96 KB 0644
python_dialogs.html File 8.53 KB 0644
python_document_events.html File 25.83 KB 0644
python_examples.html File 6.89 KB 0644
python_handler.html File 17.02 KB 0644
python_ide.html File 6.29 KB 0644
python_import.html File 13.13 KB 0644
python_listener.html File 13.14 KB 0644
python_locations.html File 10.53 KB 0644
python_platform.html File 11.23 KB 0644
python_programming.html File 23.74 KB 0644
python_screen.html File 12.79 KB 0644
python_session.html File 13.14 KB 0644
python_shell.html File 12 KB 0644
Filemanager