Media 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]ミュージックファイルの詳細メタ情報の取得

メタデータの文字コードが元のファイル内のコードに依存するため
書き出されたXML内の値がアスキーになる場合があり
実用的とは言い難い(解析時にエラーになる事が多い)
ASCII>UTF-8
SJIS>UTF-8等の変換を考慮した方がいい

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

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


|

より以前の記事一覧

その他のカテゴリー

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