Re: scripting safari and menu items
Re: scripting safari and menu items
- Subject: Re: scripting safari and menu items
- From: yvan-koenig <email@hidden>
- Date: Sun, 13 Feb 2005 18:08:25 +0100
Hello,
this one is perhaps easier to read.
property theApp : "Safari"
my selectMenu(3, 7) (* Fichier, Enregistrer sous… *)
my selectSubMenu(4, 12, 4) (* Édition, Rechercher, Poursuivre la
recherche *)
(* A sample with a 1st level menu *)
on selectMenu(mt, mi)
tell application theApp
activate
tell application "System Events"
tell process theApp
tell menu bar 1
set aa to get name of every menu bar item
(*
{"Apple", "Safari", "Fichier", "Édition", ¬
"Présentation", "Historique", "Signets", ¬
"Fenêtre", "Aide"}
*)
set nmbi to (name of menu bar item mt) as text (* 3 = Fichier *)
tell menu bar item nmbi --"Apple"
tell menu nmbi --"Apple"
set bb to name of every menu item
(*
{"Nouvelle fenêtre", "Ouvrir un fichier...", ¬
"Ouvrir une adresse...", "-", ¬
"Fermer", "Fermer toutes les fenêtres", ¬
"Enregistrer sous...", "-", ¬
"Format d'impression...", "Imprimer..."}
*)
set nmi to (name of menu item mi) as text (* Enregistrer sous...
*)
-- click menu item nmi (* temporarily disabled *)
end tell -- menu nmbi
end tell --menu bar item nmbi
end tell -- menu bar 1
end tell -- process theApp
end tell -- application System Events
end tell -- application theApp
end selectMenu
on selectSubMenu(mt, mi, ms)
(* A sample calling a 2nd level menu (submenu) *)
tell application theApp
activate
tell application "System Events"
tell process theApp
tell menu bar 1
set aa to get name of every menu bar item
(*
{"Apple", "Safari", "Fichier", "Édition", ¬
"Présentation", "Historique", "Signets", ¬
"Fenêtre", "Aide"}
*)
set nmbi to (name of menu bar item mt) as text (* 4 = Édition *)
tell menu bar item nmbi --"Apple"
tell menu nmbi --"Apple"
-- set bb to name of every menu item
(*
{"Annuler", "Rétablir", "-", ¬
"Couper", "Copier", "Coller", ¬
"Effacer", "Tout sélectionner", "-", ¬
"Remplissage automatique de formulaire", "-", ¬
"Rechercher", "Orthographe"}
*)
set nmi to (name of menu item mi) as text (* "Rechercher" *)
tell menu item nmi
tell menu nmi
set cc to get name of every menu item
(*
{"Recherche dans Google...", "-", ¬
"Rechercher...", "Poursuivre la recherche", ¬
"Rechercher le précédent", "Rechercher la sélection", ¬
"Aller à la sélection"}
*)
set nsmi to (name of menu item ms) as text (* Poursuivre la
recherche *)
-- click menu item nsmi (* temporarily disabled *)
end tell -- menu nsmi
end tell -- menu item nsmi
end tell -- menu nmbi
end tell --menu bar item nmbi
end tell -- menu bar 1
end tell -- process theApp
end tell -- application System Events
end tell -- application theApp
end selectSubMenu
Yvan KOENIG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden