AppleScript名:指定ファイルをオープンするデフォルト・アプリケーションのパスを求める |
— 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 bPath to getDefaultAppPathFromDocumentPath(aFile) of me –> "/Applications/Skim.app" on getDefaultAppPathFromDocumentPath(aFile) set aURL to current application’s |NSURL|’s fileURLWithPath:aFile set aWorkspace to current application’s NSWorkspace’s sharedWorkspace() set anApp to aWorkspace’s URLForApplicationToOpenURL:aURL if anApp = missing value then return false return (anApp’s |path|()) as string end getDefaultAppPathFromDocumentPath |
(Visited 21 times, 1 visits today)