my activateGUIscripting()
tell application "Numbers"
tell document 1 to tell sheet 1 to tell table 1
set value of cell "D2" to 6453
set selection range to range "D2:D45"
delay 0.2
my shortcut("Numbers", 125, "ac") (* shortcut cmd alt down arrow *)
end tell
end tell
--=====
on activateGUIscripting()
tell application "System Events"
if not (UI elements enabled) then set (UI elements enabled) to true (* to be sure than GUI scripting will be active *)
end tell
end activateGUIscripting
--=====
(*
==== Uses GUIscripting ====
*)
on shortcut(a, t, d)
local k
tell application a to activate
tell application "System Events" to tell application process a
try
t * 1
if d is "c" then
key code t using {command down}
else if d is in {"ac", "ca"} then
key code t using {command down, option down}
else if d is in {"sc", "cs"} then
key code t using {command down, shift down}
else if d is in {"kc", "ck"} then
key code t using {command down, control down}
else if (d contains "c") and (d contains "s") and d contains "k" then
key code t using {command down, shift down, control down}
end if
on error
repeat with k in t
if d is "c" then
keystroke (k as text) using {command down}
else if d is in {"ac", "ca"} then
keystroke (k as text) using {command down, option down}
else if d is in {"sc", "cs"} then
keystroke (k as text) using {command down, shift down}
else if d is in {"kc", "ck"} then
keystroke (k as text) using {command down, control down}
else if (d contains "c") and (d contains "s") and d contains "k" then
keystroke (k as text) using {command down, shift down, control down}
end if
end repeat
end try
end tell
end shortcut
--=====
Yvan KOENIG (VALLAURIS, France) mercredi 25 novembre 2009 21:20:50