通过AppleScript播放AirPlay扬声器

通过AppleScript播放AirPlay扬声器,applescript,itunes,airplay,Applescript,Itunes,Airplay,我在iTunes11中使用Indigo切换Airplay设备时取得了部分成功,但我需要一些帮助。我可以选择和切换一个扬声器,但我真的希望能够选择多个按钮,然后切换所有或部分扬声器。以下是我为其中一人所做的: tell application "iTunes" to activate tell application "System Events" tell window "iTunes" of process "iTunes" click (first UI element w

我在iTunes11中使用Indigo切换Airplay设备时取得了部分成功,但我需要一些帮助。我可以选择和切换一个扬声器,但我真的希望能够选择多个按钮,然后切换所有或部分扬声器。以下是我为其中一人所做的:

tell application "iTunes" to activate
tell application "System Events"
   tell window "iTunes" of process "iTunes"
      click (first UI element whose help is "Choose which speakers to use.")
      keystroke "Master Bedroom" & return
      --perform action "press" in radio button "Multiple" of window "iTunes"--
   end tell
end tell

因此,代码打开它并突出显示主卧行,但它实际上没有选中复选框,我使用了注释掉的行,但无法使其工作。想法?

我现在没有iTunes,但是选择带有系统事件的复选框的语法应该是
单击复选框“多个”
我现在没有iTunes,但是选择带有系统事件的复选框的语法应该是
单击复选框“多个”
这为我做到了:

tell application "iTunes" to activate
tell application "System Events"
    tell window "iTunes" of process "iTunes"
        click (first UI element whose help is "Choose which speakers to use.")
        keystroke "Kitchen" & return
        delay 1
        key code 76
    end tell
end tell
自从《11》问世以来,我一直在努力解决这个问题。键代码76是输入键。

这对我来说就是:

tell application "iTunes" to activate
tell application "System Events"
    tell window "iTunes" of process "iTunes"
        click (first UI element whose help is "Choose which speakers to use.")
        keystroke "Kitchen" & return
        delay 1
        key code 76
    end tell
end tell

自从《11》问世以来,我一直在努力解决这个问题。键代码76是回车键。

Airplay设备现在是一个可编写脚本的对象-不需要UI技巧

e、 g

告诉应用程序“iTunes”获取AirPlay设备的名称


告诉应用程序“iTunes”将选定的AirPlay设备“主卧”设置为true

AirPlay设备现在是一个可编写脚本的对象-无需UI技巧

e、 g

告诉应用程序“iTunes”获取AirPlay设备的名称


告诉应用程序“iTunes”将选定的AirPlay设备“主卧”设置为true

这太棒了,谢谢。如何判断该项目是否已被选中,以便此脚本不会关闭扬声器?这太棒了,谢谢。我如何判断该项目是否已被选中,以便此脚本不会关闭扬声器?哦!!!这太好了!如果您想将iTunes从Mac切换到AirPlay扬声器,请添加另一行命令,告知应用程序“iTunes”将选定的AirPlay设备“Computer”设置为false,即设置完毕。这么好!非常感谢。哦这太好了!如果您想将iTunes从Mac切换到AirPlay扬声器,请添加另一行命令,告知应用程序“iTunes”将选定的AirPlay设备“Computer”设置为false,即设置完毕。这么好!非常感谢。