Re: [Pyobjc-dev] Find By Content
Brought to you by:
ronaldoussoren
From: Bob I. <bo...@re...> - 2003-11-14 21:17:21
|
On Nov 14, 2003, at 3:43 PM, Dethe Elza wrote: > I am trying to get started using PyObjC. What I'm interested in is > creating a command-line search tool using the Find By Content API, > which is in the ApplicationServices framework. But I haven't been > able to figure out how to bootstrap far enough to find the API calls > from Python. > > Is the ApplicationServices framework already exposed by PyObjC? > > If not, how do I wrap it? I've tried to follow the instructions here: > http://pyobjc.sourceforge.net/doc/wrapping.php, but haven't had luck > with it. ApplicationServices is not an Objective C framework, it can not be wrapped (directly) with PyObjC. As you can see by the documentation ( http://developer.apple.com/documentation/Carbon/Reference/ Find_By_Content/index.html ), it's part of Carbon. Carbon frameworks are a lot more work to wrap. You'll want to use a tool like bgen, Pyrex, or SWIG .. or just write the bindings by hand (see "Extending and Embedding" and "Python/C API" at http://www.python.org/doc/current/ ). It's not very fun. There's also the option of writing an ObjC framework that wraps the C functions, but that doesn't look like it would make much sense in this case as the functions are not primarily CoreFoundation based. In short, it's not possible to wrap any APi that was available in Mac OS before OS X (and even several new APIs that are not ObjC) using PyObjC (directly). Currently, the only part of the Find by Content API that is wrapped are the error codes ;) You're on your own here, properly wrapping about 50 functions and having them work correctly takes a good while even if you know the tools well. You may want to ask on pythonmac-sig if anyone wants to volunteer to write it, or to help write it. -bob |