AppleScript: Select a specific drop down menu item

applescriptfont

folks.

I'm incredibly new to AppleScript…just starting to open up my world to coding, and thought I'd start here. (I did BASIC back in high school. haha)

All I'm trying to do is set a font type and size for Avid Media Composer. As of now, I have it written to just change the font to a predetermined size of 14, but I can't figure out how to se3lect the specific font from the drop-down menu. All the help I've found on here tends to be about Javascript and stuff…I found one that selected menu items in the Dictation sys pref… But I couldn't figure out how to apply it to my script.

Here what I have for setting the font size to 14:

on run
    tell application "AvidMediaComposer"

        activate

    end tell


    tell application "System Events"

        tell process "Avid Media Composer"

            click menu item "Set Font..." of menu "Edit" of menu bar 1

        end tell

    end tell

    tell application "System Events"
        keystroke "14"
    end tell

    tell application "System Events"
        keystroke return
    end tell
end run

I need to be able to select what you see here:
enter image description here

Thanks in advance! (I'm sure my script is garbage too, but it works…happy to take any/all criticism. Just beginning to get into this.)

Best Answer

As far as I can guess at your "structures", code to select a specific font might look like this:

-- insert after: click menu item "Set Font..." of menu "Edit" of menu bar 1

click pop up button of group of window "Set Font"
click menu item "[someFontName]" of menu of pop up button of group of ¬
   window "Set Font"

Depending on dialog window's "surroundings" s.th. like "group 1 of..." may be necessary.