« デフォルトのブラウザを変更する(set defaultbrowser) | トップページ | [Sample16]AppleScript in bash »

UTType 基本


【スクリプトエディタで開く】|

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
(*
error number -128
com.cocolog-nifty.quicktimer.icefloe
*)
#
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
##自分環境がos12なので2.8にしているだけです
use AppleScript version "2.8"
use framework "Foundation"
use framework "AppKit"
use scripting additions

property refMe : a reference to current application

###拡張子から
set ocidUTType to refMe's UTType's typeWithFilenameExtension:"html"
log className() of ocidUTType as text
-->(*_UTCoreType*)

###UTIから
set ocidUTType to refMe's UTType's typeWithIdentifier:"public.html"
log className() of ocidUTType as text
-->(*_UTCoreType*)

###MIMEから
set ocidUTType to refMe's UTType's typeWithMIMEType:"text/html"
log className() of ocidUTType as text
-->(*_UTCoreType*)

log ocidUTType's identifier() as text
-->(*public.html*)

log ocidUTType's preferredFilenameExtension() as text
-->(*html*)

log ocidUTType's preferredMIMEType() as text
-->(*text/html*)


|

« デフォルトのブラウザを変更する(set defaultbrowser) | トップページ | [Sample16]AppleScript in bash »

UTType」カテゴリの記事