AppleScript Music

[Music]メタデータの文字化け置換(EU系の文字化けの置換) 少し増えた


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

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


property refMe : a reference to current application

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





repeat with objTrack in listTrackSelection
  tell application "Music"
    tell objTrack
      set strGetValue to album as text
    end tell
  end tell
  set strSetValue to doReplace(strGetValue, "駘", "él")
  set strSetValue to doReplace(strSetValue, "馼", "éh")
  set strSetValue to doReplace(strSetValue, "駻", "ér")
  set strSetValue to doReplace(strSetValue, "不", "ïs")
  set strSetValue to doReplace(strSetValue, "駻", "ér")
  set strSetValue to doReplace(strSetValue, "駭", "én")
  set strSetValue to doReplace(strSetValue, "馘", "éd")
  set strSetValue to doReplace(strSetValue, "馥", "ée")
  set strSetValue to doReplace(strSetValue, "鑽", "èr")
  set strSetValue to doReplace(strSetValue, "輟", "ço")
  set strSetValue to doReplace(strSetValue, "殲", "ür")
  set strSetValue to doReplace(strSetValue, "鈩", "èn")
  set strSetValue to doReplace(strSetValue, "師", "ét")
  set strSetValue to doReplace(strSetValue, "ヒ", "a")
  set strSetValue to doReplace(strSetValue, "駸", "és")
  set strSetValue to doReplace(strSetValue, "馭", "éf")
  set strSetValue to doReplace(strSetValue, "歡", "üc")
  set strSetValue to doReplace(strSetValue, "穫", "än")
  set strSetValue to doReplace(strSetValue, "殄", "üh")
  set strSetValue to doReplace(strSetValue, "嬰", "♯ ")
  set strSetValue to doReplace(strSetValue, "馮", "ég")
  set strSetValue to doReplace(strSetValue, "鑪", "èm")
  set strSetValue to doReplace(strSetValue, "疝", "ál")
  set strSetValue to doReplace(strSetValue, "臟", "äf")
  set strSetValue to doReplace(strSetValue, "鮟", "é ")
  set strSetValue to doReplace(strSetValue, "ォ", "á ")
  set strSetValue to doReplace(strSetValue, "鑚", "ès")
  set strSetValue to doReplace(strSetValue, "屍", "ér")
  set strSetValue to doReplace(strSetValue, "士", "ém")
  set strSetValue to doReplace(strSetValue, "始", "én")
  set strSetValue to doReplace(strSetValue, "駑", "ém")
  set strSetValue to doReplace(strSetValue, "敏", "ïq")
  set strSetValue to doReplace(strSetValue, "鑒", "èg")
  set strSetValue to doReplace(strSetValue, "駱", "ép")
  set strSetValue to doReplace(strSetValue, "騁", "ét")
  set strSetValue to doReplace(strSetValue, "騅", "êv")
  set strSetValue to doReplace(strSetValue, "獲", "äl")
  set strSetValue to doReplace(strSetValue, "嗷", "ör")
  set strSetValue to doReplace(strSetValue, "殳", "üt")
  set strSetValue to doReplace(strSetValue, "喞", "öc")
  set strSetValue to doReplace(strSetValue, "殤", "ün")
  set strSetValue to doReplace(strSetValue, "嘖", "êh")
  set strSetValue to doReplace(strSetValue, "歸", "üd")
  set strSetValue to doReplace(strSetValue, "廓", "äf")
  set strSetValue to doReplace(strSetValue, "洫", "üß")
  set strSetValue to doReplace(strSetValue, "隔", "äu")
  set strSetValue to doReplace(strSetValue, "舅", "än")
  set strSetValue to doReplace(strSetValue, "峻", "ès")
  set strSetValue to doReplace(strSetValue, "羡", "ît")
  set strSetValue to doReplace(strSetValue, "黐", "êv")
  set strSetValue to doReplace(strSetValue, "僘", "ía")
  set strSetValue to doReplace(strSetValue, "チ", "Á")
  set strSetValue to doReplace(strSetValue, "", "óm")
  set strSetValue to doReplace(strSetValue, "", "óc")
  set strSetValue to doReplace(strSetValue, "侒", "úo")
  set strSetValue to doReplace(strSetValue, "臙", "äb")
  set strSetValue to doReplace(strSetValue, "杯", "ît")
  set strSetValue to doReplace(strSetValue, "疚", "ák")
  tell application "Music"
    tell objTrack
      set album to strSetValue
    end tell
  end tell
end repeat

delay 1

repeat with objTrack in listTrackSelection
  tell application "Music"
    tell objTrack
      set strGetValue to artist as text
    end tell
  end tell
  set strSetValue to doReplace(strGetValue, "駘", "él")
  set strSetValue to doReplace(strSetValue, "馼", "éh")
  set strSetValue to doReplace(strSetValue, "駻", "ér")
  set strSetValue to doReplace(strSetValue, "不", "ïs")
  set strSetValue to doReplace(strSetValue, "駻", "ér")
  set strSetValue to doReplace(strSetValue, "駭", "én")
  set strSetValue to doReplace(strSetValue, "馘", "éd")
  set strSetValue to doReplace(strSetValue, "馥", "ée")
  set strSetValue to doReplace(strSetValue, "鑽", "èr")
  set strSetValue to doReplace(strSetValue, "輟", "ço")
  set strSetValue to doReplace(strSetValue, "殲", "ür")
  set strSetValue to doReplace(strSetValue, "鈩", "èn")
  set strSetValue to doReplace(strSetValue, "師", "ét")
  set strSetValue to doReplace(strSetValue, "ヒ", "a")
  set strSetValue to doReplace(strSetValue, "駸", "és")
  set strSetValue to doReplace(strSetValue, "馭", "éf")
  set strSetValue to doReplace(strSetValue, "歡", "üc")
  set strSetValue to doReplace(strSetValue, "穫", "än")
  set strSetValue to doReplace(strSetValue, "殄", "üh")
  set strSetValue to doReplace(strSetValue, "嬰", "♯ ")
  set strSetValue to doReplace(strSetValue, "馮", "ég")
  set strSetValue to doReplace(strSetValue, "鑪", "èm")
  set strSetValue to doReplace(strSetValue, "疝", "ál")
  set strSetValue to doReplace(strSetValue, "臟", "äf")
  set strSetValue to doReplace(strSetValue, "鮟", "é ")
  set strSetValue to doReplace(strSetValue, "ォ", "á ")
  set strSetValue to doReplace(strSetValue, "鑚", "ès")
  set strSetValue to doReplace(strSetValue, "屍", "ér")
  set strSetValue to doReplace(strSetValue, "士", "ém")
  set strSetValue to doReplace(strSetValue, "始", "én")
  set strSetValue to doReplace(strSetValue, "駑", "ém")
  set strSetValue to doReplace(strSetValue, "敏", "ïq")
  set strSetValue to doReplace(strSetValue, "鑒", "èg")
  set strSetValue to doReplace(strSetValue, "駱", "ép")
  set strSetValue to doReplace(strSetValue, "騁", "ét")
  set strSetValue to doReplace(strSetValue, "騅", "êv")
  set strSetValue to doReplace(strSetValue, "獲", "äl")
  set strSetValue to doReplace(strSetValue, "嗷", "ör")
  set strSetValue to doReplace(strSetValue, "殳", "üt")
  set strSetValue to doReplace(strSetValue, "喞", "öc")
  set strSetValue to doReplace(strSetValue, "殤", "ün")
  set strSetValue to doReplace(strSetValue, "嘖", "êh")
  set strSetValue to doReplace(strSetValue, "歸", "üd")
  set strSetValue to doReplace(strSetValue, "廓", "äf")
  set strSetValue to doReplace(strSetValue, "洫", "üß")
  set strSetValue to doReplace(strSetValue, "隔", "äu")
  set strSetValue to doReplace(strSetValue, "舅", "än")
  set strSetValue to doReplace(strSetValue, "峻", "ès")
  set strSetValue to doReplace(strSetValue, "羡", "ît")
  set strSetValue to doReplace(strSetValue, "黐", "êv")
  set strSetValue to doReplace(strSetValue, "僘", "ía")
  set strSetValue to doReplace(strSetValue, "チ", "Á")
  set strSetValue to doReplace(strSetValue, "", "óm")
  set strSetValue to doReplace(strSetValue, "", "óc")
  set strSetValue to doReplace(strSetValue, "侒", "úo")
  set strSetValue to doReplace(strSetValue, "臙", "äb")
  set strSetValue to doReplace(strSetValue, "杯", "ît")
  set strSetValue to doReplace(strSetValue, "疚", "ák")
  tell application "Music"
    tell objTrack
      set artist to strSetValue
    end tell
  end tell
