1

I'm trying to automate the selection of a value from a drop-down box in Mozilla using an applescript. What I want it to do is to tab to the drop-down box and enter down twice to select the third item in the drop-down.

Here is what I have so far:

tell application "Firefox"
    tell application "System Events" to keystroke tab
    tell application "System Events" to keystroke down
    tell application "System Events" to keystroke down
end tell

But, as far as I can tell, when I run the script nothing happens.

What do I need to do to make this script work?

EDIT: I have also tried entering the key code 125 for down in case the keystroke command was wrong.

1 Answer 1

1

Try this

tell application "Firefox"
    activate
    tell application "System Events"
        keystroke tab
        keystroke (key code 125)
        keystroke (key code 125)
        keystroke (key code 125)        
    end tell
end tell

You might not need to activate Firefox if it's the current active app. Them you just need :

tell application "System Events"
    keystroke tab
    keystroke (key code 125)
    keystroke (key code 125)
    keystroke (key code 125)        
end tell
3
  • I think you might have misunderstood. I want to navigate within the page. There are a number of drop-down menus on the page. I want to set up something that will let me tab to one of these menus and select the third value on the list. I will then repeat the script for the number of drop-down menus. The issue is a large number of drop-down menus that I need to select the third value from each of. I don't want to get to the address bar.
    – Dennis
    Commented Jan 31, 2013 at 6:34
  • I modified your suggestion, though, and found something that works. I just replaced the keystroke "l" line with my original tab line.
    – Dennis
    Commented Jan 31, 2013 at 6:39
  • ok I edited my answer to match what you were looking for. Commented Jan 31, 2013 at 10:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .