Я новичок в Applescript. Я провел поиск и чтение и нашел что-то, что должно работать для активации пункта меню:
on do_menu(app_name, menu_name, menu_item)
try
-- bring the target application to the front
tell application app_name
activate
end tell
tell application "System Events"
tell process app_name
tell menu bar 1
tell menu bar item menu_name
tell menu menu_name
click menu item menu_item
end tell
end tell
end tell
end tell
end tell
return true
on error error_message
return false
end try
end do_menu
-- In my case I want to start Seamonkey and open the Composer window (and select it) so I
-- do:
do_menu("SeaMonkey", "Windows", "Composer")
Когда я запускаю это окно журнала событий показывает:
tell application "SeaMonkey"
activate
end tell
tell application "System Events"
click menu item "Composer" of menu "Windows" of menu bar item "Windows" of menu bar 1 of process "SeaMonkey"
--> error number -1728 from «class mbri» "Windows" of «class mbar» 1 of «class prcs» "SeaMonkey"
end tell
Результат:
ложь
Я не вижу, что я делаю неправильно.