Is there any way to set the input focus to the second text field in window?
I’ve created a simple AppleScript Studio app that has one window with two text fields. I have a will open handler which sets up the first text field with a default value:
on will open theObject -- This handler is called just before the main window opens -- It puts the user's username into the username field set theUserName to system attribute "USER" tell window "Main" set contents of text field "userName" to theUserName center end tell end will open
Currently when the app is run the first text field is selected for input focus, and the default value is selected. Since the default value is going to be correct the vast majority of the time, I’d like to automatically move the input focus to the second text field (which is empty). I’ve found that I can force the focus to the second text field by making the first text field not editable, but that’s going to be a problem on the occasions when the default value isn’t correct…
So, is there any way to tell the window to select the second text field for input? My apologies if this question has been answered before, or if my terminology doesn’t match AppleScript standards. I’ve looked through Apple’s online reference docs and searched this forum, but this is only my second day with AppleScript Studio, and I may well be using the wrong wording here… :oops: