When scripting Apple’s Numbers app, when would I want to bother creating a selection range
. As I can reference each individual cell by created name, what’s the advantage of using a selected range? My access is non-contiguous columns on each row if that matters.
The script “Accessing table cells by specified row and column headers” is in my ebook “iWork (Keynote+Pages+Numbers) Scripting book with AppleScript”.
You don’t create a selection range (except by selecting cells). It is a property of the table.
Numbers doesn’t provide access to many things but you can still do a few things, for example, sort or format the selection rather than the entire table.
Non-contiguity actually does matter as it seems that the affected range actually includes all non-selected contiguous cells inside the selection.
You don’t create a selection range (except by selecting cells). It is a property of the table.
I misspoke. A selection range is set, not created. While I did find a use for one, apparently it’s not necessary to use one.
From Numbers & AppleScript: Range Coordinates:
Although a table selection may be useful to provide feedback to the script user, it is not necessary to actually have the script select a range first, in order to modify its contents, or change the values of its properties. Such tasks can be accomplished by simply targeting the defined range in a script.
Go figure I’d read everything else and overlook the Important notice. Thanks for your help.
I don’t know Japanese though.
It is actually initially set once you have a table — the table itself need not be selected. It can further be ‘set’ by selecting cells within the GUI. If no cell or range is actually selected, then the ‘selection range’ will be identical to the table’s ‘cell range’, ie a reference to every cell in it. No use of the ‘set
’ command is required.