Get contents of two NSTextFields

Hi everyone, I thought this would be my last questions but it seems like it’s not…

I have this script like :

property theName : missing value
property theSecondName : missing value

on end editing theObject
	set contents of text field "NameBox" of window "window" to text returned of theName
	set contents of text field "SeconNamelBox" of window "window" to text returned of theSecondName
end end editing

but when I typed text in the first NSTextField (NameBox) then I get this error : “Can’t get <> of missing value. (-1728)”
and then when I try to type in the second NSTextField, before pressing enter, I get the same error.

Eventually I want to get to something like this :

if theName is equal to theSecondName then
--do action
end if

But what am I missing ?

Thanks in advance.

text returned is a return value of display dialog,
I don’t know what kind of value you want to set

Oh, stupid me, I ripped it off of the Display Dialog example instead of Display Panel.

I has to be :

set theName to contents of text field "NameBox" of window "window"

Now I only need to get the equal thing working but that won’t be too hard… I’ll just test it till it works