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?