I'm new to AppleScript. I'd like to write a piece of AppleScript that will raise and give focus to a particular Chrome window given a string that appears in the window name. After poking around a bit, I found the following:
tell application "Chrome" activate set index of first window whose name contains "mail" to 1 end tell
That makes Chrome the current application and puts the right window on top, but that window doesn't have the focus. Is there something I can add to this to direct the focus to that window (or is there a better way of doing this)?
In case it matters, I'm running Mojave.