Hello
You may try such a script as listed below.
Select a cell in the target table and run this script. Specify the cell name, e.g., A3000, in resulting dialog and it will select the cell.
-- select cell.applescript
_main()
on _main()
tell application "Numbers"
if not (exists document 1) then return
set {table:_table} to my _selection(document 1)
if _table is missing value then
display dialog "Select some cell(s) in target table first"
return
end if
tell _table
set {rk, cn} to {count rows, column -1's name}
end tell
repeat
display dialog "Enter cell name" & return & ¬
" row in 1.." & rk & return & ¬
" column A.." & cn default answer ("A" & rk) with title "Select Cell"
set cellname to text returned of result
try
tell _table
set selection range to range cellname
end tell
exit repeat
on error
display dialog "Unable to select the specified cell: " & cellname
end try
end repeat
end tell
end _main
on _selection(doc)
(*
reference doc : target document
return record : {range:_range, table:_table, sheet:_sheet}
_range = reference to named range in selection
_table = table object to which selection range belongs
_sheet = sheet object to which selection range belongs
*)
(*
Limitation
Numbers allows to select uncontinuous regions
but its scripting interface does not provide decent method to retrieve them.
If uncontinuous regions are selected, 'selection range' returns the minimum continuous region
which includes all the regions in selection.
*)
script o
property parent : {}
property pp : {}
local q, r, s, _range, _table, _sheet
tell application "Numbers"
set pp to doc's every sheet's every table's selection range as list
repeat with p in my pp -- per sheet
set q to p's every reference -- retrieve object (filtering out missing value)
if q ≠ {} then
set q to q's item 1 -- selection range object [1]
set r to q as record -- selection range object specifier record [2]
set _table to r's every reference's item 1 -- container table reference [3]
set s to (a reference to _table's selection range) -- selection range reference [4]
set _range to (a reference to _table's range (s's name)) -- named range reference [5]
set _sheet to (_table as record)'s every reference's item 1 -- container sheet reference [3]
return {range:_range, table:_table, sheet:_sheet}
end if
end repeat
return {range:missing value, table:missing value, sheet:missing value}
end tell
(*
[1] class specifier for 'range' is broken in Numbers 09
[2] «class want» value is broken in Numbers 09
[3] simple method to get «class from» value without asking for «class from» key which causes trouble in recompilation of the token 'from'.
[4] proper reference of selection range object
[5] proper reference of named range object
*)
end script
tell o to run
end _selection
In case, there're two ways to invoke it via menu or keyboard shortcut. Recipes follow.
# Recipe 1 (via script menu)
1) Open /Applications/Utilities/AppleScript Editor.app; and
2) if script menu is not yet enabled, open Preferences… > General and enable "Show Script menu in menu bar"; and
3) copy the code listed below to new document; and
4) save it as compiled script or script bundle with name, e.g., "select cell.scpt" or "select cell.scptd", in ~/Library/Scripts/Applications/Numbers directory so that it appear in script menu in Numbers.
# Recipe 2 (via services menu under 10.6 or later)
1) Open /Applications/Automator.app; and
2) choose "Service" template; and
3) drag "Run AppleScript" action from the left pane to the right pane; and
4) replace the existing template code with the code listed below; and
5) set the service attributes so that service receives [no input] in [Numbers.app], where [...] is set via drop down menu in Automator workflow editor window; and
6) save the workflow with name, e.g., "select cell"; and
7) quit Automator.app.
To set keyboard shortcut for the service:
8) open /Applications/System Preferences; and
9) select Keyboard > Keyboard Shortcuts; and
10) select Services in left pane; and
11) set keyboard shortcut for the service as, e.g., command + shift + 5.
Hope this may help,
H