Selected field when application opens

Hello All,

Anyone know how to make a certian text field the selected text field when the app opens, the cursor keeps defaulting to the first text field when my app opens.

Thanks!!

To focus a certain text field, use…

set first responder of window "theWindow" to text field "textField" of window "theWindow"

As jj and jonn8 pointed out to me a while back, the first responder is a window property so you have to state which window to set the first responder of, and then which object to set it to. For example, this won’t work…

FYI…in certain cases you might want to have NO text field focused. You can set to first responder to either a visible, unselectable object (so there’s no blue outline), or a hidden selectable object…

-- A line, assumes you have a line (actually a box object) named "line"
set first responder of window "theWindow" to box "line" of window "theWindow"

-- A hidden button --
set visible of button "theButton" of window "theWindow" to false
set first responder of window "theWindow" to button "theButton" of window "theWindow"

There may be a better way to do this, like somehow setting the first responder to a empty/null value, but I haven’t found the syntax yet.

Hope this helps…
j

Awesome thanks, works perfect!!