1

I want to get a path to any application, and this is what I do:

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

This gets me the path but also opens Photoshop. How can I make it so it doesn't open Photoshop?

Lri
  • 26,768
  • 8
  • 84
  • 82
user635064
  • 6,219
  • 12
  • 54
  • 100

1 Answers1

1

Here's one way... use lsregister which uses Launch Services. This gives a list of all matching apps.

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\"")
regulus6633
  • 18,848
  • 5
  • 41
  • 49
  • copied from http://stackoverflow.com/questions/3444326/list-all-applications-output-as-text-file – sakra May 02 '11 at 19:13