Set contents of text label

How do I set the contents of a text label? I’ve tried…

set value of testLabel of testLabel to "blah"
        set text field "LBL" of window "TEST" to "blah"
        set value of text field "LBL" of window "TEST" to "blah"
        set contents of text field "LBL" of window "TEST" to "blah"

You are using AS language rather than ASOC in your attempts. If you have a text field (or label) named myTextField, try:

myTextField's setStringValue_("blah")

You can see all the ways to set and read controls in the NSControl class reference in the cocoa docs

Ric

Thanks very much! :smiley:

This is sorta related, how do I set a variable to the text returned of a text box and set the title of a window?
I’m used to AppleScript and very new to ASOC!

Do you mean TextField? It´s almost the same as setting the value (note the missing “_” and the empty brackets):

property myTextField: missing value -- connect this with your TextField in IB
...
myTextField's stringValue() as text

Yea, I meant text field, thanks for that!