Click a Button, Every 5 Minutes

I have an Android emulator that lets me platy Android games on my Mac (sweet!). The trouble is, it tends to loose the network connection very often, prompting a popup/error message with a button.

I would like to check to see of the error has occurred every 5 minutes, and if so, click the button.

I’ve attached a diagram of what I am trying to accomplish, along with a script that I have been experimenting with.

DIAGRAM:

SCRIPT:

activate application "BlueStacks" tell application "System Events" to tell process "BlueStacks" #buttons 1, 2 & 3 are close, shrink & maximize #how do I get to the "Try Again" button? click button 4 of window "BlueStacks App Player" end tell
QUESTIONS:

  1. How do I get line 5 to target the ‘Try Again’ button?
  2. How do I get this script to run/repeat every 5 minutes so I never get knocked off line for too long?
  3. I tried “button 4” assuming that it went linearly: 1, 2, 3, 4, etc. like a button array. but that was not the case.

P.S. I am new to Apple Script, but I get the concept and have tried many things in the past, eventually getting them to work. I am a front-end web developer and UX/UI designer, so I am close to getting it, I just am not familiar with Apple Script.