Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-updates > by-pkgid > e1011ddec34cda34f3a002b121247943 > files > 676

python-docs-2.7.17-1.1.mga7.noarch.rpm


<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta charset="utf-8" />
    <title>38.2. aetools — OSA client support &#8212; Python 2.7.17 documentation</title>
    <link rel="stylesheet" href="../_static/classic.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/language_data.js"></script>
    
    <script type="text/javascript" src="../_static/sidebar.js"></script>
    
    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within Python 2.7.17 documentation"
          href="../_static/opensearch.xml"/>
    <link rel="author" title="About these documents" href="../about.html" />
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="copyright" title="Copyright" href="../copyright.html" />
    <link rel="next" title="38.3. aepack — Conversion between Python variables and AppleEvent data containers" href="aepack.html" />
    <link rel="prev" title="38.1. gensuitemodule — Generate OSA stub packages" href="gensuitemodule.html" />
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
    <link rel="canonical" href="https://docs.python.org/2/library/aetools.html" />
    <script type="text/javascript" src="../_static/copybutton.js"></script>
    
 
    

  </head><body>  
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="aepack.html" title="38.3. aepack — Conversion between Python variables and AppleEvent data containers"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="gensuitemodule.html" title="38.1. gensuitemodule — Generate OSA stub packages"
             accesskey="P">previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="https://www.python.org/">Python</a> &#187;</li>
        <li>
          <a href="../index.html">Python 2.7.17 documentation</a> &#187;
        </li>

          <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="macosa.html" accesskey="U">38. MacPython OSA Modules</a> &#187;</li> 
      </ul>
    </div>    

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="module-aetools">
<span id="aetools-osa-client-support"></span><h1>38.2. <a class="reference internal" href="#module-aetools" title="aetools: Basic support for sending Apple Events (deprecated) (Mac)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">aetools</span></code></a> — OSA client support<a class="headerlink" href="#module-aetools" title="Permalink to this headline">¶</a></h1>
<p>The <a class="reference internal" href="#module-aetools" title="aetools: Basic support for sending Apple Events (deprecated) (Mac)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">aetools</span></code></a> module contains the basic functionality on which Python
AppleScript client support is built. It also imports and re-exports the core
functionality of the <a class="reference internal" href="aetypes.html#module-aetypes" title="aetypes: Python representation of the Apple Event Object Model. (deprecated) (Mac)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">aetypes</span></code></a> and <a class="reference internal" href="aepack.html#module-aepack" title="aepack: Conversion between Python variables and AppleEvent data containers. (deprecated) (Mac)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">aepack</span></code></a> modules. The stub packages
generated by <a class="reference internal" href="gensuitemodule.html#module-gensuitemodule" title="gensuitemodule: Create a stub package from an OSA dictionary (Mac)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gensuitemodule</span></code></a> import the relevant portions of
<a class="reference internal" href="#module-aetools" title="aetools: Basic support for sending Apple Events (deprecated) (Mac)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">aetools</span></code></a>, so usually you do not need to import it yourself. The exception
to this is when you cannot use a generated suite package and need lower-level
access to scripting.</p>
<p>The <a class="reference internal" href="#module-aetools" title="aetools: Basic support for sending Apple Events (deprecated) (Mac)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">aetools</span></code></a> module itself uses the AppleEvent support provided by the
<a class="reference internal" href="carbon.html#module-Carbon.AE" title="Carbon.AE: Interface to the Apple Events toolbox. (deprecated) (Mac)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">Carbon.AE</span></code></a> module. This has one drawback: you need access to the window
manager, see section <a class="reference internal" href="../using/mac.html#osx-gui-scripts"><span class="std std-ref">Running scripts with a GUI</span></a> for details. This restriction may be
lifted in future releases.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>This module has been removed in Python 3.x.</p>
</div>
<p>The <a class="reference internal" href="#module-aetools" title="aetools: Basic support for sending Apple Events (deprecated) (Mac)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">aetools</span></code></a> module defines the following functions:</p>
<dl class="function">
<dt id="aetools.packevent">
<code class="descclassname">aetools.</code><code class="descname">packevent</code><span class="sig-paren">(</span><em>ae</em>, <em>parameters</em>, <em>attributes</em><span class="sig-paren">)</span><a class="headerlink" href="#aetools.packevent" title="Permalink to this definition">¶</a></dt>
<dd><p>Stores parameters and attributes in a pre-created <code class="docutils literal notranslate"><span class="pre">Carbon.AE.AEDesc</span></code> object.
<code class="docutils literal notranslate"><span class="pre">parameters</span></code> and <code class="docutils literal notranslate"><span class="pre">attributes</span></code> are  dictionaries mapping 4-character OSA
parameter keys to Python objects. The objects are packed using
<code class="docutils literal notranslate"><span class="pre">aepack.pack()</span></code>.</p>
</dd></dl>

