[Pythonmac-SIG] Using scripting bridge
Jan Erik Moström
lists at mostrom.pp.se
Thu Mar 27 11:52:14 CET 2008
I'm doing my first attempts in trying to use the scripting
bridge and I'm not very successful. I probably doesn't
understand how to do things at all and unfortunately I can't
find any docs on how to do things.
What I want to do is basically to do some data processing using
python and then control various applications and insert data
into them. My first attempt is to be able to script Mailsmith.
My problem is that I don't understand how I should translate the
applescript commands to the equivalent python code.
If someone could give me some hints or point me to some
documentation of how to how to do this translation I would be grateful.
Here is a small snippet that I can't translate
on createMessageInMailsmith(subjectText, bodyText,
recipientList, accountName)
tell application "Mailsmith"
set nm to make new message window
tell nm
set subject to subjectText
set contents to bodyText
end tell
end tell
end createMessageInMailsmith
unfortunately I don't get much further than
#! /usr/bin/env python
from Foundation import *
from ScriptingBridge import *
mailsmith = SBApplication.applicationWithBundleIdentifier_('com.barebones.mailsmith')
def createemail( account, recipients, subject, body, queue =
False ):
mailsmith.makeNewMessageWindow()
createemail( 'jobbet', 'Some subject', 'body text')
jem
--
Jan Erik Moström, www.mostrom.pp.se
More information about the Pythonmac-SIG
mailing list