Numbers Charts - Selecting an Existing Chart

Hi there,

I have written a simple script to update a column in numbers, which in turn updates a chart. What I would like to do next is select that chart so that I can copy it to clipboard.

One method I found is to tell system events to tab to that chart, but that could be problematic if the user clicks on something unexpected before running the script.

Is there a way to tell numbers to select chart 1?

thanks in advance for your help!

Hi.

In Numbers 6.1, I find I can select an entire chart just by asking for its properties! Numbers changes the focus to it in its GUI. Similarly with tables.

tell application "Numbers"
	activate
	tell document 1
		get properties of chart 1 of sheet 1
	end tell
end tell

Thanks Nigel, this is exactly what I was looking for.
Means i don’t need to copy-paste ‘keystroke tab’ 50 times into my script!!!

It’s enough:

tell application "Numbers"
	activate
	chart 1 of sheet 1 of document 1
end tell

Selecting text box:

tell application "Numbers"
    activate
    text item 1 of sheet 1 of document 1
end tell

Selecting table:

tell application "Numbers"
	activate
	table 1 of sheet 1 of document 1
end tell

Not with the document I tested and have just retested. If the required chart or table isn’t already selected, I have to ask for its properties in order to get the focus to change to it. This works even if the chart or table’s in a different sheet from the current focus. Presumably the behaviour’s entirely incidental and may be connected with some preference setting.