Then something along your reference chain is not named like you think it is, or, your text field is contained by some object (like a box or a tab view item of a tab view) that you have not included in your reference.
No, you don’t need to add another reference to “window 1” or whatever, as suggested by viscousfishes since is is already inside a tell window block.
Jon is right, there must be something amiss in your naming and until you find it, you will not be able to get to the content of that text field of yours.
Check your main window and make sure it is named “mainwindow”. That and the name of your text field.
A problem I kept having was trying to get the text from a “NS Text View” instead of a text field, it needs to be referenced properly if it is a text view. Check in your interface builder, select it and in the Inspector panel look at custom class. Good luck!