I encounter a problem when writting osascript. I need to “tell” one java process (GUI) to do something but there are other java process with the same process name “java” (also GUI),
so my below sample code will not work for me:
osascript \
-e "tell application \"System Events\"" \
-e "tell process \"java\"" \
-e "click button \"MyButton\" of tab group 1 of window \"MyWindow\"" \
-e "end tell" \
-e "end tell"
So my question is how to distinct different java process in such scenario?
Based on your response to my comment, I would do something like the following. Note that I did not test this so you’ll probably have to tweak it but it shows how you can check for those specific names. Good luck.
EDIT: maybe you can get at the proper process like this…