[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 {} as list
tell application "Music"
set listSetPlayListName to name of every playlist as list
end tell
###ダイアログ
try
set listResponse to (choose from list listSetPlayListName with title "選んでね" with prompt "プレイリストに追加します" default items (item 1 of listSetPlayListName) OK button name "OK" cancel button name "キャンセル" without multiple selections allowed and empty selection allowed) as list
on error
log "エラーしました"
return "エラーしました"
end try
if (item 1 of listResponse) is false then
return "キャンセルしました"
end if
set strPlayListName to (item 1 of listResponse) as text
###追加する
tell application "Music"
set objCurrentTrack to current track
duplicate objCurrentTrack to playlist strPlayListName
end tell
| 固定リンク
「Media Music」カテゴリの記事
- [Music]メタデータの文字化け置換(EU系の文字化けの置換) 少し増えた(2024.03.18)
- [shortcut]再生中の音楽をShazamでしらべてタイトルアーティストを設定する(2023.12.11)
- [Music]メタデータの文字化け置換(1つ毎処理)(2023.12.09)
- [afinfo]ミュージックファイルの詳細メタ情報の取得(2023.11.01)
- [com.apple.metadata]オーディオファイルのコメントにビットレートを入れる(2023.11.01)