0

AppleScript または Python を使用して、Mac で利用可能なすべてのアプリケーションを一覧表示する方法は?
私を助けてください。

4

1 に答える 1

1

次の AppleScript を確認してください。

set theResult to every paragraph of (do shell script "mdfind 'kMDItemContentTypeTree == \"com.apple.application\"c' | sort")
set systemApps to {}
set applicationsApps to {}

repeat with i from 1 to number of items in theResult
    set end of systemApps to item i of theResult
    if item i of theResult contains "/Applications/" then
        set end of applicationsApps to item i of theResult
    end if
end repeat

systemAppsリストには、システム上のアプリケーションが含まれています。次に例を示します。

{
"/Applications/Address Book.app",
"/Applications/Calculator.app",
"/Library/Image Capture/Devices/EPSON Scanner.app", 
"/Library/Little Snitch/Little Snitch Network Monitor.app",
"/Library/Scripts/ColorSync/Show Info.app",
[....]
}

applicationsAppsリストには、次のようなアプリケーション フォルダー内のアプリケーションが含まれます。

{
"/Applications/Address Book.app", 
"/Applications/App Store.app", 
"/Applications/Automator.app", 
"/Applications/Calculator.app",
"/Applications/Utilities/Activity Monitor.app"
[....]
}

上記のスクリプトは、Ross によるスクリプトに基づいています ( Mac OSX Hints Forumsを参照)。

set appString to do shell script "mdfind 'kMDItemContentTypeTree == \"com.apple.application\"c' | sort"
set appList to every paragraph of appString
set theReport to ""
repeat with i from 1 to number of items in appList
set theItem to item i of appList
set theApp to (a reference to POSIX file theItem)
set fileInfo to info for theApp
set versionInfo to long version of fileInfo
if versionInfo is missing value then set versionInfo to " "
set theReport to theReport & theItem & " " & versionInfo & return
end repeat
theReport
于 2012-09-04T11:04:52.820 に答える