Get information out of a textfield

Hi,
I am an absolute beginner and I have a big problem. I have this window: picture and I want to get the information of a the text fields. Every text field should be later one variable.
I searched in the forum but the only thing I found was this:

on clicked theObject
set variable to content of textfield "xxx" of window "yyy"
end clicked

but this does not work

Please, can you help me with the problem. Thank you for your help and time.
best regrads
Marcel

Hi,

the class text field are two words

I changed it in my script but I does not work.

on clicked theObject
	set mass_value to content of text field "field_mass_value" of window "F_ma"
end clicked
if the button returned is "Force" then
	display dialog mass_value
end if

Then I get the error message: AppleScript Error Can’t get <> of “field_mass_value”. (-1728)

may you can help me better with this information

try


 set mass_value to string value of text field "field_mass_value" of window "F_ma"

This works but there is another error. This time I get this: Can’t make «class bhit» into type reference. (-1700)

button returned («class bhit») is a property of the result record of display dialog.
It doesn’t work “stand alone”

uih it is hard work, but I had another error: Can’t get «class bhit» of “8”. (-1728)
Here an overview of the script

on clicked theObject
	set mass_value to string value of text field "field_mass_value" of window "F_ma"
	if the button returned of the result is "Force" then
		display dialog mass_value
	end if
end clicked

this cannot work, because there is no display dialog command right before the button returned line.
The UI elements of Apple Script Studio work quite differently from plain AppleScript :wink:
If you want to check the contents of the text field, use something like this


on clicked theObject
	set mass_value to string value of text field "field_mass_value" of window "F_ma"
	if mass_value is "Force" then
		display dialog mass_value
	end if
end clicked

but if you want to execute code after clicking a certain button, use this


on clicked theObject
	set mass_value to string value of text field "field_mass_value" of window "F_ma"
	if (get name of theObject) is "Force" then
		display dialog mass_value
	end if
end clicked

Thank you very much. This is what I was looking for.

Take a look at /Developer/Examples/AppleScript Studio/, there are a lot of sample projects