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 aFile to POSIX path of (choose file) set anID to getDefaultAppIDFromDocumentPath(aFile) of me –> "com.apple.Preview" on getDefaultAppIDFromDocumentPath(aFile) set aURL to current application’s |NSURL|’s fileURLWithPath:aFile 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 if aBundle = missing value then return false set anID to aBundle’s bundleIdentifier() return anID as string end getDefaultAppIDFromDocumentPath |
(Visited 25 times, 1 visits today)