'Detecting window in SAP GUI script with if condition

There is attached SAP GUI window SAP window.

How I can detect if that window appears? It is not pop up window. Tried code below but it stops without error message and says completed and that window in the picture remains on screen. Everything else before this code works. I need to go just back from that window and then save a production order.

If session.findById("wnd[0]").text = "Message log created on" then 
   session.findById("wnd[0]/tbar[0]/btn[3]").press 'If popup message log appears then press button Back

Else
   session.findById("wnd[0]/tbar[0]/btn[11]").press 'Save production order

End if

session.findById("wnd[0]/tbar[0]/btn[11]").press 'If previous if sentence is true press save after that


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source