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
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)
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
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