Beginner Question - Evaluating the Contents of Text Fields

Hi. I have an embarrassingly basic question here:

I’ve been able to easily put strings into existing text fields with setStringValue_(someString), but how do I evaluate the contents of an NSTextField object in, say, an if statement? I (think I) understand that the information in the field is not a typical AppleScript string but an NSString object, so I’m trying to force it into some other kind of string value, but after an embarrassing number of days of trying, I can’t figure it out.

The old AppleScript Studio line that I’m trying to update to AppleScriptObjC went like this:

if contents of text field "theField" of window "theWindow" is not "some text here" then ...

I’m trying approaches like this, based on the Cocoa documentation and the inheritance of NSTextField:

 set someSimpleStringVar to theField's stringValue()
if someSimpleStringVar is not "No name selected" then ...

…but they’re getting me nowhere. Now I can’t tell if it’s just bad code, incorrectly ‘hooked up’ IB elements or (most likely) some evil combination of both. Any help would be greatly appreciated.

(By the way, I did go through tutorials 1, 2 & 5 but for some reason I haven’t been able to apply what I learned to my current problem. Also, this is an attempt to update a functional, medium-sized hybrid AppleScript and Perl app that I wrote a couple of years ago. That is, it includes multiple ‘do shell script’ Perl calls, so this might be confusing if someone wants to look at the whole messy thing.)

theField’s stringValue() as string

else it won’t work without “as string”

Yep, that was it. Thanks!

(I think I had just problems isolating where the bug was, given how many other things might have gone wrong.)