[Pythonmac-SIG] OSA Range references

Bill Bedford billb@mousa.demon.co.uk
Wed, 21 Feb 2001 01:04:14 +0000


At 12:51 pm -0500 20/02/01, bkenniso@att.net wrote:

>Everyone,
>
>First,I'm not a developer but a user, and I want to thank all of
>you who make my use of Python on the Mac possbile. As I gain more
>knowledge I hope to be able to contribute in some fashion.
>
>I'm currently having a problem figuring out how to specify "ranges"
>when using AppleEvents. I've created a FMPro module and am running
>it interactively. I've been testing out as many aspects of this as
>I can but have yet to figure out how to ask for a range of objects.
>
>If I ask for a specific record there is no problem:
>
>>>>  db.get_data(record(1)) ['Bob','Jones']
>
>but if I ask for a range of records I get
>
>>>>  db.get_data(record(Range(1,3))
>[snip]
>aetools.Error: (-1703 'Wrong data type.', None)
>
>I've searched the docs and the web trying to find an example of
>how to specify ranges with no luck. Perhaps someone might be able
>to give me a quick example or to point me where I should look to
>see how aepack actually formats this.
>

Range in appleevents is a record (Python = dictionary) with the keys 
'star' and 'stop' and the values object specifiers. Python simplifies 
this to slightly in that you only have to specify the objects. So 
your line should read (and I haven't tested this):-

>>>>  db.get_data(record(Range(cell(1),cell(3)))

-- 
Bill Bedford

One of the universal rules of happiness is: always be wary of any
helpful item that weighs less than its operating manual.