Text fields question

How can you refer to the title of a text field that is oftenchanging from either user input or the script telling it to change?

I don’t quite follow what you are asking, can you be more specific? You can attach editing handlers to a text field to test when its contents have changed and act on it accordingly (though in AppleScript alone, this usually results in a stuttering user interface).


Take a look at the currency converter example AS Stutio app. It has this in the script…

set theRate to contents of text field "rate"

But nowhere in the nib is there a text field called “rate”. How can this be done?

  • Open the currency converter nib.
  • Click once on the first text field in the window, the one next to the label “Exchange Rate per $1:”.
  • Open the info window… “Tools > Show Info” or (cmd+shft+i).
  • Select “Applescript” (cmd+7) from the pulldown menu in the info window to activate the ‘Applescript Pane’.
  • At the top of the applescript pane is what scripters call the ‘Applescript Name’ field.

If you’ve done all this correctly, the name in the field should be ‘rate’. When referring to any object by name, as in the example you provided, the value in this field is what you’re referring to. You’re probably confusing this value for the the top field in the ‘Attributes’ pane in the info window, which is really just a title and is not usually the best way to reference items. The AS name is more reliable and more consistent, as it’s value doesn’t typically change.

Hope that clarifies things for you. Keep truckin’… :smiley:

WOW. how did I miss that!?!
Well thanks for your help!