end repeat

delay 1

repeat with objTrack in listTrackSelection
  tell application "Music"
    tell objTrack
      set strGetValue to album artist as text
    end tell
  end tell
  set strSetValue to doReplace(strGetValue, "駘", "él")
  set strSetValue to doReplace(strSetValue, "馼", "éh")
  set strSetValue to doReplace(strSetValue, "駻", "ér")
  set strSetValue to doReplace(strSetValue, "不", "ïs")
  set strSetValue to doReplace(strSetValue, "駻", "ér")
  set strSetValue to doReplace(strSetValue, "駭", "én")
  set strSetValue to doReplace(strSetValue, "馘", "éd")
  set strSetValue to doReplace(strSetValue, "馥", "ée")
  set strSetValue to doReplace(strSetValue, "鑽", "èr")
  set strSetValue to doReplace(strSetValue, "輟", "ço")
  set strSetValue to doReplace(strSetValue, "殲", "ür")
  set strSetValue to doReplace(strSetValue, "鈩", "èn")
  set strSetValue to doReplace(strSetValue, "師", "ét")
  set strSetValue to doReplace(strSetValue, "ヒ", "a")
  set strSetValue to doReplace(strSetValue, "駸", "és")
  set strSetValue to doReplace(strSetValue, "馭", "éf")
  set strSetValue to doReplace(strSetValue, "歡", "üc")
  set strSetValue to doReplace(strSetValue, "穫", "än")
  set strSetValue to doReplace(strSetValue, "殄", "üh")
  set strSetValue to doReplace(strSetValue, "嬰", "♯ ")
  set strSetValue to doReplace(strSetValue, "馮", "ég")
  set strSetValue to doReplace(strSetValue, "鑪", "èm")
  set strSetValue to doReplace(strSetValue, "疝", "ál")
  set strSetValue to doReplace(strSetValue, "臟", "äf")
  set strSetValue to doReplace(strSetValue, "鮟", "é ")
  set strSetValue to doReplace(strSetValue, "ォ", "á ")
  set strSetValue to doReplace(strSetValue, "鑚", "ès")
  set strSetValue to doReplace(strSetValue, "屍", "ér")
  set strSetValue to doReplace(strSetValue, "士", "ém")
  set strSetValue to doReplace(strSetValue, "始", "én")
  set strSetValue to doReplace(strSetValue, "駑", "ém")
  set strSetValue to doReplace(strSetValue, "敏", "ïq")
  set strSetValue to doReplace(strSetValue, "鑒", "èg")
  set strSetValue to doReplace(strSetValue, "駱", "ép")
  set strSetValue to doReplace(strSetValue, "騁", "ét")
  set strSetValue to doReplace(strSetValue, "騅", "êv")
  set strSetValue to doReplace(strSetValue, "獲", "äl")
  set strSetValue to doReplace(strSetValue, "嗷", "ör")
  set strSetValue to doReplace(strSetValue, "殳", "üt")
  set strSetValue to doReplace(strSetValue, "喞", "öc")
  set strSetValue to doReplace(strSetValue, "殤", "ün")
  set strSetValue to doReplace(strSetValue, "嘖", "êh")
  set strSetValue to doReplace(strSetValue, "歸", "üd")
  set strSetValue to doReplace(strSetValue, "廓", "äf")
  set strSetValue to doReplace(strSetValue, "洫", "üß")
  set strSetValue to doReplace(strSetValue, "隔", "äu")
  set strSetValue to doReplace(strSetValue, "舅", "än")
  set strSetValue to doReplace(strSetValue, "峻", "ès")
  set strSetValue to doReplace(strSetValue, "羡", "ît")
  set strSetValue to doReplace(strSetValue, "黐", "êv")
  set strSetValue to doReplace(strSetValue, "僘", "ía")
  set strSetValue to doReplace(strSetValue, "チ", "Á")
  set strSetValue to doReplace(strSetValue, "", "óm")
  set strSetValue to doReplace(strSetValue, "", "óc")
  set strSetValue to doReplace(strSetValue, "侒", "úo")
  set strSetValue to doReplace(strSetValue, "臙", "äb")
  set strSetValue to doReplace(strSetValue, "杯", "ît")
  set strSetValue to doReplace(strSetValue, "疚", "ák")
  tell application "Music"
    tell objTrack
      set album artist to strSetValue
    end tell
  end tell
end repeat

delay 1



