Script to set focus to a given window by title

I’m new to applescript. Could someone please give me a script that would set focus to a window specified by title?

Specifically, I’d like to use this script to give focus to file upload box in firefox when a link that generates that dialog
is clicked.


Hi Andrew,

Firefox’s AppleScript capabilities are dreadful
here is a similar thread.

Hope it helps

Thanks - I actually saw that one. I’ve tried everything from activate first window whose name is… whose attribute “AXTitle” is… to set attribute “AXFocused” etc… nothing seems to work.
Still stuck if anyone has other suggestions.

I’m afraid you’ve chosen a browser (Firefox) which is not just difficult to script; in my experience it’s impossible. Using the UI Browser app, you rarely get past Window 1 to any other feature except the menus. It is simply not a “real” Mac OS X application; it’s a port from MSW.