As far as I know, there is no way to hide a column with plain Vanilla script.
We aren’t allowed to set a column width to less than 8 pixels.
In the dictionary, visible apply only to a window.
You may define a shortcut to every menu item thru the system preference pane Keyboard.
If you don’t wish to do that you will have to use the standard GUI Scripting code triggering a menu item.
tell application "Numbers" to tell document 1 to tell sheet 1 to tell table 1
set selection range to range "R1:R2" # Defines the column to hide
end tell
--my select_menu("Numbers", 6, 24) # The long code
my selectMenu("Numbers", 6, 24) # the short code
#=====
(*
my selectMenu("Pages",5, 12)
==== Uses GUIscripting ====
*)
on selectMenu(theApp, mt, mi)
tell application "System Events" to tell process theApp
set frontmost to true
tell menu bar 1 to tell menu bar item mt to ¬
tell menu 1 to click menu item mi
end tell
end selectMenu
#=====
(*
my selectSubMenu("Pages",6, 4, 26)
==== Uses GUIscripting ====
*)
on selectSubMenu(theApp, mt, mi, ms)
tell application "System Events" to tell process theApp
set frontmost to true
tell menu bar 1 to tell menu bar item mt to ¬
tell menu 1 to tell menu item mi to tell menu 1 to click menu item ms
end tell
end selectSubMenu
#=====
(*
useful to get the indexs of the triggered item
my select_Menu("Numbers", 6, 24) (* Tableau > Hide column *)
*)
on select_menu(theApp, mt, mi)
tell application id "com.apple.systemevents" to tell process theApp to tell menu bar 1
get name of menu bar items
(*{
01 - "Apple",
02 - "Numbers",
03 - "Fichier",
04 - "Édition",
05 - "Insertion",
06 - "Tableau",
07 - "Format",
08 - "Disposition",
09 - "Présentation",
10 - "Partager",
11 - "Fenêtre",
12 - "Aide"}
*)
get name of menu bar item mt
-- {"Tableau"}
tell menu bar item mt to tell menu 1
get name of menu items
(* {
01 - "Insérer un rang au-dessus",
02 - "Insérer un rang en dessous",
03 - missing value,
04 - "Insérer une colonne avant",
05 - "Insérer une colonne après",
06 - missing value,
07 - "Supprimer le rang",
08 - "Supprimer la colonne",
09 - missing value,
10 - "Rangs d'en-tête",
11 - "Bloquer les rangs d'en-tête",
12 - "Colonnes d'en-tête",
13 - "Bloquer les colonnes d'en-tête",
14 - "Rangs de bas de tableau",
15 - missing value,
16 - "Ajuster le rang au contenu",
17 - "Ajuster la colonne au contenu",
18 - missing value,
19 - "Répartir les rangs uniformément",
20 - "Répartir les colonnes uniformément",
21 - missing value,
22 - "Masquer le rang",
23 - "Afficher tous les rangs",
24 - "Masquer la colonne",
25 - "Afficher toutes les colonnes",
missing value, "Options Trier et filtrer", "Appliquer les règles de tri", missing value, "Remplir automatiquement les cellules", missing value, "Fusionner les cellules", "Ne plus fusionner les cellules", missing value, "Transposer les rangs et les colonnes", missing value, "Ajuster le texte"}
*)
get name of menu item mi
--{"Répartir les colonnes uniformément"}
click menu item mi
end tell -- menu bar.
end tell -- System Events
end select_menu
#=====
Yvan KOENIG running Sierra 10.12.5 in French (VALLAURIS, France) jeudi 1 juin 2017 10:50:46