repeat with objTrack in listTrackSelection
  tell application "Music"
    tell objTrack
      set strGetValue to name as text
    end tell
  end tell
  set strSetValue to doReplace(strGetValue, "駘", "él")
  set strSetValue to doReplace(strSetValue, "馼", "éh")
  set strSetValue to doReplace(strSetValue, "駻", "ér")
  set strSetValue to doReplace(strSetValue, "不", "ïs")
  set strSetValue to doReplace(strSetValue, "駻", "ér")
  set strSetValue to doReplace(strSetValue, "駭", "én")
  set strSetValue to doReplace(strSetValue, "馘", "éd")
  set strSetValue to doReplace(strSetValue, "馥", "ée")
  set strSetValue to doReplace(strSetValue, "鑽", "èr")
  set strSetValue to doReplace(strSetValue, "輟", "ço")
  set strSetValue to doReplace(strSetValue, "殲", "ür")
  set strSetValue to doReplace(strSetValue, "鈩", "èn")
  set strSetValue to doReplace(strSetValue, "師", "ét")
  set strSetValue to doReplace(strSetValue, "ヒ", "a")
  set strSetValue to doReplace(strSetValue, "駸", "és")
  set strSetValue to doReplace(strSetValue, "馭", "éf")
  set strSetValue to doReplace(strSetValue, "歡", "üc")
  set strSetValue to doReplace(strSetValue, "穫", "än")
  set strSetValue to doReplace(strSetValue, "殄", "üh")
  set strSetValue to doReplace(strSetValue, "嬰", "♯ ")
  set strSetValue to doReplace(strSetValue, "馮", "ég")
  set strSetValue to doReplace(strSetValue, "鑪", "èm")
  set strSetValue to doReplace(strSetValue, "疝", "ál")
  set strSetValue to doReplace(strSetValue, "臟", "äf")
  set strSetValue to doReplace(strSetValue, "鮟", "é ")
  set strSetValue to doReplace(strSetValue, "ォ", "á ")
  set strSetValue to doReplace(strSetValue, "鑚", "ès")
  set strSetValue to doReplace(strSetValue, "屍", "ér")
  set strSetValue to doReplace(strSetValue, "士", "ém")
  set strSetValue to doReplace(strSetValue, "始", "én")
  set strSetValue to doReplace(strSetValue, "駑", "ém")
  set strSetValue to doReplace(strSetValue, "敏", "ïq")
  set strSetValue to doReplace(strSetValue, "鑒", "èg")
  set strSetValue to doReplace(strSetValue, "駱", "ép")
  set strSetValue to doReplace(strSetValue, "騁", "ét")
  set strSetValue to doReplace(strSetValue, "騅", "êv")
  set strSetValue to doReplace(strSetValue, "獲", "äl")
  set strSetValue to doReplace(strSetValue, "嗷", "ör")
  set strSetValue to doReplace(strSetValue, "殳", "üt")
  set strSetValue to doReplace(strSetValue, "喞", "öc")
  set strSetValue to doReplace(strSetValue, "殤", "ün")
  set strSetValue to doReplace(strSetValue, "嘖", "êh")
  set strSetValue to doReplace(strSetValue, "歸", "üd")
  set strSetValue to doReplace(strSetValue, "廓", "äf")
  set strSetValue to doReplace(strSetValue, "洫", "üß")
  set strSetValue to doReplace(strSetValue, "隔", "äu")
  set strSetValue to doReplace(strSetValue, "舅", "än")
  set strSetValue to doReplace(strSetValue, "峻", "ès")
  set strSetValue to doReplace(strSetValue, "羡", "ît")
  set strSetValue to doReplace(strSetValue, "黐", "êv")
  set strSetValue to doReplace(strSetValue, "僘", "ía")
  set strSetValue to doReplace(strSetValue, "チ", "Á")
  set strSetValue to doReplace(strSetValue, "", "óm")
  set strSetValue to doReplace(strSetValue, "", "óc")
  set strSetValue to doReplace(strSetValue, "侒", "úo")
  set strSetValue to doReplace(strSetValue, "臙", "äb")
  set strSetValue to doReplace(strSetValue, "杯", "ît")
  set strSetValue to doReplace(strSetValue, "疚", "ák")
  tell application "Music"
    tell objTrack
      set name to strSetValue
    end tell
  end tell
end repeat



to doReplace(argOrignalText, argSearchText, argReplaceText)
  set strDelim to AppleScript's text item delimiters
  set AppleScript's text item delimiters to argSearchText
  set listDelim to every text item of argOrignalText
  set AppleScript's text item delimiters to argReplaceText
  set strReturn to listDelim as text
  set AppleScript's text item delimiters to strDelim
return strReturn
end doReplace





|

[shortcut]再生中の音楽をShazamでしらべてタイトルアーティストを設定する

ダウンロード - Musicメタデータ取得(曲名+アーティスト名).shortcut.zip

Screen_637x6842x

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

on run {argTitle, parameters}
  
  tell application "Music"
    set objNowTrack to current track
    tell objNowTrack
      set name to argTitle as text
      
    end tell
  end tell
end run


on run {argArtist, parameters}
  
  tell application "Music"
    set objNowTrack to current track
    tell objNowTrack
      set artist to argArtist as text
      set album artist to argArtist as text
    end tell
  end tell
end run

|

[Music]メタデータの文字化け置換(1つ毎処理)

自分で使っているやつ
追加してつかっていたらこんな事に
レコードにして…とか考えて入るが…きっとやらない…

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

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


property refMe : a reference to current application

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





repeat with objTrack in listTrackSelection
    tell application "Music"
        tell objTrack
set strGetValue to album as text
        end tell
    end tell
    set strSetValue to doReplace(strGetValue, "駘", "él")
    set strSetValue to doReplace(strSetValue, "不", "ïs")
    set strSetValue to doReplace(strSetValue, "駻", "ér")
    set strSetValue to doReplace(strSetValue, "駭", "én")
    set strSetValue to doReplace(strSetValue, "馘", "éd")
    set strSetValue to doReplace(strSetValue, "馥", "ée")
    set strSetValue to doReplace(strSetValue, "鑽", "èr")
    set strSetValue to doReplace(strSetValue, "輟", "ço")
    set strSetValue to doReplace(strSetValue, "殲", "ür")
    set strSetValue to doReplace(strSetValue, "鈩", "èn")
    set strSetValue to doReplace(strSetValue, "師", "ét")
    set strSetValue to doReplace(strSetValue, "ヒ", "a")
    set strSetValue to doReplace(strSetValue, "駸", "és")
    set strSetValue to doReplace(strSetValue, "馭", "éf")
    set strSetValue to doReplace(strSetValue, "歡", "üc")
    set strSetValue to doReplace(strSetValue, "穫", "än")
    set strSetValue to doReplace(strSetValue, "殄", "üh")
    set strSetValue to doReplace(strSetValue, "嬰", "♯ ")
    set strSetValue to doReplace(strSetValue, "馮", "ég")
    set strSetValue to doReplace(strSetValue, "鑪", "èm")
    set strSetValue to doReplace(strSetValue, "疝", "ál")
    set strSetValue to doReplace(strSetValue, "臟", "äf")
    set strSetValue to doReplace(strSetValue, "鮟", "é ")
    set strSetValue to doReplace(strSetValue, "ォ", "á ")
    set strSetValue to doReplace(strSetValue, "鑚", "ès")
    set strSetValue to doReplace(strSetValue, "屍", "ér")
    set strSetValue to doReplace(strSetValue, "士", "ém")
    set strSetValue to doReplace(strSetValue, "始", "én")
    set strSetValue to doReplace(strSetValue, "駑", "ém")
    set strSetValue to doReplace(strSetValue, "敏", "ïq")
    set strSetValue to doReplace(strSetValue, "鑒", "èg")
    set strSetValue to doReplace(strSetValue, "駱", "ép")
    set strSetValue to doReplace(strSetValue, "騁", "ét")
    set strSetValue to doReplace(strSetValue, "騅", "êv")
    set strSetValue to doReplace(strSetValue, "獲", "äl")
    set strSetValue to doReplace(strSetValue, "嗷", "ör")
    set strSetValue to doReplace(strSetValue, "殳", "üt")
    set strSetValue to doReplace(strSetValue, "喞", "öc")
    set strSetValue to doReplace(strSetValue, "殤", "ün")
    set strSetValue to doReplace(strSetValue, "嘖", "êh")
    set strSetValue to doReplace(strSetValue, "歸", "üd")
    set strSetValue to doReplace(strSetValue, "廓", "äf")
    set strSetValue to doReplace(strSetValue, "洫", "üß")
    set strSetValue to doReplace(strSetValue, "隔", "äu")
    set strSetValue to doReplace(strSetValue, "舅", "än")
    set strSetValue to doReplace(strSetValue, "峻", "ès")
    set strSetValue to doReplace(strSetValue, "羡", "ît")
    set strSetValue to doReplace(strSetValue, "黐", "êv")
    
    tell application "Music"
        tell objTrack
