So i am developing a trigger to search apple music library and switch to searching apple music if the song is not found in my library. I have almost achieved this. The only problem I'm facing currently is stopping the "wait for text to appear on screen" if i left click. Im not able to find a way to do this. Basically what i want to do is keep finding for text "Search Apple Music" (which appears when song searched is not in library) until i do a mouse click (which is clicking the song which i would only if it present in my library. I hope I'm clear lol. Thanks for any suggestions.
I dont know how to write an apple script so if you guys know a way to achieve this through apple script that would be great too!