FROM : John C. Daub
DATE : Sat May 17 23:47:13 2008
on 5/17/08 10:16 AM, Georg Seifert at georg.<email_removed> wrote:
> I want wo be able to make my program scriptable. Most important with
> python.
Why is Python most important? Because you like it and know it well? or
because it's what the vast majority of your users use? The point is, make
sure you choose a solution that suits your users best.
> 1) make it scriptable with AppleScript and use the Python/Applescript
> bridge or
> 2) embed it (with the python framework) and use "Py_Initialize();" and
> "static PyMethodDef EmbMethods[] = {"
Either way can work, just depends what you want.
Some technical limitations tho:
1. Scripting bridge is only available (as an OS built-in) in Mac OS X 10.5
and later. If your need to support prior OS versions, you may need to do
some additional work with PyObjC to get things available with Python. I'm
not sure what that would entail exactly, just pointing out that Scripting
Bridge is 10.5 and later.
2. If you are going to embed Python in your app, you're going to risk issues
with the system. For instance, in one of the apps I write I embed Python. We
built it back when Tiger was the OS and so we built against Python 2.3.5,
since that's what was in the 10.4 OS SDK. We are able to have our app run on
Leopard because while Apple did update the built-in Python.framework to use
Python 2.5.1, they did ship a minimal runtime of 2.3. Now if in Mac OS X
10.6 Apple doesn't ship a Python 2.3, my app may break. Apple's suggestion
is basically to make your own Python.framework, embed it within your app,
and use that. IMHO that's not ideal, but what else can you do?
I'm actually working on making another one of my apps scriptable via
AppleScript right now. And if you happen to be writing a Cocoa-based app,
the Cocoa Scripting support is pretty nice for adding scripting support into
your app. I think the advantage of the AppleScript route is that AppleScript
is kinda the native scripting language of the OS. If your app is
AppleScriptable, a whole world is open to you and your users, and they can
have a great deal of flexibility... if nothing else, they could write their
scripts in AppleScript or Python, useful if they know one language but not
the other and saves them from having to learn a language just to write
scripts to drive your app. If you write in Python, it just doesn't open up
as many doors as AppleScript does.
While I personally like the Python language a lot and find writing
AppleScripts to often be a masochistic exercise, the technology of
AppleScript and how it plays into the greater OS and user experience -- I
think -- makes it the way to go in terms of your app's scripting language. I
think it gives the most options and flexibility, and hopefully few limits
and/or problems.
Just my opinion.
--
John C. Daub }:-)>=
<mailto:<email_removed>> <http://www.hsoi.com/>
"Weak mind, weak fist. Strong mind, no need for fist."
DATE : Sat May 17 23:47:13 2008
on 5/17/08 10:16 AM, Georg Seifert at georg.<email_removed> wrote:
> I want wo be able to make my program scriptable. Most important with
> python.
Why is Python most important? Because you like it and know it well? or
because it's what the vast majority of your users use? The point is, make
sure you choose a solution that suits your users best.
> 1) make it scriptable with AppleScript and use the Python/Applescript
> bridge or
> 2) embed it (with the python framework) and use "Py_Initialize();" and
> "static PyMethodDef EmbMethods[] = {"
Either way can work, just depends what you want.
Some technical limitations tho:
1. Scripting bridge is only available (as an OS built-in) in Mac OS X 10.5
and later. If your need to support prior OS versions, you may need to do
some additional work with PyObjC to get things available with Python. I'm
not sure what that would entail exactly, just pointing out that Scripting
Bridge is 10.5 and later.
2. If you are going to embed Python in your app, you're going to risk issues
with the system. For instance, in one of the apps I write I embed Python. We
built it back when Tiger was the OS and so we built against Python 2.3.5,
since that's what was in the 10.4 OS SDK. We are able to have our app run on
Leopard because while Apple did update the built-in Python.framework to use
Python 2.5.1, they did ship a minimal runtime of 2.3. Now if in Mac OS X
10.6 Apple doesn't ship a Python 2.3, my app may break. Apple's suggestion
is basically to make your own Python.framework, embed it within your app,
and use that. IMHO that's not ideal, but what else can you do?
I'm actually working on making another one of my apps scriptable via
AppleScript right now. And if you happen to be writing a Cocoa-based app,
the Cocoa Scripting support is pretty nice for adding scripting support into
your app. I think the advantage of the AppleScript route is that AppleScript
is kinda the native scripting language of the OS. If your app is
AppleScriptable, a whole world is open to you and your users, and they can
have a great deal of flexibility... if nothing else, they could write their
scripts in AppleScript or Python, useful if they know one language but not
the other and saves them from having to learn a language just to write
scripts to drive your app. If you write in Python, it just doesn't open up
as many doors as AppleScript does.
While I personally like the Python language a lot and find writing
AppleScripts to often be a masochistic exercise, the technology of
AppleScript and how it plays into the greater OS and user experience -- I
think -- makes it the way to go in terms of your app's scripting language. I
think it gives the most options and flexibility, and hopefully few limits
and/or problems.
Just my opinion.
--
John C. Daub }:-)>=
<mailto:<email_removed>> <http://www.hsoi.com/>
"Weak mind, weak fist. Strong mind, no need for fist."
| Related mails | Author | Date |
|---|---|---|
| Georg Seifert | May 17, 17:16 | |
| has | May 17, 23:12 | |
| John C. Daub | May 17, 23:47 | |
| has | May 18, 11:56 | |
| John C. Daub | May 18, 13:06 | |
| Georg Seifert | May 18, 13:56 | |
| has | May 18, 22:47 | |
| John C. Daub | May 19, 00:34 |






Cocoa mail archive

