Accessing the Dock Menu of an Application

I'm trying to access the dock menu as seen in the photo. Do any of you guys have way to to achieve this?

Apparently, Skype for Business does not yet offer the possibility to change status via the shortcuts or file menu.

Thanks a lot!

I do not have the program, but maybe it can be done with AppleScript.

Found this for the Skype app:

And on my system this works in the consumer version of Skype:
tell application "Skype" to send command "SET USERSTATUS DND" script name "Vil ikke forstyrres"

Use that in an AppleScript Action.

“DND” is Do Not Disturb
You can also use “ONLINE” for setting status to online.
“OFFLINE” for offline.

Do not know the codes for the other settings. And can not find them on the Skype Developer site.

Great idea. Hadn’t thought about that.

I can’t seem to make it work though. Maybe it doesn’t work for “Business”.

I also tried writing “Skype for Business” instead og just “Skype” in the script.

To bad. I do not know enough about AppleScript to help to find out if Skype for Business handles AppleScript.

The internet (Google) does not seem to return anything useful.

What you could do was to use the “Click Image” action to Right-Click the icon in the Dock.
Then use a typing action for getting to Status.
A keypress on right arrow to get to the submenu.
Then another typing action to get to Vil ikke forstyrres.
And at the end a keypress action to press enter.

But you have a translucent dock, so the Click Image could maybe not be found if you change your desktop image on a regular basis.

It could be like this for an examples with the Messages app.

You can adjust it to your needs.

Keyboard Maestro 8.0.4 “Set status to "Tilgængelig" in Messages” Macro

Set status to "Tilgængelig" in Messages.kmmacros (19 KB)

Thanks a lot for all your research into my issue.

Only problem with this solutions is that the icon is mostly not visible since I auto hide my dock. But maybe I can trick the dock to appear before clicking the image.

You could use a move mouse action to the bottom of the screen with a small pause after it.
Or a pause until image exist. Where the image is the screen shot of the Skype dock icon.

Hey Martin,

Drag the Skype app onto the Script

If it produces a sdef (script dictionary) then the app is scriptable.

If you drop onto the Script you'll see what an sdef is supposed to look like.

If SfB is not scriptable then it's not too hard to access the Dock menu with UI-Scripting via AppleScript.

Run this from the Script, and it will use the Finder's Dock menu to open a new window.

# Auth: Christopher Stone
# dCre: 2018/01/04 04:12
# dMod: 2018/01/04 04:18
# Appl: Dock, System Events
# Task: Access an App's Dock Menu
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Dock, @System_Events, @Access, @Application, @Dock, @Menu

tell application "System Events"
   tell application process "Finder" to set its frontmost to true
   tell application process "Dock"
      tell list 1
         tell UI element "Finder"
            perform action "AXShowMenu"
            tell menu "Finder"
               tell menu item "New Finder Window"
                  perform action "AXPress"
               end tell
            end tell
         end tell
      end tell
   end tell
end tell


Something similar can be done with Skype.



Very clever!

Unfortunately it appears that Skype for Business is not scriptable :frowning2:

But thanks for the tip. I will definitely use that trick in the future!

I still think you can use Chris’ suggestion with the UI-Scripting.

Unfortunately Skype has just updated for me. And has no longer any settings in the dock icon.
So I can not test it or create a script here.

I found out that cmd+option+d is actually a shortcut to show/hide the dock.

I made the image of the Skype icon smaller, so that it doesn’t contain any background. This way KM is able to click the image even if I change my wallpaper.

Sop now everything works perfect.

Thanks so much!

1 Like

Glad to have helped.
Also nice to see another Danish user ID Keyboard Maestro.
I do not think we are that many :slight_smile:

Thanks for this example, Chris.

I deleted the five lines immediately following

           perform action "AXShowMenu"

and changed the app name in the previous two places to my DeskSpaceID app. Running this script in KBM from a hotkey or menu now gives me yet another way to display a selectable list of all my available named desktops.

I have a question: If the app is always in the Dock, do you need the "set its frontmost to true" line? Is that line there to ensure that the app is in the Dock before telling the Dock to talk to it, or does it serve some other purpose?

Also, does the Dock have a list 2 or is list 1 simply the name of the list of apps in the Dock?