I’m sure this has been answered before, but my searching abilities are not up to finding the solution.
How can one pass a System Events command via something other than the process name? I need to do this when there are multiple processes with the same name, and I would like them all to do the same action (imagine different versions of a piece of software, all of which use the same application process name).
I thought it might be possible to use the process IDs, but my abilities limit me to getting the proper applications to the front.
Here’s something simple to illustrate the problem—I’ve used the name of the application as “foo”, but you could duplicate any application on your hard driver, and then launch both the original and the copy. (TextEdit is fine)
tell application "System Events" set theIDs to the id of every process whose name is "foo" repeat with anID in theIDs set frontmost of process id anID to true --- need something like (or a workaround for) tell frontmost application to keystroke "hello, world" end repeat end tell
Any tips would be helpful.