Rép: How may I get/trigger some menu items in Pages
Rép: How may I get/trigger some menu items in Pages
- Subject: Rép: How may I get/trigger some menu items in Pages
- From: Yvan KOENIG <email@hidden>
- Date: Thu, 14 Sep 2006 14:14:10 +0200
Hello
I added some code to be sure that I am working with the "General
Preferences" window.
--[SCRIPT]
set theApp to "Pages"
tell application theApp
set lstr to localized string "Show Inspector"
set lstr to localized string "Hide Inspector"
set lstr to localized string "New Inspector" -- localized unavailable
set lstr to localized string "Preferences…" -- localized unavailable
set lstr to localized string "Centimeter" -- localized unavailable
set lstr to localized string "Smooth Path" -- localized unavailable
(stored in UndoStrings.strings)
end tell
tell application theApp
set pp to localized string "%@ Preferences"
if pp starts with "%@ " then
set p to (text 4 thru end of pp)
else
set p to (text 1 thru -4 of pp)
end if
activate
tell application "System Events"
tell process theApp
click menu item (p & "…") of menu 2 of menu bar 1
set _ to get name of every window
repeat with i in _
if i contains p then
set wPrefs to i
exit repeat
end if
end repeat
tell window wPrefs to set bb to title of buttons of UI element 4
if bb's item 1 is not in wPrefs then
(* activate "Préférences Général" *)
click button 1 of UI element 4 of window wPrefs
set _ to get name of every window
repeat with i in _
if i contains p then
set wPrefs to i
exit repeat
end if
end repeat
end if
tell window wPrefs -- fenêtre Préférences
get properties of pop up button 2
click pop up button 2 (* Unités de la règle *)
get properties of UI elements
-- how may I grab the names of the four menu items
-- I want to set it to centimeters/centimètres
end tell -- fenêtre Préférences
end tell -- process theApp
end tell -- application System Events
end tell -- application theApp
--[/SCRIPT]
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