« [CotEditor]日付挿入 | トップページ | 【characterSetWithCharactersInString】改行コード判定 »

[bundleWithIdentifier]UTIから各種情報を取得する

UTIからインストール先を調べられるのは良い♪


#!/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


property refMe : a reference to current application


####設定項目

##UTI

set strUTI to "com.apple.Safari" as text


set ocidAppBundle to refMe's NSBundle's bundleWithIdentifier:strUTI

###

set ocidAppBundlePath to ocidAppBundle's bundlePath()

log ocidAppBundlePath as text

(*/System/Volumes/Preboot/Cryptexes/App/System/Applications/Safari.app*)

###

set ocidAppBundlePathURL to ocidAppBundle's bundleURL()

log ocidAppBundlePathURL's absoluteString() as text

(*file:///System/Volumes/Preboot/Cryptexes/App/System/Applications/Safari.app/*)

##

set ocidAppName to (ocidAppBundle's objectForInfoDictionaryKey:"CFBundleName")

log ocidAppName as text

(*Safari*)

set ocidAppDisplayName to (ocidAppBundle's objectForInfoDictionaryKey:"CFBundleDisplayName")

log ocidAppDisplayName as text

(*Safari*)

set ocidAppVerText to ocidAppBundle's infoDictionary()'s objectForKey:"CFBundleShortVersionString"

log ocidAppVerText as text

(*16.3*)

###

set ocidBundleInfo to ocidAppBundle's infoDictionary()

set ocidAllKeys to ocidBundleInfo's allKeys()

log ocidAllKeys as list

(*DTCompiler, NSAppleScriptEnabled, CFBundleInfoDictionaryVersion, DTPlatformVersion, CFBundleIconFile, CFBundleName, DTSDKName, NSUserActivityTypes, NSServices, CKSharingSupported, NSPrincipalClass, LSApplicationCategoryType, CFBundleDisplayName, CFBundleDocumentTypes, DTSDKBuild, CFBundleShortVersionString, CFBundleSupportedPlatforms, BuildMachineOSBuild, DTPlatformBuild, CFBundlePackageType, DTXcodeBuild, CFBundleDevelopmentRegion, UTExportedTypeDeclarations, CFBundleVersion, NSSpeechRecognitionUsageDescription, CFBundleNumericVersion, CFBundleGetInfoString, NSSupportsSuddenTermination, LSFileQuarantineEnabled, NSSupportsAutomaticTermination, OSAScriptingDefinition, NSMainNibFile, ASWebAuthenticationSessionWebBrowserSupportCapabilities, CFBundleIdentifier, HPDHelpProjectIdentifier, DTXcode, CFBundleIconName, CFBundleHelpBookName, CFBundleHelpBookFolder, Application-Group, CFBundleExecutable, NSExtensionSDK, LSMinimumSystemVersion, CFBundleSignature, NSLocationUsageDescription, DTPlatformName, CFBundleURLTypes*)

repeat with itemKey in ocidAllKeys

  log itemKey as text

  try

    log (ocidBundleInfo's valueForKey:itemKey) as text

  end try

end repeat

|

« [CotEditor]日付挿入 | トップページ | 【characterSetWithCharactersInString】改行コード判定 »

NSBundle」カテゴリの記事

UTType」カテゴリの記事