2010-11-23 34 views
1

我有一台电脑(Mac),被授权通过iTunes播放音乐,我想禁用它。但是,我只有ssh访问机器。有没有可以远程运行的applescript(例如通过终端),我可以用它来取消授权机器?苹果电脑反iTunes授权

我知道我可以不授权我授权的所有机器,但如果可能的话,我宁愿使用此解决方案。

回答

2

我没有看到任何属性在iTunes字典中授权/取消授权,但我只是玩了GUI脚本,并提出了一个解决方案。因此,目标Mac必须启用GUI脚本才能使脚本工作。

tell application "System Events" 
tell process "iTunes" 
    click menu item "Deauthorize This Computer…" of menu 1 of menu bar item "Store" of menu bar 1 
    delay 1 
    set frontmost to true 
    click menu 1 of menu bar item "Store" of menu bar 1 
    set value of text field 1 of window "Deauthorize This Computer" to "password" 
    click button "Deauthorize" of window "Deauthorize This Computer" 
end tell 
end tell 

您可以将AppleScipt保留在目标Mac上,然后使用open命令启动它。或者您可以复制上面的AppleScript并将其粘贴到shell脚本中,并使用osascript使用HEREDOC方法。

这样做的完整的例子看起来是这样的:

osascript<<END 
tell application "System Events" 
tell process "iTunes" 
    click menu item "Deauthorize This Computer…" of menu 1 of menu bar item "Store" of menu bar 1 
    delay 1 
    set frontmost to true 
    click menu 1 of menu bar item "Store" of menu bar 1 
    set value of text field 1 of window "Deauthorize This Computer" to "password" 
    click button "Deauthorize" of window "Deauthorize This Computer" 
end tell 
end tell 
END 

上述方法与苹果远程桌面的发送Unix的效果很好功能为好。

此外,请注意,密码包含在此脚本中,我不建议使用 ,但需要在取消授权窗口中使用密码。如果您将密码放在脚本中,请确保确保该脚本安全无虞,以免没有人看到您的Apple密码。

+0

谢谢;很好的回答!我不知道GUI脚本功能。目前尚未开启,但我可以让某人为我启用它,然后运行此操作以执行取消授权(使用不同的密码)。 – 2010-11-24 04:13:53

相关问题