<dl class="function">
<dt id="aetools.unpackevent">
<code class="descclassname">aetools.</code><code class="descname">unpackevent</code><span class="sig-paren">(</span><em>ae</em><span class="optional">[</span>, <em>formodulename</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#aetools.unpackevent" title="Permalink to this definition">¶</a></dt>
<dd><p>Recursively unpacks a <code class="docutils literal notranslate"><span class="pre">Carbon.AE.AEDesc</span></code> event to Python objects. The function
returns the parameter dictionary and the attribute dictionary. The
<code class="docutils literal notranslate"><span class="pre">formodulename</span></code> argument is used by generated stub packages to control where
AppleScript classes are looked up.</p>
</dd></dl>

<dl class="function">
<dt id="aetools.keysubst">
<code class="descclassname">aetools.</code><code class="descname">keysubst</code><span class="sig-paren">(</span><em>arguments</em>, <em>keydict</em><span class="sig-paren">)</span><a class="headerlink" href="#aetools.keysubst" title="Permalink to this definition">¶</a></dt>
<dd><p>Converts a Python keyword argument dictionary <code class="docutils literal notranslate"><span class="pre">arguments</span></code> to the format
required by <code class="docutils literal notranslate"><span class="pre">packevent</span></code> by replacing the keys, which are Python identifiers,
by the four-character OSA keys according to the mapping specified in
<code class="docutils literal notranslate"><span class="pre">keydict</span></code>. Used by the generated suite packages.</p>
</dd></dl>

<dl class="function">
<dt id="aetools.enumsubst">
<code class="descclassname">aetools.</code><code class="descname">enumsubst</code><span class="sig-paren">(</span><em>arguments</em>, <em>key</em>, <em>edict</em><span class="sig-paren">)</span><a class="headerlink" href="#aetools.enumsubst" title="Permalink to this definition">¶</a></dt>
<dd><p>If the <code class="docutils literal notranslate"><span class="pre">arguments</span></code> dictionary contains an entry for <code class="docutils literal notranslate"><span class="pre">key</span></code> convert the value
for that entry according to dictionary <code class="docutils literal notranslate"><span class="pre">edict</span></code>. This converts human-readable
Python enumeration names to the OSA 4-character codes. Used by the generated
suite packages.</p>
</dd></dl>

<p>The <a class="reference internal" href="#module-aetools" title="aetools: Basic support for sending Apple Events (deprecated) (Mac)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">aetools</span></code></a> module defines the following class:</p>
<dl class="class">
<dt id="aetools.TalkTo">
<em class="property">class </em><code class="descclassname">aetools.</code><code class="descname">TalkTo</code><span class="sig-paren">(</span><span class="optional">[</span><em>signature=None</em>, <em>start=0</em>, <em>timeout=0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#aetools.TalkTo" title="Permalink to this definition">¶</a></dt>
<dd><p>Base class for the proxy used to talk to an application. <code class="docutils literal notranslate"><span class="pre">signature</span></code> overrides
the class attribute <code class="docutils literal notranslate"><span class="pre">_signature</span></code> (which is usually set by subclasses) and is
the 4-char creator code defining the application to talk to. <code class="docutils literal notranslate"><span class="pre">start</span></code> can be
set to true to enable running the application on class instantiation.
<code class="docutils literal notranslate"><span class="pre">timeout</span></code> can be specified to change the default timeout used while waiting
for an AppleEvent reply.</p>
</dd></dl>

<dl class="method">
<dt id="aetools.TalkTo._start">
<code class="descclassname">TalkTo.</code><code class="descname">_start</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#aetools.TalkTo._start" title="Permalink to this definition">¶</a></dt>
<dd><p>Test whether the application is running, and attempt to start it if not.</p>
</dd></dl>

<dl class="method">
<dt id="aetools.TalkTo.send">
<code class="descclassname">TalkTo.</code><code class="descname">send</code><span class="sig-paren">(</span><em>code</em>, <em>subcode</em><span class="optional">[</span>, <em>parameters</em>, <em>attributes</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#aetools.TalkTo.send" title="Permalink to this definition">¶</a></dt>
<dd><p>Create the AppleEvent <code class="docutils literal notranslate"><span class="pre">Carbon.AE.AEDesc</span></code> for the verb with the OSA designation
<code class="docutils literal notranslate"><span class="pre">code,</span> <span class="pre">subcode</span></code> (which are the usual 4-character strings), pack the
<code class="docutils literal notranslate"><span class="pre">parameters</span></code> and <code class="docutils literal notranslate"><span class="pre">attributes</span></code> into it, send it to the target application,
wait for the reply, unpack the reply with <code class="docutils literal notranslate"><span class="pre">unpackevent</span></code> and return the reply
appleevent, the unpacked return values as a dictionary and the return
attributes.</p>
</dd></dl>

</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h4>Previous topic</h4>
  <p class="topless"><a href="gensuitemodule.html"
                        title="previous chapter">38.1. <code class="xref py py-mod docutils literal notranslate"><span class="pre">gensuitemodule</span></code> — Generate OSA stub packages</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="aepack.html"
                        title="next chapter">38.3. <code class="xref py py-mod docutils literal notranslate"><span class="pre">aepack</span></code> — Conversion between Python variables and AppleEvent data containers</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../_sources/library/aetools.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>  
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="aepack.html" title="38.3. aepack — Conversion between Python variables and AppleEvent data containers"
             >next</a> |</li>
        <li class="right" >
          <a href="gensuitemodule.html" title="38.1. gensuitemodule — Generate OSA stub packages"
             >previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="https://www.python.org/">Python</a> &#187;</li>
        <li>
          <a href="../index.html">Python 2.7.17 documentation</a> &#187;
        </li>

          <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="macosa.html" >38. MacPython OSA Modules</a> &#187;</li> 
      </ul>
    </div>  
    <div class="footer">
    &copy; <a href="../copyright.html">Copyright</a> 1990-2019, Python Software Foundation.
    <br />
    The Python Software Foundation is a non-profit corporation.
    <a href="https://www.python.org/psf/donations/">Please donate.</a>
    <br />
    Last updated on Oct 19, 2019.
    <a href="../bugs.html">Found a bug</a>?
    <br />
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 2.0.1.
    </div>

  </body>
</html>