プロセスがすでに開いている場合は、次のようなものを使用できます。
tell application "System Events"
tell (process 1 where name starts with "TextEd")
properties
set f to its file
end tell
end tell
tell application (f as text)
properties
end tell
ファイルを一覧表示するように Finder に指示するのは非常に遅いです。
tell application "Finder"
item 1 of (path to applications folder) where name starts with "Text"
end tell
ただし、使用できdo shell script
ます:
set a to do shell script "ls /Applications/ | grep -m1 '^Text.*\\.app$'"
tell application a
properties
end tell
set a to do shell script "mdfind 'kMDItemContentType==com.apple.application-bundle&&kMDItemFSName==Text*' | head -n1"
アプリケーション フォルダの外も検索します。