summaryrefslogtreecommitdiffstats
path: root/helpcontent2/source/text/sbasic/shared/03/sf_session.xhp
diff options
context:
space:
mode:
Diffstat (limited to 'helpcontent2/source/text/sbasic/shared/03/sf_session.xhp')
-rw-r--r--helpcontent2/source/text/sbasic/shared/03/sf_session.xhp693
1 files changed, 693 insertions, 0 deletions
diff --git a/helpcontent2/source/text/sbasic/shared/03/sf_session.xhp b/helpcontent2/source/text/sbasic/shared/03/sf_session.xhp
new file mode 100644
index 000000000..ff4124323
--- /dev/null
+++ b/helpcontent2/source/text/sbasic/shared/03/sf_session.xhp
@@ -0,0 +1,693 @@
+<?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_Session" indexer="include" status="PUBLISH">
+ <title id="tit" xml-lang="en-US">ScriptForge.Session service</title>
+ <filename>/text/sbasic/shared/03/sf_session.xhp</filename>
+ </topic>
+</meta>
+<body>
+ <section id="abstract">
+ <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id661582814720399">
+ <bookmark_value>Session service</bookmark_value>
+ </bookmark>
+ <h1 id="hd_id901582814720985" xml-lang="en-US"><variable id="SessionService"><link href="text/sbasic/shared/03/sf_session.xhp" name="Session service"><literal>ScriptForge.Session</literal> service</link></variable></h1>
+ <paragraph role="paragraph" id="par_id861582814720987" xml-lang="en-US">The <literal>Session</literal> service gathers various general-purpose methods about:</paragraph>
+ <list type = "unordered">
+ <listitem>
+ <paragraph id="par_id34158281472051" role="listitem" xml-lang="en-US">the installation or execution environment</paragraph>
+ </listitem>
+ <listitem>
+ <paragraph id="par_id411582814720361" role="listitem" xml-lang="en-US">UNO introspection</paragraph>
+ </listitem>
+ <listitem>
+ <paragraph id="par_id321582814720863" role="listitem" xml-lang="en-US">the invocation of external scripts or programs</paragraph>
+ </listitem>
+ </list>
+ </section>
+
+ <h2 id="hd_id91582814720116" xml-lang="en-US">Service invocation</h2>
+ <paragraph role="paragraph" id="par_id141609955500101">Before using the <literal>Session</literal> service the <literal>ScriptForge</literal> library needs to be loaded or imported:</paragraph>
+ <embed href="text/sbasic/shared/03/lib_ScriptForge.xhp#importLibs"/>
+
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id931582897922121">GlobalScope.BasicLibraries.LoadLibrary("ScriptForge")</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id961582814720760">Dim session As Variant</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id651582814720203">session = CreateScriptService("Session")</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id891626808716096">from scriptforge import CreateScriptService</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id261626808717344">session = CreateScriptService("Session")</paragraph>
+ </pycode>
+ <h2 id="hd_id291582814720762" xml-lang="en-US">Constants</h2>
+ <paragraph role="paragraph" id="par_id82158281472034" xml-lang="en-US">Below is a list of constants available to ease the designation of the library containing a Basic or Python script to invoke. Use them as <literal>session.CONSTANT</literal>.</paragraph>
+ <section id="constants">
+ <table id="tab_id291582814720160">
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id381582814720870" role="tablehead" xml-lang="en-US" localize="false">CONSTANT</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id9158281472045" role="tablehead" xml-lang="en-US">Value</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id241582814720636" role="tablehead" xml-lang="en-US">Where to find the library?</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id361582814720116" role="tablehead" xml-lang="en-US">Applicable</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id821582814720218" role="tablecontent" xml-lang="en-US" localize="false">SCRIPTISEMBEDDED</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id401582814720597" role="tablecontent" xml-lang="en-US" localize="false">"document"</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id451582814720105" role="tablecontent" xml-lang="en-US">in the document</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id421582814720733" role="tablecontent" xml-lang="en-US" localize="false">Basic + Python</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id191582814720876" role="tablecontent" xml-lang="en-US" localize="false">SCRIPTISAPPLICATION</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id601582814720388" role="tablecontent" xml-lang="en-US" localize="false">"application"</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id73158281472032" role="tablecontent" xml-lang="en-US">in any shared library</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id291582814720233" role="tablecontent" xml-lang="en-US" localize="false">Basic</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id571582814720667" role="tablecontent" xml-lang="en-US" localize="false">SCRIPTISPERSONAL</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id4158281472033" role="tablecontent" xml-lang="en-US" localize="false">"user"</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id391582814720487" role="tablecontent" xml-lang="en-US">in My Macros</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id701582814720517" role="tablecontent" xml-lang="en-US" localize="false">Python</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id691582814720670" role="tablecontent" xml-lang="en-US" localize="false">SCRIPTISPERSOXT</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id401582814720356" role="tablecontent" xml-lang="en-US" localize="false">"user:uno_packages"</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id56158281472073" role="tablecontent" xml-lang="en-US">in an extension installed for the current user</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id611582814720723" role="tablecontent" xml-lang="en-US" localize="false">Python</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id781582814720282" role="tablecontent" xml-lang="en-US" localize="false">SCRIPTISSHARED</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id991582814720953" role="tablecontent" xml-lang="en-US" localize="false">"share"</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id21582814720997" role="tablecontent" xml-lang="en-US">in %PRODUCTNAME macros</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id491582814720794" role="tablecontent" xml-lang="en-US" localize="false">Python</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id371582814720280" role="tablecontent" xml-lang="en-US" localize="false">SCRIPTISSHAROXT</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id51582814720754" role="tablecontent" xml-lang="en-US" localize="false">"share:uno_packages"</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id981582814720125" role="tablecontent" xml-lang="en-US">in an extension installed for all users</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id66158281472037" role="tablecontent" xml-lang="en-US" localize="false">Python</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id71582814720886" role="tablecontent" xml-lang="en-US" localize="false">SCRIPTISOXT</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id51582814720584" role="tablecontent" xml-lang="en-US" localize="false">"uno_packages"</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id93158281472047" role="tablecontent" xml-lang="en-US">in an extension but the installation parameters are unknown</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id601582814720689" role="tablecontent" xml-lang="en-US" localize="false">Python</paragraph>
+ </tablecell>
+ </tablerow>
+ </table>
+ </section>
+
+<table id="tab_id501611613601554">
+ <tablerow>
+ <tablecell colspan="3"><paragraph id="par_id891611613601554" role="tablehead" xml-lang="en-US">List of Methods in the Session Service</paragraph></tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id891611613601556" role="tablecontent" localize="false">
+ <link href="text/sbasic/shared/03/sf_session.xhp#ExecuteBasicScript" name="ExecuteBasicScript method">ExecuteBasicScript</link><br/>
+ <link href="text/sbasic/shared/03/sf_session.xhp#ExecuteCalcFunction" name="ExecuteCalcFunction method">ExecuteCalcFunction</link><br/>
+ <link href="text/sbasic/shared/03/sf_session.xhp#ExecutePythonScript" name="ExecutePythonScript method">ExecutePythonScript</link><br/>
+ <link href="text/sbasic/shared/03/sf_session.xhp#GetPDFExportOptions" name="GetPDFExportOptions method">GetPDFExportOptions</link><br/>
+ <link href="text/sbasic/shared/03/sf_session.xhp#HasUnoMethod" name="HasUnoMethod method">HasUnoMethod</link><br/>
+ </paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id541611613601554" role="tablecontent" localize="false">
+ <link href="text/sbasic/shared/03/sf_session.xhp#HasUnoProperty" name="HasUnoProperty method">HasUnoProperty</link><br/>
+ <link href="text/sbasic/shared/03/sf_session.xhp#OpenURLInBrowser" name="OpenURLInBrowser method">OpenURLInBrowser</link><br/>
+ <link href="text/sbasic/shared/03/sf_session.xhp#RunApplication" name="RunApplication method">RunApplication</link><br/>
+ <link href="text/sbasic/shared/03/sf_session.xhp#SendMail" name="SendMail method">SendMail</link><br/>
+ <link href="text/sbasic/shared/03/sf_session.xhp#SetPDFExportOptions" name="SetPDFExportOptions method">SetPDFExportOptions</link><br/>
+ </paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id701611613601554" role="tablecontent" localize="false">
+ <link href="text/sbasic/shared/03/sf_session.xhp#UnoMethods" name="UnoMethods method">UnoMethods</link><br/>
+ <link href="text/sbasic/shared/03/sf_session.xhp#UnoProperties" name="UnoProperties method">UnoProperties</link><br/>
+ <link href="text/sbasic/shared/03/sf_session.xhp#UnoObjectType" name="UnoObjectType method">UnoObjectType</link><br/>
+ <link href="text/sbasic/shared/03/sf_session.xhp#WebService" name="WebService method">WebService</link><br/><br/>
+ </paragraph>
+ </tablecell>
+ </tablerow>
+</table>
+
+ <tip id="par_id491613061572993"><literal>Execute...</literal> methods in <literal>Session</literal> service behave as follows:
+ <br/>Arguments are passed by value. Changes made by the called function to the arguments do not update their values in the calling script.
+ <br/>A single value or an array of values is returned to the calling script.
+ </tip>
+
+<section id="ExecuteBasicScript">
+ <comment> ExecuteBasicScript ------------------------------------------------------------------------------------- </comment>
+ <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id41582815407230">
+ <bookmark_value>Session service;ExecuteBasicScript</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id281582815407230" localize="false">ExecuteBasicScript</h2>
+ <paragraph role="paragraph" id="par_id451582815407230">Execute the Basic script given its name and location and fetch its result if any.</paragraph>
+ <paragraph role="paragraph" id="par_id921600856780901" xml-lang="en-US">If the script returns nothing, which is the case of procedures defined with <literal>Sub</literal>, the returned value is <literal>Empty</literal>.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id131626808989444">
+ <input>session.ExecuteBasicScript(scope: str, script: str, args: any[0..*]): any</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id631582815407231"><emph>scope</emph>: String specifying where the script is stored. It can be either "document" (constant <literal>session.SCRIPTISEMBEDDED</literal>) or "application" (constant <literal>session.SCRIPTISAPPLICATION</literal>).</paragraph>
+ <paragraph role="paragraph" id="par_id691582815407231"><emph>script</emph>: String specifying the script to be called in the format "library.module.method" as a case-sensitive string.</paragraph>
+ <list type="unordered">
+ <listitem>
+ <paragraph id="par_id741626828862265" role="listitem">The library is loaded in memory if necessary.</paragraph>
+ </listitem>
+ <listitem>
+ <paragraph id="par_id981626828863001" role="listitem">The module must not be a class module.</paragraph>
+ </listitem>
+ <listitem>
+ <paragraph id="par_id721626828863257" role="listitem">The method may be a <literal>Sub</literal> or a <literal>Function</literal>.</paragraph>
+ </listitem>
+ </list>
+ <paragraph role="paragraph" id="par_id881582815407231"><emph>args</emph>: The arguments to be passed to the called script.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <paragraph role="paragraph" id="par_id21626809513802">Consider the following Basic function named <literal>DummyFunction</literal> that is stored in "My Macros" in the "Standard" library inside a module named "Module1".</paragraph>
+ <paragraph role="paragraph" id="par_id551626810319766">The function simply takes in two integer values <literal>v1</literal> and <literal>v2</literal> and return the sum of all values starting in <literal>v1</literal> and ending in <literal>v2</literal>.</paragraph>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id21626810243092">Function DummyFunction(v1 as Integer, v2 as Integer) As Long</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id571626810243635"> Dim result as Long, i as Integer</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id321626810243876"> For i = v1 To v2</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id631626810244299"> result = result + i</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id321626810244676"> Next i</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id641626810245084"> DummyFunction = result</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id381626810245324">End Function</paragraph>
+ </bascode>
+ <paragraph role="paragraph" id="par_id461626810470057">The examples below show how to call <literal>DummyFunction</literal> from within Basic and Python scripts.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id251626810696112">Dim session : session = CreateScriptService("Session")</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id321626810696366">Dim b_script as String, result as Long</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id291626810696576">b_script = "Standard.Module1.DummyFunction"</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id751626810696799">result = session.ExecuteBasicScript("application", b_script, 1, 10)</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id991626810697024">MsgBox result ' 55</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id291626810829019">session = CreateScriptService("Session")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id231626810829279">bas = CreateScriptService("Basic")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id261626810829451">b_script = 'Standard.Module1.DummyFunction'</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id111626810829725">result = session.ExecuteBasicScript('application', b_script, 1, 10)</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id111626810838070">bas.MsgBox(result) # 55</paragraph>
+ </pycode>
+</section>
+
+<section id="ExecuteCalcFunction">
+ <comment> ExecuteCalcFunction ------------------------------------------------------------------------------------ </comment>
+ <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id571582816585180">
+ <bookmark_value>Session service;ExecuteCalcFunction</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id551582816585181" localize="false">ExecuteCalcFunction</h2>
+ <paragraph role="paragraph" id="par_id111582816585181">Execute a Calc function using its English name and based on the given arguments.
+ <br />If the arguments are arrays, the function is executed as an <link href="text/scalc/01/04060107.xhp" name="array formula">array formula</link>.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id701626811351722">
+ <input>session.ExecuteCalcFunction(calcfunction: str, args: any[0..*]): any</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id771582816585183"><emph>calcfunction</emph>: The name of the Calc function to be called, in English.</paragraph>
+ <paragraph role="paragraph" id="par_id371582816585183"><emph>args</emph>: The arguments to be passed to the called Calc function. Each argument must be either a string, a numeric value or an array of arrays combining those types.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id461582816585184">session.ExecuteCalcFunction("AVERAGE", 1, 5, 3, 7) ' 4</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id641582816585185">session.ExecuteCalcFunction("ABS", Array(Array(-1, 2, 3), Array(4, -5, 6), Array(7, 8, -9)))(2)(2) ' 9</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id241582817051111">session.ExecuteCalcFunction("LN", -3)</paragraph>
+ <paragraph role="bascode" id="bas_id881582816585185" xml-lang="en-US">' Generates an error.</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id781626816579430">session.ExecuteCalcFunction("AVERAGE", 1, 5, 3, 7) # 4</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id721626816579849">session.ExecuteCalcFunction("ABS", ((-1, 2, 3), (4, -5, 6), (7, 8, -9)))[2][2] # 9</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id191626816580053">session.ExecuteCalcFunction("LN", -3)</paragraph>
+ </pycode>
+</section>
+
+<section id="ExecutePythonScript">
+ <comment> ExecutePythonScript ------------------------------------------------------------------------------------ </comment>
+ <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id671582818023244">
+ <bookmark_value>Session service;ExecutePythonScript</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id741582818023244" localize="false">ExecutePythonScript</h2>
+ <paragraph role="paragraph" id="par_id571582818023245">Execute the Python script given its location and name, fetch its result if any. Result can be a single value or an array of values.</paragraph>
+ <paragraph role="paragraph" id="par_id71600856817410" xml-lang="en-US">If the script is not found, or if it returns nothing, the returned value is <literal>Empty</literal>.</paragraph>
+ <embed href="text/sbasic/python/python_2_basic.xhp#APIScriptingFramework" />
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id421626816736635">
+ <input>session.ExecutePythonScript(scope: str, script: str, args: any[0..*]): any</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id791582818023246"><emph>scope</emph>: One of the applicable constants listed <link href="text/sbasic/shared/03/sf_session.xhp#constants" name="Session constants">above</link>. The default value is <literal>session.SCRIPTISSHARED</literal>.</paragraph>
+ <paragraph role="paragraph" id="par_id71582818023247"><emph>script</emph>: Either "library/module.py$method" or "module.py$method" or "myExtension.oxt|myScript|module.py$method" as a case-sensitive string.</paragraph>
+ <list type="unordered">
+ <listitem><paragraph id="par_id501613061041313" role="listitem">library: The folder path to the Python module.</paragraph></listitem>
+ <listitem><paragraph id="par_id771613061043097" role="listitem">myScript: The folder containing the Python module.</paragraph></listitem>
+ <listitem><paragraph id="par_id301613061123849" role="listitem">module.py: The Python module.</paragraph></listitem>
+ <listitem><paragraph id="par_id241613061044560" role="listitem">method: The Python function.</paragraph></listitem>
+ </list>
+ <paragraph role="paragraph" id="par_id711582818023247"><emph>args</emph>: The arguments to be passed to the called script.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <paragraph role="paragraph" id="par_id701626817164878">Consider the Python function <literal>odd_integers</literal> defined below that creates a list with odd integer values between <literal>v1</literal> and <literal>v2</literal>. Suppose this function is stored in a file named <emph>my_macros.py</emph> in your user scripts folder.</paragraph>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id21626817636630">def odd_integers(v1, v2):</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id231626817636935"> odd_list = [v for v in range(v1, v2 + 1) if v % 2 != 0]</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id901626817637127"> return odd_list</paragraph>
+ </pycode>
+ <tip id="par_id751626817335715">Read the help page <link href="text/sbasic/python/python_locations.xhp" name="pylocation_link">Python Scripts Organization and Location</link> to learn more about where Python scripts can be stored.</tip>
+ <paragraph role="paragraph" id="par_id121626817725471">The following examples show how to call the function <literal>odd_integers</literal> from within Basic and Python scripts.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id481626817835712">Dim script as String, session as Object</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id141626817836000">script = "my_macros.py$odd_integers"</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id371626817836256">session = CreateScriptService("Session")</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id711626817836519">Dim result as Variant</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id221626817836809">result = session.ExecutePythonScript(session.SCRIPTISPERSONAL, script, 1, 9)</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id91626817837112">MsgBox SF_String.Represent(result)</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id231626818075452">session = CreateScriptService("Session")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id481626818075720">script = "my_macros.py$odd_integers"</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id661626818075938">result = session.ExecutePythonScript(session.SCRIPTISPERSONAL, script, 1, 9)</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id811626818076162">bas.MsgBox(repr(result))</paragraph>
+ </pycode>
+</section>
+
+<section id="GetPDFExportOptions">
+ <comment> GetPDFExportOptions ------------------------------------------------------------------------------------ </comment>
+ <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id571582816536250">
+ <bookmark_value>Session service;GetPDFExportOptions</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id551582816589871" localize="false">GetPDFExportOptions</h2>
+ <paragraph role="paragraph" id="par_id111582816585087">Returns the current PDF export settings defined in the <menuitem>PDF Options</menuitem> dialog, which can be accessed by choosing <menuitem>File - Export as - Export as PDF</menuitem>.</paragraph>
+ <paragraph role="paragraph" id="par_id931638383270026">Export options set with the <menuitem>PDF Options</menuitem> dialog are kept for future use. Hence <literal>GetPDFExportOptions</literal> returns the settings currently defined. In addition, use <literal>SetPDFExportOptions</literal> to change current PDF export options.</paragraph>
+ <paragraph role="paragraph" id="par_id801638383659558">This method returns a <literal>Dictionary</literal> object wherein each key represent export options and the corresponding values are the current PDF export settings.</paragraph>
+ <tip id="par_id751638383457198">Read the <link href="https://wiki.openoffice.org/wiki/API/Tutorials/PDF_export" name="PDFExport_Wiki">PDF Export wiki page</link> to learn more about all available options.</tip>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id701626811351883">
+ <input>session.GetPDFExportOptions(): obj</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id361638384343807">Dim expSettings As Object, msg As String, key As String, optLabels As Variant</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id721638384344196">expSettings = session.GetPDFExportOptions()</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id181638384344396">optLabels = expSettings.Keys</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id271638384344575">For Each key in optLabels</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id711638384344810"> msg = msg + key &amp; ": " &amp; expSettings.Item(key) &amp; Chr(10)</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id651638384345031">Next key</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id101638384345303">MsgBox msg</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id431638384345510">' Zoom: 100</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id1001638384345677">' Changes: 4</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id11638384345891">' Quality: 90</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id471638384346131">' ...</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#Basic_Only"/>
+</section>
+
+<section id="HasUnoMethod">
+ <comment> HasUnoMethod ------------------------------------------------------------------------------------------- </comment>
+ <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id901587477335292">
+ <bookmark_value>Session service;HasUnoMethod</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id58158747733586" localize="false">HasUnoMethod</h2>
+ <paragraph role="paragraph" id="par_id111587477335982">Returns <literal>True</literal> if an UNO object contains the given method. Returns <literal>False</literal> when the method is not found or when an argument is invalid.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id761626818201301">
+ <input>session.HasUnoMethod(unoobject: uno, methodname: str): bool</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id921587477335673"><emph>unoobject</emph>: The object to inspect.</paragraph>
+ <paragraph role="paragraph" id="par_id631587477566016" xml-lang="en-US"><emph>methodname</emph>: the method as a case-sensitive string</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id471587477335112">Dim a As Variant</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id71587477335350">a = CreateUnoService("com.sun.star.sheet.FunctionAccess")</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id671587477335639">MsgBox session.HasUnoMethod(a, "callFunction") ' True</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id201626818671015">bas = CreateScriptService("Basic")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id781626818671422">a = bas.createUnoService("com.sun.star.sheet.FunctionAccess")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id441626818671679">result = session.HasUnoMethod(a, "callFunction")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id981626818671871">bas.MsgBox(result) # True</paragraph>
+ </pycode>
+</section>
+
+<section id="HasUnoProperty">
+ <comment> HasUnoProperty ----------------------------------------------------------------------------------------- </comment>
+ <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id511587477832348">
+ <bookmark_value>Session service;HasUnoProperty</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id521587477832241" localize="false">HasUnoProperty</h2>
+ <paragraph role="paragraph" id="par_id191587477832959">Returns <literal>True</literal> if a UNO object has the given property. Returns <literal>False</literal> when the property is not found or when an argument is invalid.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id821626818816336">
+ <input>session.HasUnoProperty(unoobject: uno, propertyname: str): bool</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id121587477832805"><emph>unoobject</emph>: The object to inspect.</paragraph>
+ <paragraph role="paragraph" id="par_id701587477832750" xml-lang="en-US"><emph>propertyname</emph>: the property as a case-sensitive string</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id61587477832241">Dim svc As Variant</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id281587477832114">svc = CreateUnoService("com.sun.star.sheet.FunctionAccess")</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id90158747783219">MsgBox session.HasUnoProperty(svc, "Wildcards")</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id331626818906928">bas = CreateScriptService("Basic")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id191626818907607">a = bas.createUnoService("com.sun.star.sheet.FunctionAccess")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id951626818907799">result = session.HasUnoProperty(a, "Wildcards")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id441626818907959">bas.MsgBox(result) # True</paragraph>
+ </pycode>
+</section>
+
+<section id="OpenURLInBrowser">
+ <comment> OpenURLInBrowser --------------------------------------------------------------------------------------- </comment>
+ <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id321601129640799">
+ <bookmark_value>Session service;OpenURLInBrowser</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id971601129640909" localize="false">OpenURLInBrowser</h2>
+ <paragraph role="paragraph" id="par_id97160112964017">Open a Uniform Resource Locator (<link href="text/shared/00/00000002.xhp#URL" name="URL">URL</link>) in the default browser.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id831626819024511">
+ <input>session.OpenURLInBrowser(url: str)</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id241601129640549"><emph>url</emph>: The URL to open.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id531626819105690">' Basic</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id781601129640527">session.OpenURLInBrowser("help.libreoffice.org/")</paragraph>
+ </bascode>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id551626819119460"># Python</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id121626819119605">session.OpenURLInBrowser("help.libreoffice.org/")</paragraph>
+ </pycode>
+</section>
+
+<section id="RunApplication">
+ <comment> RunApplication ---------------------------------------------------------------------------------------- </comment>
+ <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id121582819697896">
+ <bookmark_value>Session service;RunApplication</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id511582819697896" localize="false">RunApplication</h2>
+ <paragraph role="paragraph" id="par_id311582819697897">Executes an arbitrary system command and returns <literal>True</literal> if it was launched successfully.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id691626819239862">
+ <input>session.RunApplication(command: str, parameters: str): bool</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id461582819697898"><emph>command</emph>: The command to execute. This may be an executable file or a document which is registered with an application so that the system knows what application to launch for that document. The command must be expressed in the current <literal>SF_FileSystem.FileNaming</literal> notation.</paragraph>
+ <paragraph role="paragraph" id="par_id611582819697899"><emph>parameters</emph>: A list of space separated parameters as a single string. The method does not validate the given parameters, but only passes them to the specified command.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id111582819697900">session.RunApplication("Notepad.exe")</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id851582819697900">session.RunApplication("C:\myFolder\myDocument.odt")</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id641582819697901">session.RunApplication("kate", "/home/user/install.txt") ' GNU/Linux</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id381626819384936">session.RunApplication("Notepad.exe")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id601626819385217">session.RunApplication(r"C:\myFolder\myDocument.odt")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id211626819385376">session.RunApplication("kate", "/home/user/install.txt") # GNU/Linux</paragraph>
+ </pycode>
+</section>
+
+<section id="SendMail">
+ <comment> SendMail ------------------------------------------------------------------------------------------------ </comment>
+ <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id601601030349204">
+ <bookmark_value>Session service;SendMail</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id561601030349199" localize="false">SendMail</h2>
+ <paragraph role="paragraph" id="par_id131601030349755">Send a message - with optional attachments - to recipients from the user's mail client. The message may be edited by the user before sending or, alternatively, be sent immediately.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id691626819545788">
+ <input>session.SendMail(recipient: str, cc: str = '', bcc: str = '', subject: str = '', body: str = '', filenames: str = '', editmessage: bool = True)</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id701601030349896"><emph>recipient</emph>: An email address (the "To" recipient).</paragraph>
+ <paragraph role="paragraph" id="par_id571601030349904"><emph>cc</emph>: A comma-separated list of email addresses (the "carbon copy" recipients).</paragraph>
+ <paragraph role="paragraph" id="par_id961601031043346"><emph>bcc</emph>: A comma-separated list of email addresses (the "blind carbon copy" recipients).</paragraph>
+ <paragraph role="paragraph" id="par_id891601031050814"><emph>subject</emph>: the header of the message.</paragraph>
+ <paragraph role="paragraph" id="par_id191601031056673"><emph>body</emph>: The contents of the message as an unformatted text.</paragraph>
+ <paragraph role="paragraph" id="par_id511601031063269"><emph>filenames</emph>: a comma-separated list of file names. Each file name must respect the <literal>SF_FileSystem.FileNaming</literal> notation.</paragraph>
+ <paragraph role="paragraph" id="par_id161601032784063"><emph>editmessage</emph>: When <literal>True</literal> (default), the message is edited before being sent.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id481601030349950">session.SendMail("someone@example.com" _</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id901601032999905"> , Cc := "b@other.fr, c@other.be" _</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id651601033006799"> , FileNames := "C:\myFile1.txt, C:\myFile2.txt")</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id821626819725867">session.SendMail("someone@example.com",</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id391626819726171"> cc="john@other.fr, mary@other.be"</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id771626819726363"> filenames=r"C:\myFile1.txt, C:\myFile2.txt")</paragraph>
+ </pycode>
+</section>
+
+<section id="SetPDFExportOptions">
+ <comment> SetPDFExportOptions ------------------------------------------------------------------------------------ </comment>
+ <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id571582816563070">
+ <bookmark_value>Session service;SetPDFExportOptions</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id551582816583371" localize="false">SetPDFExportOptions</h2>
+ <paragraph role="paragraph" id="par_id111582816583005">Modifies the PDF export settings defined in the <menuitem>PDF Options</menuitem> dialog, which can be accessed by choosing <menuitem>File - Export as - Export as PDF</menuitem>.</paragraph>
+ <paragraph role="paragraph" id="par_id181638385131806">Calling this method changes the actual values set in the <menuitem>PDF Options</menuitem> dialog, which are used by the <literal>ExportAsPDF</literal> method from the <literal>Document</literal> service.</paragraph>
+ <paragraph role="paragraph" id="par_id391638385313847">This method returns <literal>True</literal> when successful.</paragraph>
+ <tip id="par_id751638383457321">Read the <link href="https://wiki.openoffice.org/wiki/API/Tutorials/PDF_export" name="PDFExport_Wiki">PDF Export wiki page</link> to learn more about all available options.</tip>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id701626811351011">
+ <input>session.SetPDFExportOptions(pdfoptions: obj): bool</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id771582816585233"><emph>pdfoptions</emph>: <literal>Dictionary</literal> object that defines the PDF export settings to be changed. Each key-value pair represents an export option and the value that will be set in the dialog.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <paragraph role="paragraph" id="par_id141638386087986">The following example changes the maximum image resolution to 150 dpi and exports the current document as a PDF file.</paragraph>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id501638385904841">Dim newSettings As Object, oDoc As Object</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id681638465060402">Set oDoc = CreateScriptService("Document")</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id411638385905025">Set newSettings = CreateScriptService("Dictionary")</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id421638386212072">newSettings.Add("ReduceImageResolution", True)</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id801638385905201">newSettings.Add("MaxImageResolution", 150)</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id141638385905345">session.SetPDFExportOptions(newSettings)</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id381638465110336">oDoc.ExportAsPDF("C:\Documents\myFile.pdf", Overwrite := True)</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#Basic_Only"/>
+</section>
+
+<section id="UnoMethods">
+ <comment> UnoMethods --------------------------------------------------------------------------------------------- </comment>
+ <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id701587478024358">
+ <bookmark_value>Session service;UnoMethods</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id861587478024365" localize="false">UnoMethods</h2>
+ <paragraph role="paragraph" id="par_id321587478024997">Returns a list of the methods callable from an UNO object. The list is a zero-based array of strings and may be empty.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id341626819941177">
+ <input>session.UnoMethods(unoobject: uno): str[0..*]</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id251587478024311"><emph>unoobject</emph>: The object to inspect.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id531587478024129">Dim svc : svc = CreateUnoService("com.sun.star.sheet.FunctionAccess")</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id931587478024509">Dim methods : methods = session.UnoMethods(svc)</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id211587478024770">Dim msg as String</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id631626820375428">For Each m in methods</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id101626820375677"> msg = msg &amp; m &amp; Chr(13)</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id151626820375931">Next m</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id741626820376195">MsgBox msg</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id501626820431003">bas = CreateScriptService("Basic")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id991626820431395">a = bas.createUnoService("com.sun.star.sheet.FunctionAccess")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id81626820431651">methods = session.UnoMethods(a)</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id281626820432068">msg = "\n".join(methods)</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id281626820432763">bas.MsgBox(msg)</paragraph>
+ </pycode>
+</section>
+
+<section id="UnoProperties">
+ <comment> UnoProperties ------------------------------------------------------------------------------------------- </comment>
+ <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id57158747834361">
+ <bookmark_value>Session service;UnoProperties</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id101587478343870" localize="false">UnoProperties</h2>
+ <paragraph role="paragraph" id="par_id141587478343306">Returns a list of the properties of an UNO object. The list is a zero-based array of strings and may be empty.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="bas_id91626820631150">
+ <input>session.UnoProperties(unoobject: uno): str[0..*]</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id241587478343323"><emph>unoobject</emph>: The object to inspect.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id281587478343944">Dim svc As Variant</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id581587478343738">svc = CreateUnoService("com.sun.star.sheet.FunctionAccess")</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id101587478343422">MsgBox SF_Array.Contains(session.UnoProperties(svc), "Wildcards") ' True</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id821626820748621">bas = CreateScriptService("Basic")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id861626820749053">svc = bas.createUnoService("com.sun.star.sheet.FunctionAccess")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id671626821449697">properties = session.UnoProperties(a)</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id991626821450160">b = "Wildcards" in properties</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id371626820749214">bas.MsgBox(str(b)) # True</paragraph>
+ </pycode>
+</section>
+
+<section id="UnoObjectType">
+ <comment> UnoObjectType ------------------------------------------------------------------------------------------ </comment>
+ <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id221582820251346">
+ <bookmark_value>Session service;UnoObjectType</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id751582820251347" localize="false">UnoObjectType</h2>
+ <paragraph role="paragraph" id="par_id371582820251347">Identify the type of a UNO object as a string.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id121626821532107">
+ <input>session.UnoObjectType(unoobject: uno): str</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id921582820251349"><emph>unoobject</emph>: The object to identify.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id771582820251350">Dim svc As Variant, txt As String</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id721582820680948">svc = CreateUnoService("com.sun.star.system.SystemShellExecute")</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id571582820689968">txt = session.UnoObjectType(svc) ' "com.sun.star.comp.system.SystemShellExecute"</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id821582820696697">svc = CreateUnoStruct("com.sun.star.beans.Property")</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id315828202513519">txt = session.UnoObjectType(svc) ' "com.sun.star.beans.Property"</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id501626821620216">bas = CreateScriptService("Basic")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id501626821626352">svc = bas.createUnoService("com.sun.star.system.SystemShellExecute")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id131626821626637">txt = session.UnoObjectType(svc) # "com.sun.star.comp.system.SystemShellExecute"</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id771626821626792">svc = bas.createUnoService("com.sun.star.beans.Property")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id251626821626944">txt = session.UnoObjectType(svc) # "com.sun.star.beans.Property"</paragraph>
+ </pycode>
+</section>
+
+<section id="WebService">
+ <comment> WebService ---------------------------------------------------------------------------------------------- </comment>
+ <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id561582821057372">
+ <bookmark_value>Session service;WebService</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id101582821057372" localize="false">WebService</h2>
+ <paragraph role="paragraph" id="par_id341582821057373">Get some web content from a URI.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id941626821793360">
+ <input>session.WebService(uri: str): str</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id771582821057374"><emph>uri</emph>: URI address of the web service.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id901582821057375">session.WebService("wiki.documentfoundation.org/api.php?" _</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id421582821057375"> &amp; "hidebots=1&amp;days=7&amp;limit=50&amp;action=feedrecentchanges&amp;feedformat=rss")</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id691626821991398">session.WebService(("wiki.documentfoundation.org/api.php?" </paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id671626821991593"> "hidebots=1&amp;days=7&amp;limit=50&amp;action=feedrecentchanges&amp;feedformat=rss"))</paragraph>
+ </pycode>
+</section>
+
+ <embed href="text/sbasic/shared/03/lib_ScriptForge.xhp#SF_InternalUse"/>
+
+<section id="relatedtopics">
+ <embed href="text/sbasic/shared/03104200.xhp#Array_h1"/>
+ <embed href="text/sbasic/shared/calc_functions.xhp#CallingCalcFunctionsh1"/>
+ <embed href="text/sbasic/guide/basic_2_python.xhp#basic2python"/>
+ <embed href="text/sbasic/shared/03/sf_basic.xhp#BasicService"/>
+ <embed href="text/sbasic/shared/03/sf_filesystem.xhp#FileSystemService"/>
+</section>
+
+</body>
+</helpdocument>