It's not a problem to include it in a GUI script, you just need to use a non-blocking check.

The example script I gave you blocks simply because that is most efficient for that script, but there is no reason that you shouldn't call the routine in your GUI polling loop if you use (say) ".WinExists" instead of ".WinWait".

The code to get the message will be identical.

For example:
; GLOBAL SETUP - PLACE AT SCRIPT START----------------------
GLOBAL $oAutoIT, $sMessengerTitle, $iControlMessenger
$sMessengerTitle="Messenger Service"

If @ERROR OR VarType($oAutoIT)<>9 "Cannot create AutoIT object - no registered perhaps?"+@CRLF Exit @ERROR EndIf

; Set some useful options.

; END OF GLOBAL SETUP---------------------------------------

; Check for new message function
Function udfCheckForMessage()
If $oAutoIT.WinExists($sMessengerTitle)

Now, in your event polling loop you only need to do something like:

If $sMessage
; Parse and action message
End If