【发布时间】:2014-09-09 20:21:34
【问题描述】:
我目前有一个 Applescript,可让您输入歌曲并播放。
这里是:
set userInput to text returned of (display dialog "Type something" default answer "")
if userInput contains "Play " then
set {TID, text item delimiters} to {text item delimiters, {"Play "}}
if length of userInput is greater than or equal to 2 then set resultString to text item 2 of userInput
set text item delimiters to TID
set playSong to (resultString as string)
tell application "iTunes"
set mySongs to every track of library playlist 1 whose name is playSong
repeat with aSong in mySongs
play aSong
end repeat
if (count of mySongs) = 0 then
say "Song not found"
end if
end tell
end if
基本上,我需要获取主 iTunes 库的路径并从中播放歌曲。目前,要搜索歌曲,iTunes 必须打开。如果它找不到歌曲,它就会保持打开状态。我想搜索实际的 iTunes 目录来制作它,所以如果 iTunes 找不到歌曲,它就不会打开
我不知道该怎么做。
谢谢
【问题讨论】:
标签: macos applescript itunes