« [Music]曲の評価 | トップページ | [Music]現在再生中の曲をプレイリストに追加する »

[Music]プレイリストを作る

【スクリプトエディタで開く】|

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use scripting additions
##############################
#####スクリプトメニューから実行させない
##############################
tell current application
  set strName to name as text
end tell
####スクリプトメニューから実行したら
if strName is "osascript" then
  tell application "Finder"
    set aliasPathToMe to path to me as alias
    tell application "Script Editor"
open aliasPathToMe
    end tell
return "中止しました"
  end tell
else
  tell current application
    activate
  end tell
end if
############################
### プレイリストを作る
############################

set listSetPlayListName to {"01NightTime", "02FunkTime", "03DayTime", "04LoveSongs"} as list

repeat with itemSetPlayListName in listSetPlayListName
  set strSetPlayListName to itemSetPlayListName as text
  ######
  tell application "Music"
    tell current playlist
## properties
    end tell
    ###プレイリストの名前を取得
    set listPlayListName to name of every playlist as list
    ###判定用初期値
    set boolContain to false as boolean
    ###プレイリストの数だけ繰り返し
    repeat with itemPlayListName in listPlayListName
set strPlayListName to itemPlayListName as text
###判定用のあたいがあればTRUEを入れる
if strPlayListName is strSetPlayListName then
set boolContain to true as boolean
end if
    end repeat
    ###FALSE=対象の名前のプレイリストは無いので作る
    if boolContain is false then
make new playlist with properties {name:strSetPlayListName, smart:false, disliked:false, genius:false, loved:true, visible:true, special kind:Music}
    end if
  end tell
end repeat

return




|

« [Music]曲の評価 | トップページ | [Music]現在再生中の曲をプレイリストに追加する »

Media Music」カテゴリの記事