Well, this would require the script to store the messages while you receive them, even if you don't need to send them. Scripts don't have access to the last messages, the closed we can get is retrieve a portion of your chat history using ChatWnd::HistoryText_GetTextRange, but we can't know how long it is.