The message box is automatically closed after a certain seconds if the option named AutomaticallyCloseAfter is not 0.
However, if a OkCancel message box is closed automatically, the output from it would be Ok by default.
Nope, I believe you can’t directly assign the output to Cancel. By default, it will be Ok if the AutomaticallyCloseAfter option is set to a value other than 0. This is the standard behavior of the Message Box activity in UiPath.