0%

AppleScript 获取应用路径

1
2
3
4
5
6
7
8
9
10
11
12
13
14
on getAppPath(AppName)
try
set launchServicesPath to "/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister"

-- get the path to all executables in the Launch Service Registry that contain that appName
set appPaths to paragraphs of (do shell script launchServicesPath & " -dump | grep --only-matching \"/.*\\" & AppName & "\"")
log appPaths
return appPaths

on error
return "NOT INSTALLED"
end try
end getAppPath

参考: