How to stop execution in StudioX?

I have a message box with the options of okay and cancel. I want the bot to stop execution if the user hits cancel. Is there a way to do this?

I tried saving the output of the message box and creating an if statement that says If message box output = cancel then keyboard: F12 which stops execution. The problem is the keyboard shortcut activity must be inside a Use Application/Browser activity.

I have seen some solutions suggesting using activities such as terminate workflow or stop job, but I don’t think these activities are available in StudioX.

Hi @bot82,
You are very close. Something like this will work:

So in case of Cancel button scenario you can use just empty left side and for OK button use all the rest inside the right side. Remember that there must be nothing else after the if activity because program will execute everything from top to the bottom that’s why in case of OK button all needs to be placed inside the IF.

Here’s the example from screenshot: (94.5 KB)