« [資料]The Compact Font Format Specification Technical Note #5176 | トップページ | [Stickies]新しいステッキーズを生成する »

[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





|

« [資料]The Compact Font Format Specification Technical Note #5176 | トップページ | [Stickies]新しいステッキーズを生成する »

AppleScript Music」カテゴリの記事