Which command to use?

How can I get the software to determine when the following is finished?

I have text called “GET” when I press it it changes to three running dots and when the function is done it gets back to “GET”