set album to strSetValue
        end tell
    end tell
end repeat

delay 1


repeat with objTrack in listTrackSelection
    tell application "Music"
        tell objTrack
set strGetValue to artist as text
        end tell
    end tell
    set strSetValue to doReplace(strGetValue, "駘", "él")
    set strSetValue to doReplace(strSetValue, "不", "ïs")
    set strSetValue to doReplace(strSetValue, "駻", "ér")
    set strSetValue to doReplace(strSetValue, "駭", "én")
    set strSetValue to doReplace(strSetValue, "馘", "éd")
    set strSetValue to doReplace(strSetValue, "馥", "ée")
    set strSetValue to doReplace(strSetValue, "鑽", "èr")
    set strSetValue to doReplace(strSetValue, "輟", "ço")
    set strSetValue to doReplace(strSetValue, "殲", "ür")
    set strSetValue to doReplace(strSetValue, "鈩", "èn")
    set strSetValue to doReplace(strSetValue, "師", "ét")
    set strSetValue to doReplace(strSetValue, "ヒ", "a")
    set strSetValue to doReplace(strSetValue, "駸", "és")
    set strSetValue to doReplace(strSetValue, "馭", "éf")
    set strSetValue to doReplace(strSetValue, "歡", "üc")
    set strSetValue to doReplace(strSetValue, "穫", "än")
    set strSetValue to doReplace(strSetValue, "殄", "üh")
    set strSetValue to doReplace(strSetValue, "嬰", "♯ ")
    set strSetValue to doReplace(strSetValue, "馮", "ég")
    set strSetValue to doReplace(strSetValue, "鑪", "èm")
    set strSetValue to doReplace(strSetValue, "疝", "ál")
    set strSetValue to doReplace(strSetValue, "臟", "äf")
    set strSetValue to doReplace(strSetValue, "鮟", "é ")
    set strSetValue to doReplace(strSetValue, "ォ", "á ")
    set strSetValue to doReplace(strSetValue, "鑚", "ès")
    set strSetValue to doReplace(strSetValue, "屍", "ér")
    set strSetValue to doReplace(strSetValue, "士", "ém")
    set strSetValue to doReplace(strSetValue, "始", "én")
    set strSetValue to doReplace(strSetValue, "駑", "ém")
    set strSetValue to doReplace(strSetValue, "敏", "ïq")
    set strSetValue to doReplace(strSetValue, "鑒", "èg")
    set strSetValue to doReplace(strSetValue, "駱", "ép")
    set strSetValue to doReplace(strSetValue, "騁", "ét")
    set strSetValue to doReplace(strSetValue, "騅", "êv")
    set strSetValue to doReplace(strSetValue, "獲", "äl")
    set strSetValue to doReplace(strSetValue, "嗷", "ör")
    set strSetValue to doReplace(strSetValue, "殳", "üt")
    set strSetValue to doReplace(strSetValue, "喞", "öc")
    set strSetValue to doReplace(strSetValue, "殤", "ün")
    set strSetValue to doReplace(strSetValue, "嘖", "êh")
    set strSetValue to doReplace(strSetValue, "歸", "üd")
    set strSetValue to doReplace(strSetValue, "廓", "äf")
    set strSetValue to doReplace(strSetValue, "洫", "üß")
    set strSetValue to doReplace(strSetValue, "隔", "äu")
    set strSetValue to doReplace(strSetValue, "舅", "än")
    set strSetValue to doReplace(strSetValue, "峻", "ès")
    set strSetValue to doReplace(strSetValue, "羡", "ît")
    set strSetValue to doReplace(strSetValue, "黐", "êv")
    
    
    
    tell application "Music"
        tell objTrack
set artist to strSetValue
        end tell
    end tell
end repeat

delay 1

repeat with objTrack in listTrackSelection
    tell application "Music"
        tell objTrack
set strGetValue to album artist as text
        end tell
    end tell
    set strSetValue to doReplace(strGetValue, "駘", "él")
    set strSetValue to doReplace(strSetValue, "不", "ïs")
    set strSetValue to doReplace(strSetValue, "駻", "ér")
    set strSetValue to doReplace(strSetValue, "駭", "én")
    set strSetValue to doReplace(strSetValue, "馘", "éd")
    set strSetValue to doReplace(strSetValue, "馥", "ée")
    set strSetValue to doReplace(strSetValue, "鑽", "èr")
    set strSetValue to doReplace(strSetValue, "輟", "ço")
    set strSetValue to doReplace(strSetValue, "殲", "ür")
    set strSetValue to doReplace(strSetValue, "鈩", "èn")
    set strSetValue to doReplace(strSetValue, "師", "ét")
    set strSetValue to doReplace(strSetValue, "ヒ", "a")
    set strSetValue to doReplace(strSetValue, "駸", "és")
    set strSetValue to doReplace(strSetValue, "馭", "éf")
    set strSetValue to doReplace(strSetValue, "歡", "üc")
    set strSetValue to doReplace(strSetValue, "穫", "än")
    set strSetValue to doReplace(strSetValue, "殄", "üh")
    set strSetValue to doReplace(strSetValue, "嬰", "♯ ")
    set strSetValue to doReplace(strSetValue, "馮", "ég")
    set strSetValue to doReplace(strSetValue, "鑪", "èm")
    set strSetValue to doReplace(strSetValue, "疝", "ál")
    set strSetValue to doReplace(strSetValue, "臟", "äf")
    set strSetValue to doReplace(strSetValue, "鮟", "é ")
    set strSetValue to doReplace(strSetValue, "ォ", "á ")
    set strSetValue to doReplace(strSetValue, "鑚", "ès")
    set strSetValue to doReplace(strSetValue, "屍", "ér")
    set strSetValue to doReplace(strSetValue, "士", "ém")
    set strSetValue to doReplace(strSetValue, "始", "én")
    set strSetValue to doReplace(strSetValue, "駑", "ém")
    set strSetValue to doReplace(strSetValue, "敏", "ïq")
    set strSetValue to doReplace(strSetValue, "鑒", "èg")
    set strSetValue to doReplace(strSetValue, "駱", "ép")
    set strSetValue to doReplace(strSetValue, "騁", "ét")
    set strSetValue to doReplace(strSetValue, "騅", "êv")
    set strSetValue to doReplace(strSetValue, "獲", "äl")
    set strSetValue to doReplace(strSetValue, "嗷", "ör")
    set strSetValue to doReplace(strSetValue, "殳", "üt")
    set strSetValue to doReplace(strSetValue, "喞", "öc")
    set strSetValue to doReplace(strSetValue, "殤", "ün")
    set strSetValue to doReplace(strSetValue, "嘖", "êh")
    set strSetValue to doReplace(strSetValue, "歸", "üd")
    set strSetValue to doReplace(strSetValue, "廓", "äf")
    set strSetValue to doReplace(strSetValue, "洫", "üß")
    set strSetValue to doReplace(strSetValue, "隔", "äu")
    set strSetValue to doReplace(strSetValue, "舅", "än")
    set strSetValue to doReplace(strSetValue, "峻", "ès")
    set strSetValue to doReplace(strSetValue, "羡", "ît")
    set strSetValue to doReplace(strSetValue, "黐", "êv")
    
    
    
    tell application "Music"
        tell objTrack
