应用程序的路径,无需打开它

时间:2011-05-02 17:48:50

标签: applescript

我想获得任何应用程序的路径,这就是我所做的:

set i to path to application id "com.adobe.Photoshop"

这让我获得了路径,但也打开了Photoshop。我该怎么做才能打开Photoshop?

1 个答案:

答案 0 :(得分:1)

这是一种方式...使用lsregister使用Launch Services。这会列出所有匹配的应用程序。

set lsRegisterPath to "/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister"
set appBundleID to "com.adobe.Photoshop"

-- get the path to all apps with the bundle id
set theAppPaths to paragraphs of (do shell script lsRegisterPath & " -dump | grep --before-context=2 \"" & appBundleID & "\" | grep --only-matching \"/.*\\.app\"")
相关问题