001 | #!/usr/bin/env osascript |
---|
002 | ----+----1----+----2----+-----3----+----4----+----5----+----6----+----7 |
---|
003 | # |
---|
004 | # サウンドファイルのタイトル等の文字化けFIX用 |
---|
005 | # 少し追加した |
---|
006 | # com.cocolog-nifty.quicktimer.icefloe |
---|
007 | ----+----1----+----2----+-----3----+----4----+----5----+----6----+----7 |
---|
008 | use AppleScript version "2.8" |
---|
009 | use scripting additions |
---|
010 | |
---|
011 | |
---|
012 | property refMe : a reference to current application |
---|
013 | |
---|
014 | ---iTune呼び出し |
---|
015 | tell application "Music" |
---|
016 | try |
---|
017 | ----選択されているファイルの実体先をリストで取得 |
---|
018 | set listTrackSelection to selection as list |
---|
019 | on error |
---|
020 | ---選択していないとエラーになる |
---|
021 | log "曲を選択してください" |
---|
022 | return "曲を選択してください" |
---|
023 | end try |
---|
024 | log listTrackSelection |
---|
025 | end tell |
---|
026 | |
---|
027 | |
---|
028 | |
---|
029 | repeat with objTrack in listTrackSelection |
---|
030 | #ゲット |
---|
031 | tell application "Music" |
---|
032 | tell objTrack |
---|
033 | set strGetValue1 to album as text |
---|
034 | set strGetValue2 to artist as text |
---|
035 | set strGetValue3 to album artist as text |
---|
036 | set strGetValue4 to name as text |
---|
037 | end tell |
---|
038 | end tell |
---|
039 | #置換 |
---|
040 | set strSetValue1 to doReplasceStr(strGetValue1) |
---|
041 | set strSetValue2 to doReplasceStr(strGetValue2) |
---|
042 | set strSetValue3 to doReplasceStr(strGetValue3) |
---|
043 | set strSetValue4 to doReplasceStr(strGetValue4) |
---|
044 | #セット |
---|
045 | tell application "Music" |
---|
046 | tell objTrack |
---|
047 | set album to strSetValue1 |
---|
048 | set artist to strSetValue2 |
---|
049 | set album artist to strSetValue3 |
---|
050 | set name to strSetValue4 |
---|
051 | end tell |
---|
052 | end tell |
---|
053 | end repeat |
---|
054 | |
---|
055 | |
---|
056 | to doReplasceStr(argGetValue) |
---|
057 | #ここだけargGetValue間違えないように |
---|
058 | set strSetValue to doReplace(argGetValue, "ヒ", "a") |
---|
059 | set strSetValue to doReplace(strSetValue, "チ", "Á") |
---|
060 | set strSetValue to doReplace(strSetValue, "ォ", "á") |
---|
061 | set strSetValue to doReplace(strSetValue, "ョ", "®") |
---|
062 | set strSetValue to doReplace(strSetValue, "キ", "·") |
---|
063 | |
---|
064 | set strSetValue to doReplace(strSetValue, "馘", "éd") |
---|
065 | set strSetValue to doReplace(strSetValue, "馥", "ée") |
---|
066 | set strSetValue to doReplace(strSetValue, "馼", "éh") |
---|
067 | set strSetValue to doReplace(strSetValue, "駻", "ér") |
---|
068 | set strSetValue to doReplace(strSetValue, "駻", "ér") |
---|
069 | set strSetValue to doReplace(strSetValue, "駭", "én") |
---|
070 | set strSetValue to doReplace(strSetValue, "師", "ét") |
---|
071 | set strSetValue to doReplace(strSetValue, "駸", "és") |
---|
072 | set strSetValue to doReplace(strSetValue, "馭", "éf") |
---|
073 | set strSetValue to doReplace(strSetValue, "駘", "él") |
---|
074 | #20250309追加 |
---|
075 | set strSetValue to doReplace(strSetValue, "饌", "éa") |
---|
076 | set strSetValue to doReplace(strSetValue, "鮟", "é ") |
---|
077 | set strSetValue to doReplace(strSetValue, "馮", "ég") |
---|
078 | set strSetValue to doReplace(strSetValue, "屍", "ér") |
---|
079 | set strSetValue to doReplace(strSetValue, "士", "ém") |
---|
080 | set strSetValue to doReplace(strSetValue, "始", "én") |
---|
081 | set strSetValue to doReplace(strSetValue, "駑", "ém") |
---|
082 | set strSetValue to doReplace(strSetValue, "駱", "ép") |
---|
083 | set strSetValue to doReplace(strSetValue, "騁", "ét") |
---|
084 | |
---|
085 | set strSetValue to doReplace(strSetValue, "不", "ïs") |
---|
086 | |
---|
087 | |
---|
088 | set strSetValue to doReplace(strSetValue, "輟", "ço") |
---|
089 | set strSetValue to doReplace(strSetValue, "殲", "ür") |
---|
090 | |
---|
091 | |
---|
092 | set strSetValue to doReplace(strSetValue, "鈩", "èn") |
---|
093 | set strSetValue to doReplace(strSetValue, "鑽", "èr") |
---|
094 | set strSetValue to doReplace(strSetValue, "鑪", "èm") |
---|
095 | set strSetValue to doReplace(strSetValue, "鑚", "ès") |
---|
096 | set strSetValue to doReplace(strSetValue, "鑒", "èg") |
---|
097 | set strSetValue to doReplace(strSetValue, "峻", "ès") |
---|
098 | |
---|
099 | set strSetValue to doReplace(strSetValue, "黐", "êv") |
---|
100 | set strSetValue to doReplace(strSetValue, "嘖", "êh") |
---|
101 | |
---|
102 | set strSetValue to doReplace(strSetValue, "歡", "üc") |
---|
103 | set strSetValue to doReplace(strSetValue, "穫", "än") |
---|
104 | set strSetValue to doReplace(strSetValue, "殄", "üh") |
---|
105 | set strSetValue to doReplace(strSetValue, "嬰", "♯ ") |
---|
106 | |
---|
107 | |
---|
108 | set strSetValue to doReplace(strSetValue, "疝", "ál") |
---|
109 | set strSetValue to doReplace(strSetValue, "疚", "ák") |
---|
110 | |
---|
111 | set strSetValue to doReplace(strSetValue, "臟", "äf") |
---|
112 | |
---|
113 | |
---|
114 | set strSetValue to doReplace(strSetValue, "敏", "ïq") |
---|
115 | |
---|
116 | set strSetValue to doReplace(strSetValue, "獲", "äl") |
---|
117 | set strSetValue to doReplace(strSetValue, "嗷", "ör") |
---|
118 | set strSetValue to doReplace(strSetValue, "殳", "üt") |
---|
119 | set strSetValue to doReplace(strSetValue, "喞", "öc") |
---|
120 | set strSetValue to doReplace(strSetValue, "殤", "ün") |
---|
121 | |
---|
122 | set strSetValue to doReplace(strSetValue, "歸", "üd") |
---|
123 | set strSetValue to doReplace(strSetValue, "洫", "üß") |
---|
124 | set strSetValue to doReplace(strSetValue, "侒", "úo") |
---|
125 | |
---|
126 | set strSetValue to doReplace(strSetValue, "隔", "äu") |
---|
127 | set strSetValue to doReplace(strSetValue, "舅", "än") |
---|
128 | set strSetValue to doReplace(strSetValue, "臙", "äb") |
---|
129 | set strSetValue to doReplace(strSetValue, "廓", "äf") |
---|
130 | |
---|
131 | set strSetValue to doReplace(strSetValue, "羡", "ît") |
---|
132 | set strSetValue to doReplace(strSetValue, "杯", "ît") |
---|
133 | |
---|
134 | set strSetValue to doReplace(strSetValue, "僘", "ía") |
---|
135 | |
---|
136 | set strSetValue to doReplace(strSetValue, "", "óm") |
---|
137 | set strSetValue to doReplace(strSetValue, "", "óc") |
---|
138 | set strSetValue to doReplace(strSetValue, "", "óh") |
---|
139 | |
---|
140 | |
---|
141 | return strSetValue |
---|
142 | |
---|
143 | end doReplasceStr |
---|
144 | |
---|
145 | |
---|
146 | |
---|
147 | to doReplace(argOrignalText, argSearchText, argReplaceText) |
---|
148 | set strDelim to AppleScript's text item delimiters |
---|
149 | set AppleScript's text item delimiters to argSearchText |
---|
150 | set listDelim to every text item of argOrignalText |
---|
151 | set AppleScript's text item delimiters to argReplaceText |
---|
152 | set strReturn to listDelim as text |
---|
153 | set AppleScript's text item delimiters to strDelim |
---|
154 | return strReturn |
---|
155 | end doReplace |
---|
156 | |
---|
157 | |
---|
158 | |
---|