【发布时间】:2017-09-17 21:35:50
【问题描述】:
我想在某个时间播放 iTunes 文件夹播放列表,我自己想出了这部分。 但问题是,我想在之后将 iTunes 切换到迷你播放器。这是代码
tell application "iTunes" to quit
delay 5
tell application "iTunes"
reopen
activate
set song repeat to all
set shuffle enabled to true
set sound volume to 35
delay 5
get name of AirPlay devices
set selected of AirPlay device "Airport Express" to true
play playlist "mom's music"
end tell
delay 20
-- here comes the part I don't get
tell application "System Events"
tell process "iTunes"
set frontmost to true
if title of window 1 is "미니 플레이어" then
click menu item 9 of menu 9 of menu bar 1
delay 5
click menu item 9 of menu 9 of menu bar 1
else
click menu item 9 of menu 9 of menu bar 1
end if
end tell
end tell
不要介意上面的部分。请查看“系统事件”部分。
当屏幕保护程序未运行时,它确实按预期工作,但在屏幕保护程序运行时它不工作,但我无法弄清楚我错过了什么。
那么,在我不知道的屏幕保护程序下运行 applescript 是否还有其他限制?任何建议,将不胜感激。谢谢。
2017-09-17 添加
当我按下“窗口”菜单项时,我注意到iTunes(主窗口)消失了。这是否意味着我必须超越屏幕保护程序才能通过 applescript 对 windows 进行任何操作?
【问题讨论】:
标签: applescript