Sophie

Sophie

distrib > Mandriva > current > i586 > media > main-updates > by-pkgid > 8f1462e52e1797a02c97073eed0b7f92 > files > 647

python-docs-2.6.5-2.5mdv2010.2.i586.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>38.2. aetools — OSA client support &mdash; Python v2.6.5 documentation</title>
    <link rel="stylesheet" href="../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '2.6.5',
        COLLAPSE_MODINDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within Python v2.6.5 documentation"
          href="../_static/opensearch.xml"/>
    <link rel="author" title="About these documents" href="../about.html" />
    <link rel="copyright" title="Copyright" href="../copyright.html" />
    <link rel="top" title="Python v2.6.5 documentation" href="../index.html" />
    <link rel="up" title="38. MacPython OSA Modules" href="macosa.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" />
 

  </head>
  <body>
    <div class="related">
      <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="../modindex.html" title="Global Module Index"
             accesskey="M">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="../index.html">Python v2.6.5 documentation</a> &raquo;</li>

          <li><a href="index.html" >The Python Standard Library</a> &raquo;</li>
          <li><a href="macosa.html" accesskey="U">38. MacPython OSA Modules</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="module-aetools">
<h1>38.2. <tt class="xref docutils literal"><span class="pre">aetools</span></tt> &#8212; OSA client support<a class="headerlink" href="#module-aetools" title="Permalink to this headline">¶</a></h1>
<p><em>Platforms: </em>Mac</p>
<p>The <tt class="xref docutils literal"><span class="pre">aetools</span></tt> 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 title="(Mac) Python representation of the Apple Event Object Model. (deprecated)" class="reference external" href="aetypes.html#module-aetypes"><tt class="xref docutils literal"><span class="pre">aetypes</span></tt></a> and <a title="(Mac) Conversion between Python variables and AppleEvent data containers. (deprecated)" class="reference external" href="aepack.html#module-aepack"><tt class="xref docutils literal"><span class="pre">aepack</span></tt></a> modules. The stub packages
generated by <a title="(Mac) Create a stub package from an OSA dictionary" class="reference external" href="gensuitemodule.html#module-gensuitemodule"><tt class="xref docutils literal"><span class="pre">gensuitemodule</span></tt></a> import the relevant portions of
<tt class="xref docutils literal"><span class="pre">aetools</span></tt>, 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 <tt class="xref docutils literal"><span class="pre">aetools</span></tt> module itself uses the AppleEvent support provided by the
<a title="(Mac) Interface to the Apple Events toolbox. (deprecated)" class="reference external" href="carbon.html#module-Carbon.AE"><tt class="xref docutils literal"><span class="pre">Carbon.AE</span></tt></a> module. This has one drawback: you need access to the window
manager, see section <a class="reference external" href="../using/mac.html#osx-gui-scripts"><em>Running scripts with a GUI</em></a> for details. This restriction may be
lifted in future releases.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This module has been removed in Python 3.x.</p>
</div>
<p>The <tt class="xref docutils literal"><span class="pre">aetools</span></tt> module defines the following functions:</p>
<dl class="function">
<dt id="aetools.packevent">
<tt class="descclassname">aetools.</tt><tt class="descname">packevent</tt><big>(</big><em>ae</em>, <em>parameters</em>, <em>attributes</em><big>)</big><a class="headerlink" href="#aetools.packevent" title="Permalink to this definition">¶</a></dt>
<dd>Stores parameters and attributes in a pre-created <tt class="docutils literal"><span class="pre">Carbon.AE.AEDesc</span></tt> object.
<tt class="docutils literal"><span class="pre">parameters</span></tt> and <tt class="docutils literal"><span class="pre">attributes</span></tt> are  dictionaries mapping 4-character OSA
parameter keys to Python objects. The objects are packed using
<tt class="docutils literal"><span class="pre">aepack.pack()</span></tt>.</dd></dl>

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

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

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

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

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

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

</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <h4>Previous topic</h4>
            <p class="topless"><a href="gensuitemodule.html"
                                  title="previous chapter">38.1. <tt class="docutils literal"><span class="pre">gensuitemodule</span></tt> &#8212; Generate OSA stub packages</a></p>
            <h4>Next topic</h4>
            <p class="topless"><a href="aepack.html"
                                  title="next chapter">38.3. <tt class="docutils literal docutils literal"><span class="pre">aepack</span></tt> &#8212; Conversion between Python variables and AppleEvent data containers</a></p>
            <h3>This Page</h3>
            <ul class="this-page-menu">
              <li><a href="../_sources/library/aetools.txt"
                     rel="nofollow">Show Source</a></li>
            </ul>
          <div id="searchbox" style="display: none">
            <h3>Quick search</h3>
              <form class="search" action="../search.html" method="get">
                <input type="text" name="q" size="18" />
                <input type="submit" value="Go" />
                <input type="hidden" name="check_keywords" value="yes" />
                <input type="hidden" name="area" value="default" />
              </form>
              <p class="searchtip" style="font-size: 90%">
              Enter search terms or a module, class or function name.
              </p>
          </div>
          <script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <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="../modindex.html" title="Global 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="../index.html">Python v2.6.5 documentation</a> &raquo;</li>

          <li><a href="index.html" >The Python Standard Library</a> &raquo;</li>
          <li><a href="macosa.html" >38. MacPython OSA Modules</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
    &copy; <a href="../copyright.html">Copyright</a> 1990-2010, Python Software Foundation.
    <br />
    The Python Software Foundation is a non-profit corporation.  
    <a href="http://www.python.org/psf/donations/">Please donate.</a>
    <br />
    Last updated on Mar 19, 2010.
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.5.
    </div>

  </body>
</html>