[Pythonmac-SIG] coercing to text
hengist.podd e-mail
hengist.podd at virgin.net
Mon Dec 14 14:37:12 CET 2009
Adam Morris wrote:
> In Applescript, I would write the following:
>
> tell app "Pages" to tell front document to get its selection -- text from
> character x to character y
> tell app "Pages" to tell front document to get its selection as text --
> "whatever is selected"
At a guess, the 'text' type isn't recognised outside of AppleScript
2.0 and you need to specify the 'Unicode text' type instead. So try
k.Unicode_text in place of k.text and see if that works. (Annoyingly,
applications seem to ignore unrecognised 'as' parameters rather than
reporting them as errors, otherwise you'd know for sure if that was
the problem.)
If you run your above AppleScript in ASTranslate as Ned suggests, it
will display each Apple event that AppleScript sends in appscript
syntax. Very handy when you already know how to do it AppleScript and
need some clues on how to write your appscript commands correctly.
HTH
has
More information about the Pythonmac-SIG
mailing list