Can Keyboard Maestro make Stream Deck go to a specified page or folder?

Short press works fine. It just opens the Keywords panel in Lightroom.

Long press, which should load the Keywords profile (the buttons for working in the Keywords panel) is trying hard, but just goes to that profile for a split second, then returns to the Lightroom default profile.

Here's a screenshot showing the SD "LR Keywords" profile and my KM macro:

All.... most.... there!

I don't use profile switching in quite the same way, so I'm having to figure it out too. I've tested this and it works. The key is the nice long pause at the end which gives the macro time to reject further runs via the Semaphore Lock, which now times out very quickly. This should stop it retriggering shortly after you've loaded your Keywords profile. Of course, you'll have to edit it a bit, as before. Let me know how you get on.

Lightroom - Load Default SD Profile.kmmacros (22 KB)

Probably goes without saying, but to get back to the main Lightroom profile, just put a native SD profile switch button in your Keywords profile.

I’m off to the races!

I just modified a copy of the Load Default SD Profile macro, triggered by a button in the Keywords profile, that takes me back to the previous screen.

I’ll check back in here in a day or two and show what I’ve been able to build, now that I have a way to "build it out."

But for now, thanks for your generous help!

Unless you need the short/long press functionality on that button too, it's total overkill. Just use the native profile switch button.


Good thought. Simple that gets the job done is always better.

Just to clarify, does "I'm off to the races" mean, "that last version you sent me worked"?


Yes, however, I’ve noticed that I almost always have to press twice. It springs back to the default profile on the first long press. On the second, it sticks.

I made a version to use when I want to open the Lightroom panel and go to its profile in one step (removing the short/long press actions), and it also requires two presses to "stick" on the profile, rarely, but occasionally three.

Any idea what could be going on with that?

So, in both the long/short press and the "one step" macro, I just duplicated the "Open SD Profile Trigger App" and "Select the above trigger app to be quit upon run" actions, and it works every time, albeit with a little flicker of the SD buttons. Must be a more elegant fix, but for now, it works for me! :slight_smile:

Glad it's working but that shouldn't be necessary. One difference between our setups might be the speed of our macs. Try messing with the pause length.

The pause in the Semaphore Unlock?

I’m also curious about the "Wait for Release (0.2sec Timeout)" in the short/long press macro. Where is the .2 sec specified?


No, don't touch that. Leave it as 1/100th of a second. Try increasing the length of Pause for Semaphore (Avoids Loops) to something extreme like 10sec, and see if that stops the SD losing the Keywords profile.

This waits for the key release. If it isn't found before the timeout, the press is considered Long; if it is, then the key was released quickly and is considered Short. Therefore, increasing the timeout length will mean the key has to be held for longer to register as a Long Press.

Action timeouts are accessed via their gear icon at the top right.

Incidentally, I just tried another approach that also works nicely.

If you ⌘-drag the SD menu bar item to the far right, it should stay in the same location even if other items appear. In the Click Stream Deck Menu Bar Item action, click Get and then position your mouse over the SD menu bar item to save its location for future clicks.

Running this simple macro will select the Keywords SD profile, and you can set the Lightroom profile back to being triggered by the app itself in SD prefs, with no need for blank trigger apps at all. The Keywords profile won't need an app association, as you'll be opening it using this method. It works for me without a pause after the menu bar item click, but you can add one if needed. 0.1sec will probably do it.

The trigger app method works perfectly for me, but if you're not having consistent results, you can use this instead; it's likely to be quite dependable.

Switch to Keywords SD Profile via Menu Bar.kmmacros (22 KB)

Macro screenshot

Potentially, some brilliant simplicity! But crazy things happened when I ran the macro. I discovered that Lightroom was interpreting the keystrokes as commands in the "Insert text by typing" action. "K" goes to the develop module and loads the brush. "e" goes to the library module for a single-photo view. "y" shows the before-and-after view, etc. All the way through every letter of "Keywords"! And the SD was ending up at profiles for Zoom, Pages or Safari--never at Keywords.

