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:
Code:
; GLOBAL SETUP - PLACE AT SCRIPT START----------------------
GLOBAL $oAutoIT, $sMessengerTitle, $iControlMessenger
$sMessengerTitle="Messenger Service"
$iControlMessenger=65535

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

; Set some useful options.
$=$oAutoIT.Opt("MouseCoordMode",0)
$=$oAutoIT.Opt("WinTitleMatchMode",4)

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

; Check for new message function
Function udfCheckForMessage()
If $oAutoIT.WinExists($sMessengerTitle)
$udfCheckForMessage=$oAutoIT.ControlGetText("last","",$iControlMessage)
$=$oAutoIt.WinClose("last")
EndIf
EndFunction



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

$sMessage=udfCheckForMessage()
If $sMessage
; Parse and action message
End If