« [PDF]パスワード暗号化設定してPWと一緒に保存 | トップページ | dizigomビデオダウンローダー(少しなおした) »

タイトル内にあるアーティスト名を取り出して設定する

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

#!/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


tell application "Music"
  try
    set listTrackSelection to selection as list
  on error
    log "曲を選択してください"
  end try
  log listTrackSelection as list
end tell



repeat with itemTrack in listTrackSelection
  tell application "Music"
    
    tell file track itemTrack
      set strTitle to name of itemTrack as text
    end tell
    
    set AppleScript's text item delimiters to " - "
    set listTitle to every text item of strTitle
    set AppleScript's text item delimiters to ""
    
    set strNewTitleName to item 3 of listTitle as text
    set strNewArtistName to item 2 of listTitle as text
    set strNewAlbumArtistName to item 2 of listTitle as text
    set strNewTrackNumber to item 1 of listTitle as integer
    
    set name of itemTrack to strNewTitleName
    set artist of itemTrack to strNewArtistName
    set album artist of itemTrack to strNewAlbumArtistName
    set track number of itemTrack to strNewTrackNumber as text
    
  end tell
end repeat



|

« [PDF]パスワード暗号化設定してPWと一緒に保存 | トップページ | dizigomビデオダウンローダー(少しなおした) »

AppleScript Music」カテゴリの記事