Since the only text in Lightroom happens when you’re in a text field (mostly image metadata) single-letter commands are common, along with much of the alphabet combined with modifiers. That's why the SD is so useful. No way I’m going to memorize keyboard shortcuts for all the commands I use.

So, I tried to "Insert text by pasting," but the SD menu bar list didn’t respond.

Is there a way to stop keystrokes in a menu bar listing from also going to the active app? (It's really kinda funny...)

Just got an idea... Doesn't Bartender have a way to select those menu items? I’ll check.

Well, it appears Bartender allows hot keys to just make a menu bar item's pull-down menu appear. That would just replace the KM "found image" action. But I don’t see a way for Bartender to then select something in the menu. Looks like the hot keys were added in v. 4, and all I can find is a v.3 online "manual." I’ve emailed them for clarification.

Ah man, that's annoying.

Not that I know of.

In that case, the logical solution is this:

Switch to Keywords SD Profile via Menu Bar.kmmacros (22 KB)

Macro screenshot

Set up the first click as before, then set up the Get in the Click "Keywords" Profile in SD Menu Bar Item List action to click the menu item. You'll need to be quite quick, clicking Get, then the SD menu bar item and finally hovering your pointer over the Keywords entry. I tested and it works, but does require a short pause for the menu to appear.

I did modify your mouse click action to be absolute, since the menu bar is really part of the screen and not any window. Would that be more reliable?

This double mouse click would be pretty stable if I named the profiles starting with a character that sorted them to the top, so making profiles for other apps wouldn’t move them. Both the blank app and mouse click approaches have their complications. Now that I have two ways to do what I want, I’ll spend some time mapping it all out so I’ll know how many different profiles I’ll need to make. That may help me decide which is best.
I’m definitely going to write Stream Deck about the hoops we’re jumping through to change profiles without pressing one of their buttons. Know if anyone makes a similar device that makes this easier?

Sorry, an oversight on my part. Yes, definitely the right call to change it.

Or just leave new profiles at the bottom of the list, which is the default behaviour.

Yes, please do. This would surely be easy for them to implement. There are various iPad apps, like Metagrid, but I don't know of any device as versatile or tactile as Stream Deck. I do vaguely recall that you can externally set Metagrid profiles, but don't quote me.

I thought perhaps I might be able to use AppleScript to select my Keyboard Maestro profile by name so that it wouldn't matter what order they're in, but it doesn't work. If any AS boffins who have a Stream Deck are listening... I can open the menu, but I can't click an entry in the list that pops up. The menu must be a weird type that AS can't see. @cdthomer?

activate application "Stream Deck"
tell application "System Events"
	tell process "Stream Deck"
		click menu bar item 1 of menu bar 2
		delay 0.3
		click menu item "Keyboard Maestro" of menu 1
	end tell
end tell

Hey Neil, it works for me but I have to be more specific in the scripts hierarchy.

However, it's very slow because of Stream Deck not responding to System Events commands like most apps due, thus a roughly 6 second delay between clicking the menu bar icon and then clicking the profile name.

I've brought that topic up here before (and elsewhere), but have never found a reasonable solution. That's why I eventually abandoned the idea of using AppleScript to switch profiles.

Here's the script in case anybody wants to tinker with it anyway. It's pretty self-explanatory but let me know if it doesn’t make sense.

Select specified Stream Deck profile via AppleScript (click to expand/collapse)
set profileName to "Keyboard Maestro (4)" --put the name of your profile here

tell application "System Events"
	tell application process "Stream Deck"
		--click the menu bar icon
		click menu bar item 1 of menu bar 2
		--wait until the profile name exists
		repeat until exists menu item profileName of menu 1 of menu bar item 1 of menu bar 2
		end repeat
		--click profile name
		click menu item profileName of menu 1 of menu bar item 1 of menu bar 2
	end tell
end tell

Yep, confirmed. Well done for figuring out you needed to wait for the item to exist. I didn't get that far. :+1:t3:

I guess the trigger app and cooridinate-click methods are currently the only viable options.

You're welcome! I have found the best method for switching to a specific profile is to use Elgato's smart profile feature and Keyboard Maestro's activate app action.