set album artist to strSetValue
        end tell
    end tell
end repeat

delay 1



repeat with objTrack in listTrackSelection
    tell application "Music"
        tell objTrack
set strGetValue to name as text
        end tell
    end tell
    set strSetValue to doReplace(strGetValue, "駘", "él")
    set strSetValue to doReplace(strSetValue, "不", "ïs")
    set strSetValue to doReplace(strSetValue, "駻", "ér")
    set strSetValue to doReplace(strSetValue, "駭", "én")
    set strSetValue to doReplace(strSetValue, "馘", "éd")
    set strSetValue to doReplace(strSetValue, "馥", "ée")
    set strSetValue to doReplace(strSetValue, "鑽", "èr")
    set strSetValue to doReplace(strSetValue, "輟", "ço")
    set strSetValue to doReplace(strSetValue, "殲", "ür")
    set strSetValue to doReplace(strSetValue, "鈩", "èn")
    set strSetValue to doReplace(strSetValue, "師", "ét")
    set strSetValue to doReplace(strSetValue, "ヒ", "a")
    set strSetValue to doReplace(strSetValue, "駸", "és")
    set strSetValue to doReplace(strSetValue, "馭", "éf")
    set strSetValue to doReplace(strSetValue, "歡", "üc")
    set strSetValue to doReplace(strSetValue, "穫", "än")
    set strSetValue to doReplace(strSetValue, "殄", "üh")
    set strSetValue to doReplace(strSetValue, "嬰", "♯ ")
    set strSetValue to doReplace(strSetValue, "馮", "ég")
    set strSetValue to doReplace(strSetValue, "鑪", "èm")
    set strSetValue to doReplace(strSetValue, "疝", "ál")
    set strSetValue to doReplace(strSetValue, "臟", "äf")
    set strSetValue to doReplace(strSetValue, "鮟", "é ")
    set strSetValue to doReplace(strSetValue, "ォ", "á ")
    set strSetValue to doReplace(strSetValue, "鑚", "ès")
    set strSetValue to doReplace(strSetValue, "屍", "ér")
    set strSetValue to doReplace(strSetValue, "士", "ém")
    set strSetValue to doReplace(strSetValue, "始", "én")
    set strSetValue to doReplace(strSetValue, "駑", "ém")
    set strSetValue to doReplace(strSetValue, "敏", "ïq")
    set strSetValue to doReplace(strSetValue, "鑒", "èg")
    set strSetValue to doReplace(strSetValue, "駱", "ép")
    set strSetValue to doReplace(strSetValue, "騁", "ét")
    set strSetValue to doReplace(strSetValue, "騅", "êv")
    set strSetValue to doReplace(strSetValue, "獲", "äl")
    set strSetValue to doReplace(strSetValue, "嗷", "ör")
    set strSetValue to doReplace(strSetValue, "殳", "üt")
    set strSetValue to doReplace(strSetValue, "喞", "öc")
    set strSetValue to doReplace(strSetValue, "殤", "ün")
    set strSetValue to doReplace(strSetValue, "嘖", "êh")
    set strSetValue to doReplace(strSetValue, "歸", "üd")
    set strSetValue to doReplace(strSetValue, "廓", "äf")
    set strSetValue to doReplace(strSetValue, "洫", "üß")
    set strSetValue to doReplace(strSetValue, "隔", "äu")
    set strSetValue to doReplace(strSetValue, "舅", "än")
    set strSetValue to doReplace(strSetValue, "峻", "ès")
    set strSetValue to doReplace(strSetValue, "羡", "ît")
    set strSetValue to doReplace(strSetValue, "黐", "êv")
    
    
    tell application "Music"
        tell objTrack
set name to strSetValue
        end tell
    end tell
end repeat




to doReplace(argOrignalText, argSearchText, argReplaceText)
    set strDelim to AppleScript's text item delimiters
    set AppleScript's text item delimiters to argSearchText
    set listDelim to every text item of argOrignalText
    set AppleScript's text item delimiters to argReplaceText
    set strReturn to listDelim as text
    set AppleScript's text item delimiters to strDelim
return strReturn
end doReplace





|

[afinfo]ミュージックファイルの詳細メタ情報の取得


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

#!/bin/bash
#com.cocolog-nifty.quicktimer.icefloe
#################################################
###パス 音楽ファイル
STR_FILE_PATH="/some/path/some/dir/some/somefile.mp3"
##コンテナディレクトリ
STR_CONTAINER_DIR_PATH=$(/usr/bin/dirname "$STR_FILE_PATH")
##ファイル名
STR_FILE_NAME=$(/usr/bin/basename "$STR_FILE_PATH")
##ベースファイル名
STR_BASE_NAME="${STR_FILE_NAME%.*}"
##保存先ディレクトリ
STR_BASE_FILE_PATH="${STR_CONTAINER_DIR_PATH}/${STR_BASE_NAME}"
##保存先を作成
/bin/mkdir -p "$STR_BASE_FILE_PATH"
STR_SAVE_XML_PATH="${STR_BASE_FILE_PATH}/${STR_BASE_NAME}.xml"
/bin/echo "$STR_FILE_PATH"
#アイコン付きm4aを開くとストールする事が多い
/usr/bin/afinfo -i -x "$STR_FILE_PATH" > "$STR_SAVE_XML_PATH"


exit 0

|

[com.apple.metadata]オーディオファイルのコメントにビットレートを入れる

Ios_app_icon

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

#!/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 framework "AVFoundation"
use scripting additions

property refMe : a reference to current application

