Applescript 根据标签分隔列表从iTunes播放列表中删除歌曲

Applescript 根据标签分隔列表从iTunes播放列表中删除歌曲,applescript,itunes,Applescript,Itunes,如果歌曲包含标签分隔文件中包含的姓名+艺术家+年份之一,如何使用Applescript从myPlaylist中删除歌曲 因此,如果myPlaylist的曲目之一是: “绿袖蝎子1965” 选项卡分隔的文本文件包含以下行: 绿袖蝎子1965 它将从播放列表中删除曲目。而且,它必须是准确的标题,因为我的一些歌曲标题中有括号和奇怪的字符 谢谢 use application "iTunes" use scripting additions -------------------------------

如果歌曲包含标签分隔文件中包含的姓名+艺术家+年份之一,如何使用Applescript从myPlaylist中删除歌曲

因此,如果myPlaylist的曲目之一是:

“绿袖蝎子1965”

选项卡分隔的文本文件包含以下行:

绿袖蝎子1965

它将从播放列表中删除曲目。而且,它必须是准确的标题,因为我的一些歌曲标题中有括号和奇怪的字符

谢谢

use application "iTunes"
use scripting additions
--------------------------------------------------------------------------------
###USER-DEFINED PROPERTIES: path, playlist
property path : "~/Desktop/trackdelete.list"
property playlist : "myPlaylist"
--------------------------------------------------------------------------------
property text item delimiters : tab
--------------------------------------------------------------------------------
###IMPLEMENTATION
#
#
tell the deleteList
    if not (its file exists) then return -1

    read

    repeat with i from 1 to the length of its list
        set [its name, its artist, its year] to ¬
            [text item 1, text item 2, text item 3] of ¬
            item i of its list

        delete (playlistItem's track where ¬
            name = deleteList's name and ¬
            artist = deleteList's artist and ¬
            year = deleteList's year)
    end repeat
end tell
--------------------------------------------------------------------------------
###SCRIPT OBJECTS & HANDLERS
#
#
script playlistItem
    property playlist : a reference to the playlist named (my playlist)
    property track : a reference to every track of my playlist
end script

script deleteList
    property application : application "System Events"
    property file : a reference to file (my path) of my application
    property list : null
    property name : null
    property artist : null
    property year : null

    to read
        tell AppleScript to read (my file as alias)
        set my list to the result's paragraphs
    end read
end script
---------------------------------------------------------------------------❮END❯

系统信息:AppleScript版本:“2.7”,系统版本:“10.13.6”

你对我在回答中提交的脚本做得怎么样?我知道我没有添加任何宣传,但当然,除了剧本应该按照你的要求去做之外,没有什么可以说的。如果有任何问题,让我知道,我可以解决它们。我将等待您的反馈。好的,我想这必须粘贴到终端?我这样做了,将属性更改为属性路径:“Macintosh\HD/Applications/Automator\stuff/01b\iTunes\Scripts/SL+.txt”属性播放列表:“Test1”但是我得到了一条我认为是错误的消息:-bash:tell:command not found-bash:syntax error靠近意外标记'its'不,你为什么认为它必须粘贴到终端?你要求一个AppleScript-所以我给了你一个AppleScript。将它粘贴到脚本编辑器中。并且不要在
路径
属性中转义空格。好的,对不起,它是s因为我以前从未见过“使用应用程序”命令。我现在将重试!因此我现在收到以下消息:“存在文件”Macintosh HD/Applications/Automator stuff/01b iTunes Scripts/SL+.txt“-->false”但它是一个纯文本文档,根据finder,它位于该位置。请参阅:“Where:/Applications/Automator stuff/01b iTunes Scripts”好的,只是在没有“Macintosh HD”的情况下尝试了一下,效果不错。谢谢感谢您的帮助和您的快速回复我之前。