AppActivate("Chat Window") selects the application it will run its code I guess that's how you explain it.
I took out the do and the loop, now whenever I click on the application it automatically switches to the Chat Window application.