are two ways of retrieving the document number.
If you are using an input script to create document, simply go
to the corresponding change or display transaction. The document
number will be stored on the screen. Or you can use
"Search" option in the set command with _message
Let's assume that your status message is: "Document
12345678 is created"
GuiXT will store this message in _message variable.
V[doc_number] "&[_message]" "Search=Document"
above command searches for a word Document and Returns the next
word to it. In this case variable doc_number will contain value