我試圖創建一個小的applescript,它將啓動DVD Player應用程序,然後將其調整爲其實際大小。代碼如下所示。當我運行代碼時,DVD播放器會啓動,但不會調整窗口的大小。我錯過了什麼讓這個工作?AppleScript:如何啓動應用程序,然後執行菜單命令
感謝, 羅布
do_menu("DVD Player", "View", "Actual Size")
on do_menu(app_name, menu_name, menu_item)
try
-- bring the target application to the front
tell application app_name
activate
end tell
delay 3
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
+1爲詞典建議。 – 2010-11-22 15:39:43
梅森 - 感謝您的幫助和有關AppleScript詞典的知識 – calmcajun 2010-11-23 02:25:37
不客氣。 – 2010-11-24 00:47:07