Jan Erik Moström wrote:

> 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.

Any particular reason for wanting to use Scripting Bridge? Appscript  
provides a native API, better application compatibility and decent  
support tools, so I'd suggest taking a look at that first.


> My problem is that I don't understand how I should translate the  
> applescript commands to the equivalent python code.

ASTranslate <http://appscript.sourceforge.net/tools.html> is very  
handy when trying to figure out how to convert an AppleScript command  
to its appscript equivalent. Type in an AppleScript command, run it,  
and ASTranslate will display the resulting Apple event as Python/Ruby  
code, which should give you a good clue as to what to write in your  
script.


> 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


In appscript, I imagine this would read something like:

from appscript import *

mailsmith = app('Mailsmith')
nm = mailsmith.make(new=k.message_window)
nm.subject.set(subjecttext)
nm.contents.set(bodytext)


HTH

has
-- 
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to