Exit Wiki

This code the path of a running application from the given list.

to returnRunningAppPath from paramList
        tell application "Finder"
                repeat with each in paramList
                        set myProc to (every process whose creator type is each)
                        if myProc is not `[Unknown macro: {}]` then
                                set frontmost of item 1 of myProc to true
                                --one instance per application, on the Mac. It's GOTTA be item 1. Unless you made a duplicate
                                
                                set path_name to application file of (every process whose creator type is each)
                                
                                return path_name
                                
                        end if
                end repeat
        end tell
end returnRunningAppPath

Calling Example:

returnRunningAppPath from `[Unknown macro: {"HXPD", "HXPS", "HXPC"}]`

Returning Running App's Path from List (last edited 2006-10-13 20:55:19 by RyanWilcox)