You can try using this python library to access your gmail box:
http://libgmail.sourceforge.net/There is a code example that looks pretty easy to change to save the output to a text file. You could move the messages you want to a specific folder and use this program on that folder.
You could always setup POP3 and export from Outlook.