[NSURL] NSURLContentTypeKey UTI等を取り出せます
戻り値がUTCoreTypeのreferenceになるので
値が『あれば』色々取り出せます。
#!/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 scripting additions
######ログ表示
doLogView()
property objMe : a reference to current application
property objNSString : a reference to objMe's NSString
property objNSURL : a reference to objMe's NSURL
property objNSArray : a reference to objMe's NSArray
property objNSMutableString : a reference to objMe's NSMutableString
property objNSNotFound : a reference to 9.22337203685477E+18 + 5807
set aliasFilePath to (choose file) as alias
log aliasFilePath as alias
set strFilePath to POSIX path of aliasFilePath as text
log strFilePath as text
set ocidFileNsUrl to objNSURL's fileURLWithPath:strFilePath
log ocidFileNsUrl as text
log ocidFileNsUrl's className() as text
set {boolResult, ocidContentType} to ocidFileNsUrl's getResourceValue:(reference) forKey:(objMe's NSURLContentTypeKey) |error|:(missing value)
log ocidContentType's identifier as text
log ocidContentType's preferredFilenameExtension as text
log ocidContentType's tags as text
log ocidContentType's isDeclared as boolean
log ocidContentType's isDynamic as boolean
log ocidContentType's isPublic
log ocidContentType's referenceURL
log ocidContentType's |version|
log ocidContentType's |description|
if ocidContentType is not (missing value) then
log ocidContentType's className() as text
end if
#########################ログ表示
to doLogView()
tell application "System Events"
set listAppList to title of (every process where background only is false)
end tell
repeat with objAppList in listAppList
set strAppList to objAppList as text
if strAppList is "スクリプトエディタ" then
tell application "Script Editor"
if frontmost is true then
try
tell application "System Events" to click menu item "ログを表示" of menu "表示" of menu bar item "表示" of menu bar 1 of application process "Script Editor"
end try
end if
end tell
end if
end repeat
end doLogView
#########################
| 固定リンク
「NSURLResourceKey」カテゴリの記事
- resourceValuesForKeys NSURLの判定(2024.12.09)
- 特定のディレクトリにあるファイルサイズ最大と最小(2024.09.13)
- 特定のディレクトリにある修正日が一番古いパスと一番新しいパス(2024.09.13)
- [getResourceValue]各種情報の取得(2024.09.07)
- [contentsOfDirectoryAtURL]コンテンツURLの収集 第一階層のみ(2024.09.02)
「UTType」カテゴリの記事
- シンボリックリンクのUTIの取得(2024.12.02)
- [UTType]処理対象のUTI(ファイルタイプ)か?チェックする 複数UTIでチェックする(2024.10.03)
- [UTType]処理対象のUTI(ファイルタイプ)か?チェックする(2024.09.30)
- UTI(uniform type identifier)の取得 ツリー構造付き 少し修正(2024.06.19)
- UTI(uniform type identifier)の取得 ツリー構造付き(2024.05.23)