Hello
I’m trying to help an user which want to apply the “Categorize by column” feature in Numbers.
There is no other track than GUI scripting.
Alas, I am able to open the contextual menu containing the menu item but find no way to reach the menu item itself.
property the_column : 4
on run
tell application "Numbers" to tell document 1
set dName to name
tell sheet 1
set sname to name
tell table 1
set tname to name
set selection range to column the_column
end tell -- table
end tell -- sheet
end tell -- Numbers
set avant to current date
my categorize_column("Numbers", dName, sname, tname, the_column)
tell application "System Events"
activate
display dialog "done in " & ((current date) - avant) & " seconds"
end tell
end run
--=====
on categorize_column(the_app, d_Name, s_Name, t_Name, c_num)
tell application the_app to activate
tell application "System Events" to tell (first application process whose title is the_app)
tell first group of UI element 1 of UI element 1 of UI element 1 of scroll area 2 of splitter group 1 of last splitter group of splitter group 1 of window d_Name
(*
<AXApplication: "Numbers">
<AXWindow: "bof.numbers">
<AXSplitGroup>
<AXSplitGroup>
<AXSplitGroup>
<AXScrollArea>
<AXLayoutArea>
<AXMenuButton>
*)
click menu button c_num
(*
Now, need to trigger menu item 11 of menu 1
but don't find the way to do it !
<AXMenu>
<AXMenuItem: "Catégoriser selon cette colonne">
*)
end tell -- first group of
tell window d_Name
properties of every sheet
end tell
--keystroke "k" using {command down, option down, shift down, control down}
end tell -- System Events
end categorize_column
Help that some one know the trick to use.
Yvan KOENIG (VALLAURIS, France) mardi 3 août 2010 16:21:48