Hi,
Here is an example that you can base your logic on, After the start stage, there is a reader that reads if the application that we are using is either connected or not, if the app is not connected you attach it, if not it ends the process.
I hope this will be useful !
Adnane