Exit Wiki

This code finds any application whose creator type is in the passed in list.

to findAndActivateFromList(paramList)
        tell application "Finder"
                set procList to every process whose creator type is in paramList

                set frontmost of (item 1 of procList) to true
        end tell
end findAndActivateFromList

Calling Example:

findAndActivateFromList(`[Unknown macro: {"HXPD", "HXPS", "HXPC"}]`)

This works Great in OS 9, but sometimes there are runtime problems in OS X with this script (I guess Applescript doesn't like the whose creator type IS IN paramList. The reliable way is to use whose creator type is someItemOfParamList ).

So, you need to use this slower, less elegant routine. However, this does have some good points, as we can activate ALL of the processes found (if they are all running), instead of the first one that the whose statement stumbles upon.

to findAndActivateFromList(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
                        end if

                end repeat
        end tell
end findAndActivateFromList


Find And Activate Any Of A List (last edited 2006-10-13 20:54:33 by RyanWilcox)