当前位置: 动力学知识库 > 问答 > 编程问答 >

iwork - Set Selection in Numbers (Python/Appscript)

问题描述:

How do you set the selection for a table in Numbers using py-appscript?

This seems like it should be really simple to do but the solution is frustratingly evasive. I can get the current selection:

 current_table.selection_range

and I can get its cells:

 current_table.selection_range.cells()

but trying to set() either of them gets an angry appscript error.

网友答案:

Looks like something like this works:

>>> current_table.selection_range.set(to=current_table.ranges[u'B3:C10'])

Note, looking at Number's script dictionary in AppleScript Editor or with ASDictionary, the property selection_range is defined as class range. So that's a clue that you need to come up with a reference of type range to set it.

分享给朋友:
您可能感兴趣的文章:
随机阅读: