From 9051ad1bf2375450234f7cc8061b10fc05b745df Mon Sep 17 00:00:00 2001
From: Jack Jansen gensuitemodule
should import the standard suites. Here,
we always select Python:Mac:Lib:lib-scriptpackages:StdSuites
. (There is
one exception to this rule: when you are generating StdSuites
itself
-
you select _builtinSuites
.)
gensuitemodule.py
prompts us for the filename of the
resulting python module. Remember to change folders for the first
module—you don't want to clutter up, say, the
-Eudora folder
-
+Disk Copy folder
with your python
interfaces. If you want to skip a suite, press cancel
and the process
continues with the next suite.
@@ -106,7 +103,6 @@ continues with the next suite.
stored.
Python:Mac:Lib:lib-scriptpackages:StdSuites
-
to import the standard suites (or _builtinSuites
if you are
generating StdSuites
itself). gensuitemodule
does not handle all Python reserved words, so
if
one of the AppleScript verbs is a Python reserved word, a SyntaxError
@@ -129,7 +125,9 @@ continues with the next suite.
Simply rename the class into something acceptable, if this happens;
take a look at how the
print
verb is handled (automatically by gensuitemodule
)
- in the standard suites. System Folder:Extensions:Applescript
.
per application and submodules per suite, is used. Older MacPythons had a
single level of modules, with uncertain semantics. With the new structure,
it is possible for programs to override standard suites, as programs often do.
-It is a good idea to convert your own old programs to the new scheme.
-
-
-
-
mailbox("inbox").message(1).sender
to get the name of the sender of the first message in mailbox
@@ -233,11 +225,9 @@ as it is called in Script Editor, instead of the cryptic lowlevel
Finally, we get the “table of contents” of the module, listing all
classes and such
-by code, which is used by gensuitemodule
.
-
+by code, which is used by gensuitemodule
itself: if you use this
+suite as a base package in a later run this is how it knows what is defined in this
+suite, and what the Python names are.
start=1
: it will run the application i
not already running.
You may want to omit it if you want to talk to the application
only if it is already running, or if the application is something like the Finder.
-Another way to ensure that the application is running is to call talker.start()
.
+Another way to ensure that the application is running is to call talker._start()
.
@@ -318,7 +308,8 @@ OSAX (commonly found in System Folder:Scripting Additions
or something similar). There is one minor gotcha: the application
signature to use is MACS
. You will need to edit the main class
in the __init__.py
file of the created package and change the value
-of _signature
to MACS
.
+of _signature
to MACS
, or use a subclass to the
+same effect.
@@ -347,9 +338,12 @@ is more involved) fullbuild
from the Mac:scripts
folde
Under Mac OS X, the above still works, but with some new difficulties.
-The application package structure can hide the ‘AETE’ or ‘AEUT’ resource
-from gensuitemodule
, so that, for example, it cannot generate an OSA interface to
-iTunes.
+The application package structure can hide the ‘AETE’ or
+‘AEUT’ resource from gensuitemodule
, so that,
+for example, it cannot generate an OSA interface to iTunes. Script
+Editor gets at the dictionary of such programs using a ‘Get
+AETE’ AppleEvent, if someone wants to donate code to use the same
+method for gensuitemodule: by all means!