###入力
set appFileManager to refMe's NSFileManager's defaultManager()
set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSDesktopDirectory) inDomains:(refMe's NSUserDomainMask))
set ocidDesktopDirPathURL to ocidURLsArray's firstObject()
set aliasDefaultLocation to (ocidDesktopDirPathURL's absoluteURL()) as alias
####UTIリスト オーディオのみ
set listUTI to {"public.audio"}
####ダイアログを出す
set strName to (name of current application) as text
if strName is "osascript" then
  tell application "Finder" to activate
else
  tell current application to activate
end if
set listAliasFilePath to (choose file with prompt "オーディオファイルを選んでください" default location (aliasDefaultLocation) of type listUTI with invisibles, showing package contents and multiple selections allowed) as list

####選んだファイルの数だけ繰り返す
repeat with itemAliasFilePath in listAliasFilePath
  set aliasFilePath to itemAliasFilePath as alias
  set strFilePath to (POSIX path of aliasFilePath) as text
  set ocidFilePath to (refMe's NSString's stringWithString:(strFilePath))
  set ocidFilePathURL to (refMe's NSURL's fileURLWithPath:(ocidFilePath))
  log "######AVAsset"
  set ocidReadAsset to (refMe's AVAsset's assetWithURL:(ocidFilePathURL))
  set ocidReadAssetDuration to ocidReadAsset's duration()
  set numTimeSclae to item 2 of ocidReadAssetDuration
  log numTimeSclae
  log "######AVAssetTrack"
  set ocidReadAssetTrackArray to ocidReadAsset's tracks()
  set numCntTrackNo to (count of ocidReadAssetTrackArray) as integer
  set ocidTrack to (ocidReadAssetTrackArray's objectAtIndex:0)
  set numDataRate to ocidTrack's estimatedDataRate() as number
  set numDataRate to (numDataRate / 1000) as integer
  set strDataRate to numDataRate as text
  ###メタデータ整形 (ダブルクオテーションを2重にエスケープするのがポイントか?)
  set strPlistData to ("<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?><!DOCTYPE plist PUBLIC \\\"-//Apple//DTD PLIST 1.0//EN\\\" \\\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\\\"><plist version=\\\"1.0\\\"><string>DataRate: " & strDataRate & " kbps</string></plist>") as text
  ###コマンド整形
  set strCommandText to ("/usr/bin/xattr -w com.apple.metadata:kMDItemComment \"" & strPlistData & "\" \"" & strFilePath & "\"") as text
  ###コマンド実行
  set strResults to (do shell script strCommandText) as text
  
end repeat


|

[Muisc]Music用パネルアップデート

ウィンドウが開かなくなる不具合を直した Screen-20231014-181010

ダウンロード - musicpanels.zip

|

[musicbrainz]アーティスト名+曲名から、アルバム名を取得する(JSON)

1:アーティストIDを取得
2:曲名とアーティストIDをクエリーに収録アルバムを取得する

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

#!/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 framework "AppKit"
use scripting additions

property refMe : a reference to current application

########################################
### 再生中の曲
tell application "Music"
  set objNowTrack to current track
  tell objNowTrack
    set strSongTitle to name as text
    set strArtistName to artist as text
  end tell
end tell
########################################
###まずはアーティストIDを取得
###URL初期化
set strURL to "http://musicbrainz.org/ws/2/artist/" as text
set ocidURLStr to refMe's NSString's stringWithString:(strURL)
set ocidURL to refMe's NSURL's URLWithString:(ocidURLStr)
####コンポーネント
set ocidComponents to refMe's NSURLComponents's alloc()'s initWithURL:(ocidURL) resolvingAgainstBaseURL:false
set ocidComponentArray to refMe's NSMutableArray's alloc()'s initWithCapacity:0
##JSON指定
set ocidQueryItem to refMe's NSURLQueryItem's alloc()'s initWithName:("fmt") value:("json")
ocidComponentArray's addObject:(ocidQueryItem)
#####アーティスト名から artist idを取得する
set ocidArtistStr to (refMe's NSString's stringWithString:(strArtistName))
set ocidQueryItem to (refMe's NSURLQueryItem's alloc()'s initWithName:("query") value:(ocidArtistStr))
(ocidComponentArray's addObject:(ocidQueryItem))
###検索クエリーとして追加
(ocidComponents's setQueryItems:(ocidComponentArray))
####コンポーネントをURLに展開
set ocidJsonURL to ocidComponents's |URL|()
log ocidJsonURL's absoluteString() as text
##################################################
##### JSON取得
set ocidOption to refMe's NSDataReadingMappedIfSafe
set listReadData to (refMe's NSData's dataWithContentsOfURL:(ocidJsonURL) options:(ocidOption) |error|:(reference))
set ocidJsonData to (item 1 of listReadData)
###JSON初期化 してレコードに格納
set listJSONSerialization to (refMe's NSJSONSerialization's JSONObjectWithData:(ocidJsonData) options:0 |error|:(reference))
set ocidJsonData to item 1 of listJSONSerialization
##rootのレコード
set ocidHolidayDict to (refMe's NSDictionary's alloc()'s initWithDictionary:(ocidJsonData))
##レコードのartistsはArrayなのでfirstObjectが検索結果の最上位
set ocidArtistsDict to (ocidHolidayDict's valueForKey:"artists")'s firstObject()
###アーティストID
set ocidArtistsID to (ocidArtistsDict's valueForKey:"id")
###コメント用にテキストに整形して
set strArtistsID to ocidArtistsID as text

##################################################
#####続いて 曲名と アーティストIDから アルバム名を検索
##URL初期化
set strURL to "http://musicbrainz.org/ws/2/recording" as text
set ocidURLStr to refMe's NSString's stringWithString:(strURL)
set ocidURL to refMe's NSURL's URLWithString:(ocidURLStr)
###コンポーネント初期化
set ocidComponents to refMe's NSURLComponents's alloc()'s initWithURL:(ocidURL) resolvingAgainstBaseURL:false
set ocidComponentArray to refMe's NSMutableArray's alloc()'s initWithCapacity:0
###JSON
set ocidQueryItem to refMe's NSURLQueryItem's alloc()'s initWithName:("fmt") value:("json")
ocidComponentArray's addObject:(ocidQueryItem)
###検索用文字列生成 AND検索
set strQuery to ("\"" & strSongTitle & "\" AND arid:" & strArtistsID & "") as text
set ocidQuery to refMe's NSString's stringWithString:(strQuery)
set ocidQueryItem to refMe's NSURLQueryItem's alloc()'s initWithName:("query") value:(ocidQuery)
ocidComponentArray's addObject:(ocidQueryItem)

###検索クエリーとして追加
(ocidComponents's setQueryItems:(ocidComponentArray))
####コンポーネントをURLに展開
set ocidJsonURL to ocidComponents's |URL|()
log ocidJsonURL's absoluteString() as text

##################################################
##### JSON取得
set ocidOption to refMe's NSDataReadingMappedIfSafe
set listReadData to (refMe's NSData's dataWithContentsOfURL:(ocidJsonURL) options:(ocidOption) |error|:(reference))
set ocidJsonData to (item 1 of listReadData)
###JSON初期化 してレコードに格納
set listJSONSerialization to (refMe's NSJSONSerialization's JSONObjectWithData:(ocidJsonData) options:0 |error|:(reference))
set ocidJsonData to item 1 of listJSONSerialization
##rootのレコード
set ocidHolidayDict to (refMe's NSDictionary's alloc()'s initWithDictionary:(ocidJsonData))
###recordingsのリストの最初の項目
set ocidRecordingsArray to (ocidHolidayDict's valueForKey:"recordings")'s firstObject()
###リリースのリスト(同名曲が複数アルバムに収録されている場合、ベストとか)
set ocidReleaseArray to ocidRecordingsArray's valueForKey:"releases"
###アルバム名選択用のリストを初期化
set listTitle to {} as list
###ダイアログ用に収録アルバム数数える
set numCntList to (count of ocidReleaseArray) as integer
repeat with itemReleaseDict in ocidReleaseArray
  ###アルバムのタイトル取得して
  set ocidTitle to (itemReleaseDict's valueForKey:"title")
  ###リストに -->このリストから選ぶ
  copy (ocidTitle as text) to end of listTitle
end repeat
########################################
###
#####ダイアログを前面に
tell current application
  set strName to name as text
end tell
####スクリプトメニューから実行したら
if strName is "osascript" then
  tell application "Finder" to activate
else
  tell current application to activate
end if
set strPrompt to "収録アルバムが" & numCntList & "点見つかりました\r選んでください"
try
  set listResponse to (choose from list listTitle with title "選んでください" with prompt strPrompt default items (item 1 of listTitle) OK button name "OK" cancel button name "キャンセル" without multiple selections allowed and empty selection allowed)
on error
  log "エラーしました"
return "エラーしました"
end try
if listResponse is false then
return "キャンセルしました"
end if
###アルバム名
set strTitle to (item 1 of listResponse) as text

###ファイルのメタにアーティストIDを入れる
tell application "Music"
  ###アーティストIDをコメントに入れる
  set objNowTrack to current track
  ###アルバム名を設定
  set album of objNowTrack to strTitle
  ###コメントにアーティストID入れておく
  set comment of objNowTrack to strArtistsID
end tell



|

[musicbrainz]アーティスト名から、musicbrainzのアーティストIDを取得する(JSON)

再生中のアーティストのIDを取得して、アーティストページを開きます

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

#!/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 framework "AppKit"
use scripting additions

property refMe : a reference to current application
set ocidPasteboard to refMe's NSPasteboard's generalPasteboard()

#################################################
##### URLの基本構造を生成しておく
set strURL to "http://musicbrainz.org/ws/2/artist/" as text
set ocidURLStr to refMe's NSString's stringWithString:(strURL)
set ocidURL to refMe's NSURL's URLWithString:(ocidURLStr)
set ocidComponents to refMe's NSURLComponents's alloc()'s initWithURL:(ocidURL) resolvingAgainstBaseURL:false
set ocidComponentArray to refMe's NSMutableArray's alloc()'s initWithCapacity:0
set ocidQueryItem to refMe's NSURLQueryItem's alloc()'s initWithName:("fmt") value:("json")
ocidComponentArray's addObject:(ocidQueryItem)
#################################################
##### アーティスト名を取得
tell application "Music"
  set objNowTrack to current track
  tell objNowTrack
    properties
  end tell
  set strArtistName to (artist of objNowTrack) as text
end tell

#################################################
#####アーティスト名から artist idを取得する
set ocidArtistStr to (refMe's NSString's stringWithString:(strArtistName))
set ocidQueryItem to (refMe's NSURLQueryItem's alloc()'s initWithName:("query") value:(ocidArtistStr))
(ocidComponentArray's addObject:(ocidQueryItem))
###検索クエリーとして追加
(ocidComponents's setQueryItems:(ocidComponentArray))
####コンポーネントをURLに展開
set ocidJsonURL to ocidComponents's |URL|()
log ocidJsonURL's absoluteString() as text
##################################################
##### JSON取得
set ocidOption to refMe's NSDataReadingMappedIfSafe
set listReadData to (refMe's NSData's dataWithContentsOfURL:(ocidJsonURL) options:(ocidOption) |error|:(reference))
set ocidJsonData to (item 1 of listReadData)
###JSON初期化 してレコードに格納
set listJSONSerialization to (refMe's NSJSONSerialization's JSONObjectWithData:(ocidJsonData) options:0 |error|:(reference))
set ocidJsonData to item 1 of listJSONSerialization
##rootのレコード
set ocidHolidayDict to (refMe's NSDictionary's alloc()'s initWithDictionary:(ocidJsonData))
##レコードのartistsはArrayなのでfirstObjectが検索結果の最上位
set ocidArtistsDict to (ocidHolidayDict's valueForKey:"artists")'s firstObject()
###アーティストID
set ocidArtistsID to (ocidArtistsDict's valueForKey:"id")
###コメント用にテキストに整形して
set strArtistsID to ocidArtistsID as text
set strArtistURL to ("https://musicbrainz.org/artist/" & strArtistsID & "") as text
##################################################
##### ブラウザで開く
tell application "Google Chrome"
  set numCntWindow to (count of every window) as integer
  if numCntWindow ≠ 0 then
    tell front window
      set objNewTab to make new tab
      tell objNewTab to set URL to strArtistURL
    end tell
  else
make new window
    tell front window
      set objNewTab to make new tab
      tell objNewTab to set URL to strArtistURL
    end tell
  end if
end tell

return strArtistsID

|

[Music]音楽再生用キーボード 修正

Screencapture-20230610-164103

ダウンロード - formusicasscnfig.zip

ダウンロード - music.ascconfig.zip

|

AU plug-inのキャッシュを削除


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

#!/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
property refMe : a reference to current application


###################################
###ダイアログを前面に出す
tell current application
  set strName to name as text
end tell
####スクリプトメニューから実行したら
if strName is "osascript" then
  tell application "Finder"
    activate
  end tell
else
  tell current application
    activate
  end tell
end if
###################################
set strAlertMes to "AU plug-inのキャッシュを削除してリセットします\r\rキャンセルで中止" as text
try
  set recordResponse to (display alert ("【選んでください】\r" & strAlertMes) buttons {"OK", "キャンセル"} default button "OK" cancel button "キャンセル" as informational giving up after 10) as record
on error
  log "エラーしました"
return "キャンセルしました。処理を中止します。インストールが必要な場合は再度実行してください"
end try
if true is equal to (gave up of recordResponse) then
return "時間切れです。処理を中止します。インストールが必要な場合は再度実行してください"
end if
set strBottonName to (button returned of recordResponse) as text
###################################
set appFileManager to refMe's NSFileManager's defaultManager()
set ocidUserLibraryPathArray to (appFileManager's URLsForDirectory:(refMe's NSLibraryDirectory) inDomains:(refMe's NSUserDomainMask))
set ocidUserLibraryPath to ocidUserLibraryPathArray's firstObject()
#######
set ocidDeleteToURL to ocidUserLibraryPath's URLByAppendingPathComponent:("Caches/com.apple.audiounits.cache") isDirectory:true
set boolDone to appFileManager's removeItemAtURL:(ocidDeleteToURL) |error|:(reference)
#######
set ocidDeleteToURL to ocidUserLibraryPath's URLByAppendingPathComponent:("Preferences/com.apple.audio.InfoHelper.plist") isDirectory:false
set boolDone to appFileManager's removeItemAtURL:(ocidDeleteToURL) |error|:(reference)
#######
set ocidDeleteToURL to ocidUserLibraryPath's URLByAppendingPathComponent:("Caches/AudioUnitCache") isDirectory:true
set boolDone to appFileManager's removeItemAtURL:(ocidDeleteToURL) |error|:(reference)
###################################
set ocidTemporaryDirPathURL to appFileManager's temporaryDirectory
#######
set ocidDeleteToURL to ocidTemporaryDirPathURL's URLByAppendingPathComponent:("AudioComponentRegistrar") isDirectory:true
set boolDone to appFileManager's removeItemAtURL:(ocidDeleteToURL) |error|:(reference)
###################################
set ocidTemporaryDirPathURL to appFileManager's temporaryDirectory
set ocidContainerDirURL to ocidTemporaryDirPathURL's URLByDeletingLastPathComponent()
set ocidCachesDirPathURL to ocidContainerDirURL's URLByAppendingPathComponent:("C") isDirectory:true
#######
set ocidDeleteToURL to ocidCachesDirPathURL's URLByAppendingPathComponent:("AudioComponentRegistrar") isDirectory:true
set boolDone to appFileManager's removeItemAtURL:(ocidDeleteToURL) |error|:(reference)
#######これは自分用
set ocidDeleteToURL to ocidCachesDirPathURL's URLByAppendingPathComponent:("com.blackmagic-design.DaVinciResolve") isDirectory:true
set boolDone to appFileManager's removeItemAtURL:(ocidDeleteToURL) |error|:(reference)
###################################
set strCommandText to "/usr/bin/killall -m cfprefsd" as text
do shell script strCommandText


|

より以前の記事一覧

その他のカテゴリー

Acrobat Acrobat Annotation Acrobat Dialog Acrobat Form Acrobat JS Acrobat Open Acrobat Plugin Acrobat python Acrobat Reader Acrobat Sequ Acrobat Stamps Admin Admin Account Admin Apachectl Admin configCode Admin Device Management Admin LaunchServices Admin Locationd Admin loginitem Admin Maintenance Admin Permission Admin Pkg Admin Power Management Admin Printer Admin SetUp Admin SMB Admin System Information Admin Tools Admin Users Admin Volumes Adobe Apple AppleScript AppleScript Guide AppleScript Accessibility AppleScript AppKit AppleScript Applications AppleScript AppStore AppleScript Archive AppleScript Attributes AppleScript Automator AppleScript AVAsset AppleScript AVconvert AppleScript AVFoundation AppleScript AVURLAsset AppleScript BackUp AppleScript Barcode AppleScript Bash AppleScript Basic AppleScript Basic Path AppleScript Bluetooth AppleScript BOX AppleScript Browser AppleScript Calendar AppleScript CD/DVD AppleScript Choose AppleScript Chrome AppleScript CIImage AppleScript CloudStorage AppleScript Color AppleScript com.apple.LaunchServices.OpenWith AppleScript Console AppleScript Contacts AppleScript CotEditor AppleScript CURL AppleScript current application AppleScript Date&Time AppleScript delimiters AppleScript Desktop AppleScript Device AppleScript Disk AppleScript do shell script AppleScript Dock AppleScript DropBox AppleScript eMail AppleScript Encode Decode AppleScript Error AppleScript EXIFData AppleScript ffmpeg AppleScript File AppleScript Finder AppleScript Firefox AppleScript Folder AppleScript Fonts AppleScript GIF AppleScript HTML AppleScript Icon AppleScript Illustrator AppleScript Image Events AppleScript Image2PDF AppleScript ImageOptim Applescript iWork AppleScript Javascript AppleScript Jedit AppleScript Json AppleScript Label AppleScript List AppleScript locationd AppleScript LRC AppleScript LSSharedFileList AppleScript m3u8 AppleScript MakePDF AppleScript Map AppleScript Math AppleScript Microsoft AppleScript Microsoft Edge AppleScript Microsoft Excel AppleScript Mobileconfig AppleScript Mouse AppleScript Movie AppleScript Music AppleScript NetWork AppleScript Notes AppleScript NSArray AppleScript NSBitmapImageRep AppleScript NSBundle AppleScript NSCFBoolean AppleScript NSCharacterSet AppleScript NSColor AppleScript NSColorList AppleScript NSData AppleScript NSDictionary AppleScript NSError AppleScript NSEvent AppleScript NSFileAttributes AppleScript NSFileManager AppleScript NSFont AppleScript NSFontManager AppleScript NSImage AppleScript NSIndex AppleScript NSKeyedArchiver AppleScript NSKeyedUnarchiver AppleScript NSLocale AppleScript NSMutableArray AppleScript NSMutableDictionary AppleScript NSMutableString AppleScript NSNotFound AppleScript NSNumber AppleScript NSOpenPanel AppleScript NSPasteboard AppleScript NSPDFImageRep AppleScript NSpoint AppleScript NSPredicate AppleScript NSRange AppleScript NSRegularExpression AppleScript NSRunningApplication AppleScript NSScreen AppleScript NSSize AppleScript NSString AppleScript NSStringCompareOptions AppleScript NSTask AppleScript NSTimeZone AppleScript NSURL AppleScript NSURL File AppleScript NSURLBookmark AppleScript NSURLComponents AppleScript NSURLResourceKey AppleScript NSUserDefaults AppleScript NSUUID AppleScript NSView AppleScript NSWorkspace AppleScript Numbers AppleScript OAuth AppleScript ObjC AppleScript OneDrive AppleScript Osax AppleScript PDF AppleScript PDFAnnotationWidget AppleScript PDFContext AppleScript PDFDisplayBox AppleScript PDFDocumentPermissions AppleScript PDFKit AppleScript PDFnUP AppleScript PDFOutline AppleScript Photos AppleScript Photoshop AppleScript Plist System Events AppleScript PostScript AppleScript prefPane AppleScript Preview AppleScript Python AppleScript QR AppleScript QR Decode AppleScript QuickLook AppleScript QuickTime AppleScript record AppleScript Regular Expression AppleScript Reminders AppleScript ReName AppleScript Repeat AppleScript RTF AppleScript Safari AppleScript SaveFile AppleScript ScreenCapture AppleScript ScreenSaver AppleScript Script Editor AppleScript Script Menu AppleScript Shortcuts AppleScript Shortcuts Events AppleScript Sort AppleScript Sound AppleScript Spotlight AppleScript SRT AppleScript StandardAdditions AppleScript stringByApplyingTransform AppleScript System Events AppleScript System Settings AppleScript TemporaryItems AppleScript Terminal AppleScript Text AppleScript Text CSV AppleScript Text TSV AppleScript TextEdit AppleScript Translate AppleScript Trash AppleScript Twitter AppleScript UI AppleScript Unit Conversion AppleScript UTType AppleScript valueForKeyPath AppleScript Video AppleScript VisionKit AppleScript Visual Studio Code AppleScript webarchive AppleScript webp AppleScript Wifi AppleScript XML AppleScript XML EPUB AppleScript XML OPML AppleScript XML Plist AppleScript XML RSS AppleScript XML SVG AppleScript XML TTML AppleScript XML webloc AppleScript YouTube AppleScript Zero Suppress Applications Barcode OnLine Tools CityCode Design iPhone List Logs lsappinfo Memo Music perl PlistBuddy pluginkit postalcode ReadMe SF Symbols character id SF Symbols Entity sips Skype Slack sqlite TCC Tools Typography Video Wacom zoom