setaliasIconPathtoPOSIX file"/System/Applications/Font Book.app/Contents/Resources/AppIcon.icns" as alias
055
try
056
setstrMesto ("ダンプする文字列を入力してください") as text
057
setrecordResultto (display dialog strMes with title "入力してください" default answer strReadString buttons {"OK", "キャンセル"} default button "OK"with icon aliasIconPath giving up after 20without hidden answer) as record
058
on error
059
log"エラーしました"
060
return
061
end try
062
if"OK" is equal to (button returned of recordResult) then
063
setstrReturnedTextto (text returned of recordResult) as text
setstrCommandTextto ("function doGetCharUni() {let strText = '" & strInput & "'; let strOutput = strText.normalize('NFD');let charArray = Array.from(strOutput); return charArray; } doGetCharUni();") as text
102
# log "\n" & strCommandText & "\n"
103
setstrExecCommandto ("/usr/bin/osascript -l JavaScript -e \"" & strCommandText & "\"") as text
104
# log "\n" & strExecCommand & "\n"
105
try
106
setstrResponseto (do shell script strExecCommand) as string
107
on error
108
log"osascript でエラーしました"
109
return false
110
end try
111
112
113
##############################
114
#####戻す
115
##############################
116
setstrDelimto AppleScript's text item delimiters
117
set AppleScript's text item delimiters to ","
118
setlistResponseto every textitemof strResponse
119
set AppleScript's text item delimiters to strDelim
120
setstrOutPutto ("") as text
121
repeatwithitemArrayin listResponse
122
setstrOutPutto (strOutPut & itemArray) as text
123
end repeat
124
125
setstrDelimto AppleScript's text item delimiters
126
set AppleScript's text item delimiters to " "
127
setlistOutPutto every textitemof strOutPut
128
set AppleScript's text item delimiters to strDelim
129
setstrReturnto listOutPut as text
130
131
132
##############################
133
#####ダイアログ
134
##############################
135
tell current application
136
setstrNametoname as text
137
end tell
138
####スクリプトメニューから実行したら
139
if strName is "osascript"then
140
tellapplication"Finder"
141
activate
142
end tell
143
else
144
tell current application
145
activate
146
end tell
147
end if
148
try
149
setrecordResultto (display dialog"分割しました"with title "戻り値です" default answer strReturn buttons {"クリップボードにコピー", "終了", "再実行"} default button "再実行" cancel button "終了" giving up after 20with icon aliasIconPath without hidden answer) as record
150
on error
151
return "エラーしました"
152
end try
153
if (gave up of recordResult) is truethen
154
return "時間切れです"
155
end if
156
##############################
157
#####自分自身を再実行
158
##############################
159
if button returned of recordResult is "再実行"then
160
tellapplication"Finder"
161
setaliasPathToMeto (path to me) as alias
162
end tell
163
run script aliasPathToMe with parameters "再実行"
164
end if
165
##############################
166
#####値のコピー
167
##############################
168
if button returned of recordResult is "クリップボードにコピー"then
setaliasIconPathtoPOSIX file"/System/Applications/Calculator.app/Contents/Resources/AppIcon.icns" as alias
059
try
060
setrecordResultto (display dialog strMes with title "入力してください" default answer strReadString buttons {"OK", "キャンセル"} default button "OK"with icon aliasIconPath giving up after 20without hidden answer) as record
061
on error
062
log"エラーしました"
063
return
064
end try
065
if"OK" is equal to (button returned of recordResult) then
066
setstrReturnedTextto (text returned of recordResult) as «class utf8»
setstrExecCommandto ("/usr/bin/osascript -l JavaScript -e \"" & strCommandText & "\"") as text
134
try
135
setstrResponseto (do shell script strExecCommand) as string
136
on error
137
log"osascript でエラーしました"
138
return false
139
end try
140
141
142
setstrOutPutTextto (strOutPutText & strSetStr & " = " & strResponse & "\n") as text
143
144
end repeat
145
log strOutPutText
146
setstrOutPutTextto (strOutPutText & "\n\n") as text
147
148
149
150
151
##############################
152
#####ダイアログ
153
##############################
154
tell current application
155
setstrNametoname as text
156
end tell
157
####スクリプトメニューから実行したら
158
if strName is "osascript"then
159
tellapplication"Finder"
160
activate
161
end tell
162
else
163
tell current application
164
activate
165
end tell
166
end if
167
setstrMesto"変換しましたコピーして使ってください"
168
try
169
setrecordResultto (display dialog strMes with title "戻り値です" default answer strOutPutText buttons {"クリップボードにコピー", "終了", "再実行"} default button "再実行" cancel button "終了" giving up after 20with icon aliasIconPath without hidden answer) as record
170
on error
171
return "エラーしました"
172
end try
173
if (gave up of recordResult) is truethen
174
return "時間切れです"
175
end if
176
##############################
177
#####自分自身を再実行
178
##############################
179
if button returned of recordResult is "再実行"then
180
tellapplication"Finder"
181
setaliasPathToMeto (path to me) as alias
182
end tell
183
run script aliasPathToMe with parameters "再実行"
184
end if
185
##############################
186
#####値のコピー
187
##############################
188
if button returned of recordResult is "クリップボードにコピー"then
setaliasDefaultLocationto (ocidDesktopDirPathURL's absoluteURL()) as alias
054
setlistUTIto {"public.text"}
055
setstrMesto ("ファイルを選んでください") as text
056
setstrPromptto ("ファイルを選んでください") as text
057
try
058
setaliasFilePathto (choose file strMes with prompt strPrompt default location (aliasDefaultLocation) of type listUTI with invisibles and showing package contentswithout multiple selections allowed) as alias
059
on error
060
log"エラーしました"
061
return "エラーしました"
062
end try
063
#
064
setstrFilePathto (POSIX pathof aliasFilePath) as text
setaliasIconPathtoPOSIX file"/System/Applications/Calculator.app/Contents/Resources/AppIcon.icns" as alias
061
try
062
setrecordResultto (display dialog strMes with title "入力してください" default answer strReadString buttons {"OK", "キャンセル"} default button "OK"with icon aliasIconPath giving up after 20without hidden answer) as record
063
on error
064
log"エラーしました"
065
return
066
end try
067
if"OK" is equal to (button returned of recordResult) then
068
setstrReturnedTextto (text returned of recordResult) as text
setaliasIconPathto (POSIX file"/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/Sync.icns") as alias
153
try
154
setrecordResultto (display dialog strMes with title "戻り値です" default answer (ocidOutPutstring as text) buttons {"クリップボードにコピー", "終了", "再実行"} default button "再実行" cancel button "終了" giving up after 20with icon aliasIconPath without hidden answer) as record
155
on error
156
return "エラーしました"
157
end try
158
if (gave up of recordResult) is truethen
159
return "時間切れです"
160
end if
161
##############################
162
#####自分自身を再実行
163
##############################
164
if button returned of recordResult is "再実行"then
165
tellapplication"Finder"
166
setaliasPathToMeto (path to me) as alias
167
end tell
168
run script aliasPathToMe with parameters "再実行"
169
end if
170
##############################
171
#####値のコピー
172
##############################
173
if button returned of recordResult is "クリップボードにコピー"then