Allow usage of variables in custom open command of "Open URL" action

Current Situation

MacOS Sonoma finally allows creating progressive web apps with Safari. I can save any web app to the Doc using the menu item "File > Add to Dock".

I've made me a BTT trigger that fires when I click on a link to a Jira ticket in Notion. With this trigger, when I click a link in Notion, the URL opens in the Jira web app instead of Safari, which is what I want.

I'm using the trigger "Did Open URL" to trigger an "Open URL" action.

In the URL field, I entered {BTT_OPENED_URL}.

In the "Use Browser" dropdown, I selected "Custom Open Command".

In the text field for the open command, I've entered:

/usr/bin/open -b {url}

The string ist the "browser", i.e. the Jira web app I've created when I saved the Jira page to the dock.

Like I said, this works like a charm.

Feature Request

I stored the string in a persistent variable PWA_ID_JIRA to use in my action.

I've tried it like this:

/usr/bin/open -b {PWA_ID_JIRA} {url}

…but this does not work, unfortunately. It seems that currently, in the custom open command, only the variable {url} is resolved.

Please make it so that any temporary or persistent variable can be used here.

I think you could use the "Run Real Java Script" action and have a script like this:

async function someJavaScriptFunction() {
	let openedURL = get_string_variable("BTT_OPENED_URL");
	let jiraID = get_string_variable("PWA_ID_JIRA");

	let scriptResult = await runShellScript({
    	script: `/usr/bin/open -b ${jiraID} ${openedURL}`

	return  `executed command: /usr/bin/open -b ${jiraID} ${openedURL}`;

Hi Andreas, thanks for the quick reply!

I've modified your script (await was missing on the BTT API calls):

async function openInPwa() {
	const openedUrl = await get_string_variable("BTT_OPENED_URL");
	const pwaId = await get_string_variable("PWA_ID_JIRA");

	return await runShellScript({
    	script: `/usr/bin/open -b ${pwaId} ${openedUrl}`

Works like a charm! :+1:t2:

Ah sorry you are right! Glad you noticed :slight_smile:

1 Like