« [Jedit Ω]行番号を入れる | トップページ | [Jedit Ω]前面書類がHTMLなら指定のブラウザで開く(file:///) »

[bundleWithIdentifier]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 framework "AppKit"
use scripting additions


property refMe : a reference to current application

###対象のアプリケーションのUTI
set strUTI to "com.skype.skype" as text


####UTIからアプリケーションのインストール先を求める
set ocidAppBundle to refMe's NSBundle's bundleWithIdentifier:strUTI
if ocidAppBundle is missing value then
  set appNSWorkspace to refMe's NSWorkspace's sharedWorkspace()
  set ocidAppBundlePathURL to (appNSWorkspace's URLForApplicationWithBundleIdentifier:strUTI)
else
  set ocidAppBundleStr to ocidAppBundle's bundlePath()
  set ocidAppBundlePath to ocidAppBundleStr's stringByStandardizingPath
  set ocidAppBundlePathURL to (refMe's NSURL's fileURLWithPath:ocidAppBundlePath)
end if
log ocidAppBundlePathURL as alias
return ocidAppBundlePathURL as alias

|

« [Jedit Ω]行番号を入れる | トップページ | [Jedit Ω]前面書類がHTMLなら指定のブラウザで開く(file:///) »

NSBundle」カテゴリの記事

UTType」カテゴリの記事