How to verify modal-window is visible or not?

I need to verify whether modal-window (bootstrap) showing up or not, and transfer result in variable, so i can use If condition and perform base on value (true or false) stored in Variable.

Thanks.

what is your script or solution so far?

I was Trying
ANS = WebUI.verifyElementVisible(findTestObject(‘TestObject’), FailureHandling.OPTIONAL)

If {ans== true} {
Click button [Yes] on modal-window
}

(TestObject = an Object which appears in modal-window in my case Confirmation button on modal-window, If it times out than i am assuming modal-window not showing up. (The logic is not clean but for time being i am using it temporarily)

The logic to make decision is on negative scenario , so system waits until timeout which is 30 sec. in my case, which is long.