[Pythonmac-SIG] Apple Events / iTunes
Jack Jansen
Jack.Jansen at cwi.nl
Fri Jul 4 00:59:57 EDT 2003
On donderdag, jul 3, 2003, at 23:48 Europe/Amsterdam, Bob Ippolito
wrote:
> I attempted using
> gensuitemodule.processfile_fromresource('/Applications/iTunes/
> Contents/Resources/iTunes.rsrc') and it looks like it did _most_ of
> what I'd expect it to do, except it left out __init__.py. I'm not at
> all experienced with the python OSA support, so it'd take me a long
> time to figure out how to hack one together based upon what other
> packages look like. Is this a bug in processfile_fromresource, do I
> need to pass more options to it?
Here's a bit of text from the new embedding tutorial in PyObjC (which
happens to use iTunes through OSA). Let me know if it doesn't work for
you. I haven't a clue why __init__ would be left out...
15. Now we need to make the program talk to iTunes. The MacPython
implementation
to the Open Scripting Architecture requires an extra step when
compared to
AppleScript: you need to manually generate a Python package that
wraps all the
AppleScript terminology for an application. To make matters more
complicated
iTunes is one of those special cases where the standard way to
generate this
package (start the application, ask it for its terminology) does
not work,
so we have to actually look into the bowels of ``iTunes.app``. This
leads to
the following hefty command line which you should run in the
``SimpleComboBoxPlus`` directory::
% cd SimpleComboBoxPlus
% setenv FWPYTHON
/Library/Frameworks/Python.framework/Versions/Current
% pythonw $FWPYTHON/lib/python2.3/plat-mac/gensuitemodule.py \
--output iTunes --resource --creator hook \
/Applications/iTunes.app/Contents/Resources/iTunes.rsrc
This assumes MacPython is installed in the standard place and
``pythonw``
is on your $PATH.
> Oh, also, does anyone remember how to turn on apple event debugging?
> I recall reading somewhere that you could have all apple events logged
> to the console, and I remember trying it.. but I don't remember where
> I read it or what it was. I think it was an environment variable?
If anyone tells you this I would be very interested in hearing it too.
All my
OS9 debug tools for OSA stopped working:-(
--
- Jack Jansen <Jack.Jansen at oratrix.com>
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution -- Emma
Goldman -
More information about the Pythonmac-SIG
mailing list