1

How, please, would one go about placing input focus on the dock without necessarily having to use key codes?

Here is an Emacs keyboard shortcut that works, but I'd like to learn how to do it without key codes, if that is possible.

(global-set-key (kbd "<C-M-s-f3>") (lambda () (interactive)
  (do-applescript
    "tell application \"System Events\"
    set visible of process \"Emacs\" to false
    delay .2
    key code 99 using control down
    end tell")))
lawlist
  • 13,099
  • 3
  • 49
  • 158
  • Does this question help http://stackoverflow.com/questions/2819807/accessing-dock-icon-right-click-menu-items-with-applescript – Digital Trauma Jan 09 '14 at 00:55
  • 1
    @DigitalTrauma  The code in that link may be placing some type of focus on the dock, but it doesn't actually raise the last used dock icon like Control+F3. My goal is to be able to begin typing the name of the application I want once focus is squarely on the dock. With the code in that link, I am unable to select any application by typing the name like I normally can do after pressing Control+F3. – lawlist Jan 09 '14 at 01:06

1 Answers1

0

As far as I know there is no AppleScript command to programmatically enter this state. As with many scripted solutions, invoking the required keyboard or mouse-click simulations is the only solution available.

The Dock is implemented as an application, hidden away at:

/System/Library/CoreServices/Dock.app/

However, as the app is not "AppleScriptable" it doesn't offer any sane mechanism for automation.

danielpunkass
  • 17,527
  • 4
  • 24
  • 38