AppleScript与远程计算机上的iTunes

时间:2011-10-26 15:53:19

标签: cocoa applescript itunes

我在XCode中有一个Cocoa-AppleScript项目,我试图在本地网络计算机上向iTunes发送一些命令。出于某种原因,这有效:

tell application "iTunes" of machine "eppc://user:pass@computer.local"
    playpause
end tell

但这不是:

set remoteMachine to "eppc://user:pass@computer.local"
tell application "iTunes" of machine remoteMachine
    playpause
end tell

我收到错误“无法找到远程计算机”。有什么想法吗?

2 个答案:

答案 0 :(得分:1)

好吧我弄清楚了,或者至少有一种方法可以做到这一点。您可以在远程计算机上指定应用程序本身,例如:

set theRemoteApp to application "eppc://user:pass@computer.local/iTunes"
using terms from application "iTunes"
    tell theRemoteApp
        playpause
    end tell
end using terms from

答案 1 :(得分:0)

尝试添加named限定符:

set remoteMachine to "eppc://user:pass@computer.local"
tell application "iTunes" of machine named remoteMachine
    playpause
end tell