【问题标题】:Path to application without opening it无需打开的应用程序路径
【发布时间】:2011-08-17 03:50:45
【问题描述】:

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

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

这为我提供了路径,但也打开了 Photoshop。我怎样才能使它无法打开 Photoshop?

【问题讨论】:

    标签: applescript


    【解决方案1】:

    这是一种方法...使用 lsregister ,它使用启动服务。这会列出所有匹配的应用程序。

    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\"")
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-07-07
    • 1970-01-01
    • 2013-04-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多