I’m trying to bring a Helium window to the front when pressing a particular Stream Deck key. The window that needs to be brought to the front is the window that contains a tab whose URL starts with a particular value.
Unfortunately, Helium doesn’t let me give a window a specific name — the window’s name is the title of the currently active tab.
I have this JXA:
const app = Application.currentApplication()
app.includeStandardAdditions = true
const kmInstance = app.systemAttribute('KMINSTANCE')
const kme = Application('Keyboard Maestro Engine')
const helium = Application('Helium')
const windows = helium.windows().map((w) => [w.name(), w.tabs().map((t) => t.url())])
const theWindow = windows.filter(
([_name, tabs]) => tabs.filter((t) => t.startsWith('https://example.com/this/path/')).length
)
let theName
if (theWindow.length === 0) {
theName = null
} else {
theName = theWindow[0][0]
}
kme.setvariable('Local__TheWindow', { instance: kmInstance, to: theName })
// kmvar.Local__TheWindow = theName
followed by Bring Window Named “%Variable%Local__TheWindow%” to Front in Helium.
This produces the error
2026-07-27 14:54:38 Manipulate Window could not find any matching windows in macro “Activate Bug Tracker” (while executing Bring Window Named “%Variable%Local__TheWindow%” to Front).
It doesn’t look like the variable is being expanded, but if I insert a step to display %Variable%Local__TheWindow% in an alert, it shows the variable is being correctly set:
Edit > Insert Token > Variable shows all the variables greyed out when editing the window title. Does this field not allow variables? If it doesn’t, how can I bring a window to the front when its name is stored in a variable? If it does, why can’t Keyboard Maestro find the window?
If I use “the engine window with id” and replace w.name() with w.id() in the script, I have the same problem.
Is it permission-related, perhaps? KM has asked for permission to control Helium, but KME has not:
(Additional, bonus question: you’ll notice I try to set the variable using the modern syntax, but it’s commented out. This is because it doesn’t actually set the variable, despite appearing to correspond with that the wiki page says to do! If anybody can tell me what I should have put there, it’d be welcome
)

