AppleScript名:指定のアプリケーションのInfo.plistの任意の属性値を取得する |
— Created 2017-07-23 by Takaaki Naganoya — 2017 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" use BridgePlus : script "BridgePlus" –http://piyocast.com/as/archives/4759 load framework set aP to choose file set aURLrec to getAppPropertyFromInfoPlist(aP, "NSAppleScriptEnabled") of me –> {appName:"Photos", appBundleID:"com.apple.Photos", urlScheme:{"photos"}} on getAppPropertyFromInfoPlist(aP, aPropertyLabel) set aURL to current application’s |NSURL|’s fileURLWithPath:(POSIX path of aP) set aBundle to current application’s NSBundle’s bundleWithURL:aURL set aDict to aBundle’s infoDictionary() set appNameDat to (aDict’s valueForKey:"CFBundleName") as string set bundleIDat to (aDict’s valueForKey:"CFBundleIdentifier") as string set aRes to aDict’s valueForKey:aPropertyLabel if aRes is not equal to missing value then set aRes to aRes as string end if set aRec to {appName:appNameDat, appBundleID:bundleIDat, propRes:aRes} return aRec end getAppPropertyFromInfoPlist |
(Visited 23 times, 1 visits today)