Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
2 | <html> | |
3 | <head> | |
4 | <link rel="STYLESHEET" href="mac.css" type='text/css' /> | |
5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> | |
6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> | |
7 | <link rel="first" href="mac.html" title='Macintosh Library Modules' /> | |
8 | <link rel='contents' href='contents.html' title="Contents" /> | |
9 | <link rel='index' href='genindex.html' title='Index' /> | |
10 | <link rel='last' href='about.html' title='About this document...' /> | |
11 | <link rel='help' href='about.html' title='About this document...' /> | |
12 | <link rel="next" href="module-aetools.html" /> | |
13 | <link rel="prev" href="scripting.html" /> | |
14 | <link rel="parent" href="scripting.html" /> | |
15 | <link rel="next" href="module-aetools.html" /> | |
16 | <meta name='aesop' content='information' /> | |
17 | <title>3.1 gensuitemodule -- Generate OSA stub packages</title> | |
18 | </head> | |
19 | <body> | |
20 | <DIV CLASS="navigation"> | |
21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> | |
22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
23 | <tr> | |
24 | <td class='online-navigation'><a rel="prev" title="3. MacPython OSA Modules" | |
25 | href="scripting.html"><img src='../icons/previous.png' | |
26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
27 | <td class='online-navigation'><a rel="parent" title="3. MacPython OSA Modules" | |
28 | href="scripting.html"><img src='../icons/up.png' | |
29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
30 | <td class='online-navigation'><a rel="next" title="3.2 aetools " | |
31 | href="module-aetools.html"><img src='../icons/next.png' | |
32 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
33 | <td align="center" width="100%">Macintosh Library Modules</td> | |
34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
35 | href="contents.html"><img src='../icons/contents.png' | |
36 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
38 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
39 | <td class='online-navigation'><a rel="index" title="Index" | |
40 | href="genindex.html"><img src='../icons/index.png' | |
41 | border='0' height='32' alt='Index' width='32' /></A></td> | |
42 | </tr></table> | |
43 | <div class='online-navigation'> | |
44 | <b class="navlabel">Previous:</b> | |
45 | <a class="sectref" rel="prev" href="scripting.html">3. MacPython OSA Modules</A> | |
46 | <b class="navlabel">Up:</b> | |
47 | <a class="sectref" rel="parent" href="scripting.html">3. MacPython OSA Modules</A> | |
48 | <b class="navlabel">Next:</b> | |
49 | <a class="sectref" rel="next" href="module-aetools.html">3.2 aetools </A> | |
50 | </div> | |
51 | <hr /></div> | |
52 | </DIV> | |
53 | <!--End of Navigation Panel--> | |
54 | ||
55 | <H1><A NAME="SECTION005100000000000000000"> | |
56 | 3.1 <tt class="module">gensuitemodule</tt> -- | |
57 | Generate OSA stub packages</A> | |
58 | </H1> | |
59 | ||
60 | <P> | |
61 | <A NAME="module-gensuitemodule"></A> | |
62 | <p class="availability">Availability: <span | |
63 | class="platform">Macintosh</span>.</p> | |
64 | ||
65 | <P> | |
66 | The <tt class="module">gensuitemodule</tt> module creates a Python package implementing | |
67 | stub code for the AppleScript suites that are implemented by a specific | |
68 | application, according to its AppleScript dictionary. | |
69 | ||
70 | <P> | |
71 | It is usually invoked by the user through the <b class="program">PythonIDE</b>, but | |
72 | it can also be run as a script from the command line (pass | |
73 | <b class="programopt">--help</b> for help on the options) or imported from Python | |
74 | code. For an example of its use see <span class="file">Mac/scripts/genallsuites.py</span> | |
75 | in a source distribution, which generates the stub packages that are | |
76 | included in the standard library. | |
77 | ||
78 | <P> | |
79 | It defines the following public functions: | |
80 | ||
81 | <P> | |
82 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
83 | <td><nobr><b><tt id='l2h-138' xml:id='l2h-138' class="function">is_scriptable</tt></b>(</nobr></td> | |
84 | <td><var>application</var>)</td></tr></table></dt> | |
85 | <dd> | |
86 | Returns true if <code>application</code>, which should be passed as a pathname, | |
87 | appears to be scriptable. Take the return value with a grain of salt: | |
88 | <b class="program">Internet Explorer</b> appears not to be scriptable but definitely is. | |
89 | </dl> | |
90 | ||
91 | <P> | |
92 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
93 | <td><nobr><b><tt id='l2h-139' xml:id='l2h-139' class="function">processfile</tt></b>(</nobr></td> | |
94 | <td><var>application</var><big>[</big><var>, output, basepkgname, | |
95 | edit_modnames, creatorsignature, dump, verbose</var><big>]</big><var></var>)</td></tr></table></dt> | |
96 | <dd> | |
97 | Create a stub package for <code>application</code>, which should be passed as | |
98 | a full pathname. For a <span class="file">.app</span> bundle this is the pathname to the | |
99 | bundle, not to the executable inside the bundle; for an unbundled CFM | |
100 | application you pass the filename of the application binary. | |
101 | ||
102 | <P> | |
103 | This function asks the application for its OSA terminology resources, | |
104 | decodes these resources and uses the resultant data to create the Python | |
105 | code for the package implementing the client stubs. | |
106 | ||
107 | <P> | |
108 | <code>output</code> is the pathname where the resulting package is stored, if | |
109 | not specified a standard "save file as" dialog is presented to | |
110 | the user. <code>basepkgname</code> is the base package on which this package | |
111 | will build, and defaults to <tt class="module">StdSuites</tt>. Only when generating | |
112 | <tt class="module">StdSuites</tt> itself do you need to specify this. | |
113 | <code>edit_modnames</code> is a dictionary that can be used to change | |
114 | modulenames that are too ugly after name mangling. | |
115 | <code>creator_signature</code> can be used to override the 4-char creator | |
116 | code, which is normally obtained from the <span class="file">PkgInfo</span> file in the | |
117 | package or from the CFM file creator signature. When <code>dump</code> is | |
118 | given it should refer to a file object, and <code>processfile</code> will stop | |
119 | after decoding the resources and dump the Python representation of the | |
120 | terminology resources to this file. <code>verbose</code> should also be a file | |
121 | object, and specifying it will cause <code>processfile</code> to tell you what | |
122 | it is doing. | |
123 | </dl> | |
124 | ||
125 | <P> | |
126 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
127 | <td><nobr><b><tt id='l2h-140' xml:id='l2h-140' class="function">processfile_fromresource</tt></b>(</nobr></td> | |
128 | <td><var>application</var><big>[</big><var>, output, | |
129 | basepkgname, edit_modnames, creatorsignature, dump, verbose</var><big>]</big><var></var>)</td></tr></table></dt> | |
130 | <dd> | |
131 | This function does the same as <code>processfile</code>, except that it uses a | |
132 | different method to get the terminology resources. It opens <code>application</code> | |
133 | as a resource file and reads all <code>"aete"</code> and <code>"aeut"</code> resources | |
134 | from this file. | |
135 | </dl> | |
136 | ||
137 | <DIV CLASS="navigation"> | |
138 | <div class='online-navigation'> | |
139 | <p></p><hr /> | |
140 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
141 | <tr> | |
142 | <td class='online-navigation'><a rel="prev" title="3. MacPython OSA Modules" | |
143 | href="scripting.html"><img src='../icons/previous.png' | |
144 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
145 | <td class='online-navigation'><a rel="parent" title="3. MacPython OSA Modules" | |
146 | href="scripting.html"><img src='../icons/up.png' | |
147 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
148 | <td class='online-navigation'><a rel="next" title="3.2 aetools " | |
149 | href="module-aetools.html"><img src='../icons/next.png' | |
150 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
151 | <td align="center" width="100%">Macintosh Library Modules</td> | |
152 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
153 | href="contents.html"><img src='../icons/contents.png' | |
154 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
155 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
156 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
157 | <td class='online-navigation'><a rel="index" title="Index" | |
158 | href="genindex.html"><img src='../icons/index.png' | |
159 | border='0' height='32' alt='Index' width='32' /></A></td> | |
160 | </tr></table> | |
161 | <div class='online-navigation'> | |
162 | <b class="navlabel">Previous:</b> | |
163 | <a class="sectref" rel="prev" href="scripting.html">3. MacPython OSA Modules</A> | |
164 | <b class="navlabel">Up:</b> | |
165 | <a class="sectref" rel="parent" href="scripting.html">3. MacPython OSA Modules</A> | |
166 | <b class="navlabel">Next:</b> | |
167 | <a class="sectref" rel="next" href="module-aetools.html">3.2 aetools </A> | |
168 | </div> | |
169 | </div> | |
170 | <hr /> | |
171 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> | |
172 | </DIV> | |
173 | <!--End of Navigation Panel--> | |
174 | <ADDRESS> | |
175 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. | |
176 | </ADDRESS> | |
177 | </BODY> | |
178 | </HTML> |