« [Music]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
##自分環境がos12なので2.8にしているだけです
use AppleScript version "2.8"
use framework "Foundation"
use scripting additions

######ログ表示
doLogView()

property refMe : a reference to current application

---iTune呼び出し
tell application "Music"
try
----選択されているファイルの実体先をリストで取得
set listTrackSelection to selection as list
on error
---選択していないとエラーになる
log "曲を選択してください"
end try
log listTrackSelection
end tell



repeat with objTrack in listTrackSelection
tell application "Music"
log objTrack
set strArtist to artist of objTrack as text
log strArtist
set strAlbumArtist to album artist of objTrack as text
log strAlbumArtist
####変更
set album artist of objTrack to strArtist
###確認
log album artist of objTrack as text
log artist of objTrack as text
end tell
end repeat






display notification "処理終了" with title "処理が終了" subtitle "処理が終了しました" sound name "Sonumi"
log ">>>>>>>>>>>>処理終了<<<<<<<<<<<<<<<"
return ">>>>>>>>>>>>処理終了<<<<<<<<<<<<<<<"


#########################ログ表示
to doLogView()

tell application "System Events"
set listAppList to title of (every process where background only is false)
end tell
repeat with objAppList in listAppList
set strAppList to objAppList as text
if strAppList is "スクリプトエディタ" then
tell application "Script Editor"
if frontmost is true then
try
tell application "System Events" to click menu item "ログを表示" of menu "表示" of menu bar item "表示" of menu bar 1 of application process "Script Editor"
end try
end if
end tell
tell application "Script Editor"
tell application "System Events"
tell process "Script Editor"
tell window 1
tell splitter group 1
tell splitter group 1
tell group 1
tell checkbox "返された値"
set boolValue to value as boolean
end tell
if boolValue is false then
click checkbox "返された値"
end if
end tell
end tell
end tell
end tell
end tell
end tell
end tell
end if
end repeat

end doLogView
#########################

|

« [Music]Musicアプリの設定を初期化する | トップページ | [Music]選択中の音楽ファイルを書き出す »

AppleScript Music」カテゴリの記事