Applescript为iTunes取消对计算机的授权
我有一台被授权通过iTunes播放音乐的电脑(Mac),我想禁用它。但是,我只有ssh访问机器的权限。是否有一个applescript我可以远程运行(如通过终端),我可以使用它来解除对机器的授权Applescript为iTunes取消对计算机的授权,applescript,Applescript,我有一台被授权通过iTunes播放音乐的电脑(Mac),我想禁用它。但是,我只有ssh访问机器的权限。是否有一个applescript我可以远程运行(如通过终端),我可以使用它来解除对机器的授权 我知道我可以取消所有我已授权的机器的授权,但如果可能的话,我更愿意使用此解决方案。我在iTunes字典中没有看到任何要授权/取消授权的属性,但我只是在玩GUI脚本并想出了一个解决方案。因此,目标Mac必须启用GUI脚本才能使下面的脚本正常工作 tell application "System Event
我知道我可以取消所有我已授权的机器的授权,但如果可能的话,我更愿意使用此解决方案。我在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脚本中,然后将herdeoc方法与osascript一起使用
这方面的完整示例如下所示:
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
谢谢;回答得好!我不知道GUI脚本功能。它目前还没有打开,但我可以让别人帮我打开它,然后运行它来进行取消授权(使用不同的密码)。