[Preview]画像が入っているフォルダを、ファイル名順にソートして開くv4
ダウンロード - open_folderpreview.zip
ソース | |
---|---|
001 | #!/usr/bin/env osascript |
002 | ----+----1----+----2----+-----3----+----4----+----5----+----6----+----7 |
003 | (* |
004 | プレビューアプリのドロップレット用 |
005 | 画像の入ったフォルダをドロップすると |
006 | ファイル名順にソートしてから |
007 | プレビューアプリで開きます |
008 | v1 初回公開 |
009 | v2 ファイル数が1000を超える場合は1000まで開くように変更 |
010 | v3 XPCとクイックルックの終了を追加 |
011 | v3 UI呼び出しを SystemUIServer に変更した |
012 | v3.1 Windowサイズをリサイズ(縦系)にする処理を加えた |
013 | |
014 | v4.b 考え方を変えて 単体ファイルも開くように作り替えた |
015 | v4.b1 PDFは別窓になるので除外する設定をテスト |
016 | v4.b2 UTIの取得にmissing value対策入れた |
017 | v4.b3 ソートをabsoluteStringからpathに変更 |
018 | |
019 | ドロップレット用です |
020 | ファイル>書き出す…から『アプリケーション』で保存してください |
021 | *) |
022 | # com.cocolog-nifty.quicktimer.icefloe |
023 | ----+----1----+----2----+-----3----+----4----+----5----+----6----+----7 |
024 | use AppleScript version "2.8" |
025 | use framework "Foundation" |
026 | use framework "AppKit" |
027 | use framework "UniformTypeIdentifiers" |
028 | use scripting additions |
029 | |
030 | property refMe : a reference to current application |
031 | property strBundleID : "com.apple.Preview" |
032 | |
033 | ############################## |
034 | #設定項目 PDFを除外するか? |
035 | property booldExPDF : true as boolean |
036 | |
037 | |
038 | |
039 | ############################## |
040 | ###Wクリックで起動した場合 |
041 | on run |
042 | set strName to (name of current application) as text |
043 | if strName is "osascript" then |
044 | tell application "SystemUIServer" to activate |
045 | else |
046 | tell current application to activate |
047 | end if |
048 | set aliasDefaultLocation to (path to desktop from user domain) as alias |
049 | set strPromptText to "画像が入ったフォルダをえらんでください" |
050 | set strMesText to "画像が入ったフォルダをえらんでください" |
051 | try |
052 | tell application "SystemUIServer" |
053 | activate |
054 | set listFolderPath to (choose folder strMesText with prompt strPromptText default location aliasDefaultLocation with multiple selections allowed, invisibles and showing package contents) as list |
055 | end tell |
056 | on error |
057 | tell application "SystemUIServer" to quit |
058 | log "エラーしました" |
059 | return "エラーしました" |
060 | end try |
061 | tell application "SystemUIServer" to quit |
062 | ############## |
063 | #次工程に渡すArray |
064 | set ocidSendNextArray to refMe's NSMutableArray's alloc()'s init() |
065 | #ダイアログで選んだ『フォルダ』を順番に |
066 | repeat with itemFolderPath in listFolderPath |
067 | set aliasFolderPath to itemFolderPath as alias |
068 | set strFolderPath to (POSIX path of aliasFolderPath) as text |
069 | set ocidFolderPathStr to (refMe's NSString's stringWithString:(strFolderPath)) |
070 | set ocidFolderPath to ocidFolderPathStr's stringByStandardizingPath() |
071 | set ocidFolderPathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidFolderPath)) |
072 | #次工程に回すArrayに入れていく |
073 | (ocidSendNextArray's addObject:(ocidFolderPathURL)) |
074 | end repeat |
075 | #ここから送られるのはフォルダのファイルパスURLのArray |
076 | doFileOpen(ocidSendNextArray) |
077 | return |
078 | end run |
079 | |
080 | |
081 | #################################### |
082 | #ドロップで起動した場合 |
083 | on open listDropFilePath |
084 | set listDropFilePath to (every item of listDropFilePath) as list |
085 | ############## |
086 | #次工程に渡すArray |
087 | set ocidSendNextArray to refMe's NSMutableArray's alloc()'s init() |
088 | #ドロップされたファイルパスを全てファイルURLにしてから次に渡す |
089 | repeat with itemFilePath in listDropFilePath |
090 | set aliasItemFilePath to itemFilePath as alias |
091 | set strItemFilePath to (POSIX path of aliasItemFilePath) as text |
092 | set ocidItemFilePathStr to (refMe's NSString's stringWithString:(strItemFilePath)) |
093 | set ocidItemFilePath to ocidItemFilePathStr's stringByStandardizingPath() |
094 | set ocidItemFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidItemFilePath)) |
095 | (ocidSendNextArray's addObject:(ocidItemFilePathURL)) |
096 | end repeat |
097 | #次工程に回す |
098 | #ここから送られるのはプレビューで開くことができるURLのArray |
099 | doFileOpen(ocidSendNextArray) |
100 | return |
101 | end open |
102 | |
103 | |
104 | |
105 | ############################ |
106 | (* #本処理 |
107 | argFilePathURLArrayには |
108 | ダイアログで選んだフォルダ |
109 | か |
110 | ドロップされたpreviewで開くことができるファイルURLのArrayが |
111 | 渡される |
112 | *) |
113 | on doFileOpen(argFilePathURLArray) |
114 | #プレビューが開くことができるファイルUTIのリストを取得する |
115 | set refResponse to doGetUTI() as list |
116 | if refResponse is false then |
117 | display alert "アプリケーションが開く事ができるUTIの一覧の取得に失敗しました" giving up after 2 |
118 | return "エラー:UTIの取得失敗しました" |
119 | else |
120 | set listUTI to refResponse as list |
121 | end if |
122 | |
123 | ####プレビューを一度終了させてから処理開始 |
124 | tell application id strBundleID to activate |
125 | repeat 5 times |
126 | try |
127 | tell application id strBundleID to close every window |
128 | delay 0.1 |
129 | on error |
130 | tell application id strBundleID to close every document saving no |
131 | delay 0.1 |
132 | tell application id strBundleID to quit |
133 | end try |
134 | end repeat |
135 | delay 0.1 |
136 | tell application id strBundleID to quit |
137 | ####プレビューの半ゾンビ化対策 |
138 | set ocidRunningApplication to refMe's NSRunningApplication |
139 | set ocidAppArray to ocidRunningApplication's runningApplicationsWithBundleIdentifier:(strBundleID) |
140 | repeat with itemAppArray in ocidAppArray |
141 | delay 0.2 |
142 | itemAppArray's terminate() |
143 | end repeat |
144 | set strAppName to ("プレビュー") as text |
145 | #クイックルック終了 |
146 | set appRunApp to (refMe's NSRunningApplication) |
147 | set ocidRunAppArray to appRunApp's runningApplicationsWithBundleIdentifier:("com.apple.quicklook.QuickLookUIService") |
148 | set ocidRunAppAllArray to ocidRunAppArray's allObjects() |
149 | repeat with itemRunApp in ocidRunAppAllArray |
150 | set strLocalizedName to itemRunApp's localizedName() as text |
151 | if strLocalizedName contains strAppName then |
152 | itemRunApp's terminate() |
153 | delay 0.1 |
154 | itemRunApp's forceTerminate() |
155 | end if |
156 | end repeat |
157 | #XPC終了 |
158 | set appRunApp to (refMe's NSRunningApplication) |
159 | set ocidRunAppArray to appRunApp's runningApplicationsWithBundleIdentifier:("com.apple.appkit.xpc.openAndSavePanelService") |
160 | set ocidRunAppAllArray to ocidRunAppArray's allObjects() |
161 | repeat with itemRunApp in ocidRunAppAllArray |
162 | set strLocalizedName to itemRunApp's localizedName() as text |
163 | if strLocalizedName contains strAppName then |
164 | itemRunApp's terminate() |
165 | delay 0.1 |
166 | itemRunApp's forceTerminate() |
167 | end if |
168 | end repeat |
169 | #################################### |
170 | #ファイルマネージャ初期化 |
171 | set appFileManager to refMe's NSFileManager's defaultManager() |
172 | ################################ |
173 | ##テンポラリーをゴミ箱に |
174 | ################################ |
175 | (* |
176 | #前処理で強制終了になっっている可能性があるので |
177 | #テンポラリーのクリーニングを行いたいが |
178 | #これを実施するとどうもよく無いので 処理しないことにした |
179 | set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSLibraryDirectory) inDomains:(refMe's NSUserDomainMask)) |
180 | set ocidLibraryDirPathURL to ocidURLsArray's firstObject() |
181 | set ocidTmpDirPathURL to ocidLibraryDirPathURL's URLByAppendingPathComponent:("Containers/com.apple.Preview/Data/tmp") |
182 | set listResult to (appFileManager's trashItemAtURL:(ocidTmpDirPathURL) resultingItemURL:(ocidTmpDirPathURL) |error|:(reference)) |
183 | ## |
184 | set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0 |
185 | # 777-->511 755-->493 700-->448 766-->502 |
186 | ocidAttrDict's setValue:(511) forKey:(refMe's NSFilePosixPermissions) |
187 | set listBoolMakeDir to appFileManager's createDirectoryAtURL:(ocidTmpDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error|:(reference) |
188 | *) |
189 | ################################ |
190 | #パスリストにする |
191 | (* |
192 | ここに来た時点で |
193 | プレビューで開けるUTIを持つファイル |
194 | か |
195 | フォルダのファイルURLになっている |
196 | *) |
197 | ################################ |
198 | ###enumeratorAtURL用のBoolean用 |
199 | set ocidFalse to (refMe's NSNumber's numberWithBool:false) |
200 | set ocidTrue to (refMe's NSNumber's numberWithBool:true) |
201 | ###ファイルURLのみを格納するリスト |
202 | set ocidFilePathURLAllArray to (refMe's NSMutableArray's alloc()'s init()) |
203 | ###まずは全部のURLをArrayに入れる |
204 | repeat with itemFilePathURL in argFilePathURLArray |
205 | #フォルダか?確認して |
206 | set listResourceValue to (itemFilePathURL's getResourceValue:(reference) forKey:(refMe's NSURLIsDirectoryKey) |error|:(reference)) |
207 | set boolIsDir to (item 2 of listResourceValue) |
208 | #フォルダではないなら |
209 | if boolIsDir is ocidFalse then |
210 | #そのまま次工程へ回す |
211 | (ocidFilePathURLAllArray's addObject:(itemFilePathURL)) |
212 | #フォルダなら |
213 | else if boolIsDir is ocidTrue then |
214 | ################################## |
215 | ##プロパティ |
216 | set ocidPropertieKey to {refMe's NSURLPathKey, refMe's NSURLIsRegularFileKey, refMe's NSURLContentTypeKey} |
217 | ##オプション(隠しファイルは含まない) |
218 | set ocidOption to (refMe's NSDirectoryEnumerationSkipsHiddenFiles) |
219 | ####ディレクトリのコンテツを収集(最下層まで) |
220 | set ocidEmuDict to (appFileManager's enumeratorAtURL:(itemFilePathURL) includingPropertiesForKeys:(ocidPropertieKey) options:(ocidOption) errorHandler:(reference)) |
221 | ###戻り値をリストに格納 |
222 | # set ocidEmuFileURLArray to ocidEmuDict's allObjects() |
223 | # log ocidEmuFileURLArray's |count|() |
224 | # (ocidFilePathURLAllArray's addObjectsFromArray:ocidEmuFileURLArray) |
225 | repeat |
226 | ###戻り値をリストに格納 |
227 | set ocidEnuURL to ocidEmuDict's nextObject() |
228 | if ocidEnuURL = (missing value) then |
229 | exit repeat |
230 | else |
231 | #この時点でフォルダのパスは不要なので |
232 | set listResourceValue to (ocidEnuURL's getResourceValue:(reference) forKey:(refMe's NSURLIsDirectoryKey) |error|:(reference)) |
233 | set boolIsDir to (item 2 of listResourceValue) |
234 | #URLがフォルダなら |
235 | if boolIsDir is ocidTrue then |
236 | #何もしない |
237 | #フォルダでは無いなら |
238 | else if boolIsDir is ocidFalse then |
239 | #そのまま次工程へ回す |
240 | (ocidFilePathURLAllArray's addObject:(ocidEnuURL)) |
241 | end if |
242 | end if |
243 | end repeat |
244 | end if |
245 | end repeat |
246 | |
247 | |
248 | ################################ |
249 | #ソート |
250 | (* 前工程でフォルダのURLからコンテンツの収集を行なって |
251 | ここで渡されるのは全てファイル単体のURLのArrayが渡される |
252 | OPEN直前にもソートするが |
253 | ここでのソートは、1000ファイル超えた場合の最初の1000を取得するために必要 |
254 | *) |
255 | set ocidSortDescriptorArray to refMe's NSMutableArray's alloc()'s init() |
256 | #ここを absoluteString --> path に変更 |
257 | set ocidSortDescriptor to (refMe's NSSortDescriptor's sortDescriptorWithKey:("path") ascending:(true) selector:"localizedStandardCompare:") |
258 | ocidSortDescriptorArray's addObject:(ocidSortDescriptor) |
259 | ocidFilePathURLAllArray's sortUsingDescriptors:(ocidSortDescriptorArray) |
260 | ################################################ |
261 | #この時点で全てがファイルURLのArray |
262 | #ファイル数が1000を超える場合は1000までで処理する |
263 | #ソート後のリストの数を数えて |
264 | set numCntArray to ocidFilePathURLAllArray's |count|() |
265 | if numCntArray > 1000 then |
266 | set strName to (name of current application) as text |
267 | if strName is "osascript" then |
268 | tell application "System Events" to activate |
269 | else |
270 | tell current application to activate |
271 | end if |
272 | tell application "System Events" |
273 | activate |
274 | display alert "ファイル数が1000以上なので最初から1000までで処理します" giving up after 2 |
275 | #1000以上URLがある場合は1000コ目までのURLを次に回す |
276 | set ocidRange to refMe's NSRange's NSMakeRange(0, 1000) |
277 | set ocidFilePathURLAllArray to ocidFilePathURLAllArray's subarrayWithRange:(ocidRange) |
278 | end tell |
279 | end if |
280 | |
281 | ################################ |
282 | ####必要なファイルだけのArrayにする |
283 | ################################ |
284 | #次工程に回すArray |
285 | set ocidFilePathURLArray to refMe's NSMutableArray's alloc()'s init() |
286 | ####URLの数だけ繰り返し |
287 | repeat with itemFilePathURL in ocidFilePathURLAllArray |
288 | ###################不要なファイルをゴミ箱に入れちゃう |
289 | #拡張子を取得して |
290 | set ocidExtension to itemFilePathURL's pathExtension() |
291 | ###URLファイル削除 |
292 | if (ocidExtension as text) is "url" then |
293 | set listResult to (appFileManager's trashItemAtURL:(itemFilePathURL) resultingItemURL:(missing value) |error|:(reference)) |
294 | ###WindowのサムネイルDB削除 |
295 | else if (ocidExtension as text) is "db" then |
296 | set listResult to (appFileManager's trashItemAtURL:(itemFilePathURL) resultingItemURL:(missing value) |error|:(reference)) |
297 | ###webloc削除 |
298 | else if (ocidExtension as text) is "webloc" then |
299 | set listResult to (appFileManager's trashItemAtURL:(itemFilePathURL) resultingItemURL:(missing value) |error|:(reference)) |
300 | ###非表示ファイルは収集していないが |
301 | else if (ocidExtension as text) is ".DS_Store" then |
302 | set listResult to (appFileManager's trashItemAtURL:(itemFilePathURL) resultingItemURL:(missing value) |error|:(reference)) |
303 | else |
304 | ####URLをforKeyで取り出し |
305 | set listResult to (itemFilePathURL's getResourceValue:(reference) forKey:(refMe's NSURLIsRegularFileKey) |error|:(reference)) |
306 | ###リストからNSURLIsRegularFileKeyのBOOLを取り出し |
307 | set boolIsRegularFileKey to item 2 of listResult |
308 | ####ファイルのみを(ディレクトリやリンボリックリンクは含まない) |
309 | if boolIsRegularFileKey is ocidTrue then |
310 | if booldExPDF is true then |
311 | #PDFを除外する 次工程に渡さない |
312 | if (ocidExtension as text) is "pdf" then |
313 | #PDFは次工程に渡さない |
314 | else |
315 | ####リストに追加する |
316 | (ocidFilePathURLArray's addObject:(itemFilePathURL)) |
317 | end if |
318 | else if booldExPDF is false then |
319 | ####リストに追加する |
320 | (ocidFilePathURLArray's addObject:(itemFilePathURL)) |
321 | end if |
322 | end if |
323 | end if |
324 | end repeat |
325 | ## log ocidFilePathURLArray as list |
326 | |
327 | ################################ |
328 | ####ファイルタイプのチェックをする |
329 | ################################ |
330 | set ocidSendNextArray to refMe's NSMutableArray's alloc()'s init() |
331 | repeat with itemFilePathURL in ocidFilePathURLArray |
332 | ####UTIの取得 |
333 | set listResourceValue to (itemFilePathURL's getResourceValue:(reference) forKey:(refMe's NSURLContentTypeKey) |error|:(reference)) |
334 | set ocidContentType to (item 2 of listResourceValue) |
335 | set strUTI to ocidContentType's identifier() as text |
336 | #含まれている=プレビューで開くことができるなら |
337 | if listUTI contains strUTI then |
338 | #次工程に回す |
339 | (ocidSendNextArray's addObject:(itemFilePathURL)) |
340 | end if |
341 | end repeat |
342 | |
343 | |
344 | ##################################### |
345 | # 並び替え並び替え localizedStandardCompare |
346 | # 不要なファイルを削除したので再度ソートする |
347 | ##################################### |
348 | (* |
349 | compare: |
350 | caseInsensitiveCompare: |
351 | localizedCompare: |
352 | localizedStandardCompare: |
353 | localizedCaseInsensitiveCompare: |
354 | *) |
355 | set ocidSortDescriptorArray to refMe's NSMutableArray's alloc()'s init() |
356 | #ここを absoluteString --> path に変更 |
357 | set ocidSortDescriptor to (refMe's NSSortDescriptor's sortDescriptorWithKey:("path") ascending:(true) selector:"localizedStandardCompare:") |
358 | # ocidSortDescriptorArray's addObject:(ocidSortDescriptor) |
359 | # set ocidSortDescriptor to (refMe's NSSortDescriptor's sortDescriptorWithKey:"absoluteString" ascending:(true) selector:"compare:") |
360 | ocidSortDescriptorArray's addObject:(ocidSortDescriptor) |
361 | ocidSendNextArray's sortUsingDescriptors:(ocidSortDescriptorArray) |
362 | |
363 | ############################## |
364 | ####エリアスリストにして |
365 | ############################## |
366 | ###ファイルマネジャー初期化 |
367 | ###空のリスト=プレヴューに渡すため |
368 | set listAliasPath to {} as list |
369 | ###並び変わったファイルパスを順番に |
370 | repeat with itemFilePathURL in ocidSendNextArray |
371 | ###エイリアスにして |
372 | set aliasFilePath to (itemFilePathURL's absoluteURL()) as alias |
373 | ####リストに格納していく |
374 | set end of listAliasPath to aliasFilePath |
375 | end repeat |
376 | if listAliasPath is {} then |
377 | return "Openできる書類はありませんでした" |
378 | end if |
379 | |
380 | |
381 | ############################## |
382 | ####起動 |
383 | ############################## |
384 | try |
385 | tell application id "com.apple.Preview" to launch |
386 | on error |
387 | tell application id "com.apple.Preview" to activate |
388 | end try |
389 | ############################## |
390 | ####プレビューで開く |
391 | ############################## |
392 | tell application id "com.apple.Preview" |
393 | activate |
394 | set numWindow to count of window |
395 | if numWindow = 0 then |
396 | try |
397 | open listAliasPath |
398 | on error |
399 | log "ここでエラー" |
400 | end try |
401 | else |
402 | ####新しいウィンドで開く方法がわからん |
403 | ####新しいインスタンス生成すれば良いのかな |
404 | open listAliasPath |
405 | end if |
406 | end tell |
407 | |
408 | |
409 | |
410 | ############################## |
411 | ####読みやすい感じのwindowサイズにする |
412 | ############################## |
413 | #モニタサイズを取得して |
414 | set ocidScreenArray to refMe's NSScreen's screens() |
415 | set ocidItemScreen to ocidScreenArray's firstObject() |
416 | set ocidItemScreenRect to ocidItemScreen's frame() |
417 | set numItemScreenW to (item 1 of (item 2 of ocidItemScreenRect)) as integer |
418 | set numItemScreenH to (item 2 of (item 2 of ocidItemScreenRect)) as integer |
419 | #ここの指数部分を変更することでWindowの縦横比が変更できる |
420 | set numSetWidh to (numItemScreenW * 0.75) as integer |
421 | #いい感じのサイズに変更する |
422 | tell application id "com.apple.Preview" |
423 | tell front window |
424 | properties |
425 | set bounds to {0, 25, numSetWidh, numItemScreenH} |
426 | end tell |
427 | end tell |
428 | tell application "System Events" to quit |
429 | end doFileOpen |
430 | |
431 | |
432 | |
433 | ################################## |
434 | #UTIの取得 |
435 | #対象のアプリケーションが開くことができる |
436 | #UTIのリストを取得作成します |
437 | ################################## |
438 | to doGetUTI() |
439 | #アプリケーションのURLを取得 |
440 | #NSバンドルをバンドルIDから取得 |
441 | set ocidAppBundle to refMe's NSBundle's bundleWithIdentifier:(strBundleID) |
442 | #バンドルが取れない=launchDBの不具合? |
443 | if ocidAppBundle = (missing value) then |
444 | #NSバンドル取得できなかった場合 |
445 | set appNSWorkspace to refMe's NSWorkspace's sharedWorkspace() |
446 | #NSWorkspaceを使って取得する |
447 | set ocidAppPathURL to appNSWorkspace's URLForApplicationWithBundleIdentifier:(strBundleID) |
448 | else |
449 | #無駄だけどいちおうFinderにも効いてみる |
450 | tell application "Finder" |
451 | try |
452 | set aliasAppApth to (application file id strBundleID) as alias |
453 | on error |
454 | log "アプリケーションが見つかりませんでした" |
455 | return false |
456 | end try |
457 | #えてしてFinderが最強だったりするなこの処理 |
458 | set strAppFilePath to (POSIX path of aliasAppApth) as text |
459 | set ocidAppFilePathStr to refMe's NSString's stringWithString:(strAppFilePath) |
460 | set ocidAppFilePath to ocidAppFilePathStr's stringByStandardizingPath() |
461 | set ocidAppPathURL to refMe's NSURL's alloc()'s initFileURLWithPath:(ocidAppFilePath) isDirectory:(false) |
462 | end tell |
463 | set ocidAppPathURL to ocidAppBundle's bundleURL() |
464 | end if |
465 | if ocidAppPathURL = (missing value) then |
466 | log "アプリケーションが見つかりませんでした" |
467 | return false |
468 | end if |
469 | #NSBundleを定義して |
470 | set ocidAppBundle to refMe's NSBundle's bundleWithURL:(ocidAppPathURL) |
471 | set ocidInfoDict to ocidAppBundle's infoDictionary() |
472 | set ocidDocTypeArray to ocidInfoDict's objectForKey:("CFBundleDocumentTypes") |
473 | if ocidDocTypeArray = (missing value) then |
474 | log "CFBundleDocumentTypesが見つかりませんでした" |
475 | return false |
476 | else |
477 | #出力戻し値にするリストの初期化 |
478 | set listUTl to {} as list |
479 | #対応ドキュメントタイプをリストにしていく |
480 | repeat with itemDocTypeArray in ocidDocTypeArray |
481 | set listContentTypes to (itemDocTypeArray's objectForKey:"LSItemContentTypes") |
482 | if listContentTypes = (missing value) then |
483 | #拡張子の指定のみの場合 |
484 | set ocidExtension to (itemDocTypeArray's objectForKey:"CFBundleTypeExtensions") |
485 | set strClassName to ocidExtension's className() as text |
486 | #子要素の数だけ栗菓子 |
487 | repeat with itemExtension in ocidExtension |
488 | set strExtension to itemExtension as text |
489 | #拡張子からUTI生成して |
490 | set ocidContentTypes to (refMe's UTType's typeWithFilenameExtension:(strExtension)) |
491 | #バンドルIDを取得 |
492 | set strContentTypes to ocidContentTypes's identifier() as text |
493 | #戻し用のリストに追加していく |
494 | set end of listUTl to (strContentTypes) |
495 | end repeat |
496 | else |
497 | #収集できたUTIを順番に |
498 | repeat with itemContentTypes in listContentTypes |
499 | set strContentTypes to itemContentTypes as text |
500 | #戻し用のリストに追加していく |
501 | set end of listUTl to (strContentTypes) |
502 | end repeat |
503 | end if |
504 | end repeat |
505 | end if |
506 | #値を戻す |
507 | return listUTl |
508 | end doGetUTI |
AppleScriptで生成しました |