AppleScript名:指定名称のアプリケーションのBundle IDを求める |
— Created 2017-11-07 by Takaaki Naganoya — 2017 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" use framework "AppKit" set anID to getBundleIDFromAppName("Keynote") of me –> "com.apple.iWork.Keynote" on getBundleIDFromAppName(appName) set appPath to POSIX path of (path to application appName) return getBundleIDFromPath(appPath) of me end getBundleIDFromAppName on getBundleIDFromPath(aPOSIXpath) set aURL to current application’s |NSURL|’s fileURLWithPath:aPOSIXpath set aWorkspace to current application’s NSWorkspace’s sharedWorkspace() set appURL to aWorkspace’s URLForApplicationToOpenURL:aURL set aBundle to current application’s NSBundle’s bundleWithURL:appURL set anID to aBundle’s bundleIdentifier() return anID as string end getBundleIDFromPath |
(Visited 23 times, 1 visits today)