View Single Post
Mark FX

Mark FX's Avatar
Member Since: Aug 13, 2011
Location: West Sussex, UK
Posts: 180
Mark FX has a spectacular aura about

Mark FX is offline
The problem you have is that the text returned by the NSTextField is of a class called NSCFString, this needs to be converted into an Applescript text class like this.

    on test_(sender)
        set theText to sender's stringValue() as text --see here
        if theText is equal to "Hello World"
            display dialog theText
        end if
    end test_
See how i've converted the senders stringvalue() into type Applescript text

I mostly work in the Objective C language, so dont do much Applescript these days, so you have to make sure that you convert into a class that Applescript understands, to check the class of an object do this.

    on test_(sender)
         log class of sender's stringValue()
    end test_
That should do you.

Regards mark
QUOTE Thanks