"Did Open URL" does not work if url is opened from within BTT/named trigger

I have an action "Show / Choose From List (Configurable)" action with "Retrieve Content Dynamically via Java Script / JSON". The script is like:

async function retrieveJSON() {
    let items = [
        {
            "title": “1111111 |  Sandbox | 11111”,
            "action": {
                "named": "open_aws_bookmark",
                "setvariable": {
                    "name": "custom_aws_sso_link",
                    "value": "https://myapps.microsoft.com/signin/11111111_AWS_APP"
                }
            }
        },
        {
            "title": “2222222 | Non-Production | 3216",
            "action": {
                "named": "open_aws_bookmark",
                "setvariable": {
                    "name": "custom_aws_sso_link",
                    "value": "https://myapps.microsoft.com/signin/22222222_AWS_APP"
                }
            }
        },
    ];
    return JSON.stringify(items);
}

The named trigger which is executed:

[
  {
    "BTTActionCategory" : 0,
    "BTTLastUpdatedAt" : 1748627332.250819,
    "BTTTriggerType" : 643,
    "BTTTriggerTypeDescriptionReadOnly" : "Named Trigger: open_aws_bookmark",
    "BTTTriggerTypeDescription" : "open_aws_bookmark",
    "BTTTriggerClass" : "BTTTriggerTypeOtherTriggers",
    "BTTUUID" : "D4217E28-43B9-4466-B31C-3CFBDE9A0A67",
    "BTTPredefinedActionType" : 366,
    "BTTPredefinedActionName" : "Empty Placeholder",
    "BTTTriggerName" : "open_aws_bookmark",
    "BTTNotesInsteadOfDescription" : 1,
    "BTTEnabled" : 1,
    "BTTEnabled2" : 1,
    "BTTOrder" : 15,
    "BTTAdditionalActions" : [
      {
        "BTTActionCategory" : 0,
        "BTTLastUpdatedAt" : 1748627304.185436,
        "BTTTriggerParentUUID" : "D4217E28-43B9-4466-B31C-3CFBDE9A0A67",
        "BTTIsPureAction" : true,
        "BTTTriggerClass" : "BTTTriggerTypeOtherTriggers",
        "BTTUUID" : "8EDC7B73-A696-4583-8774-CD26AA1B7608",
        "BTTPredefinedActionType" : 59,
        "BTTPredefinedActionName" : "Open URL  or  Open URL With Selection",
        "BTTOpenURL" : "{custom_aws_sso_link}",
        "BTTOpenURLBrowser" : "Default",
        "BTTEnabled" : 1,
        "BTTEnabled2" : 1,
        "BTTOrder" : 1
      }
    ],
    "BTTIconData" : "",
    "BTTGestureNotes" : "open_aws_bookmark"
  }
]

All of this is working fine, however I have automation to detect if specific URL has been opened:

[
  {
    "BTTActionCategory" : 0,
    "BTTLastUpdatedAt" : 1748637146.7386088,
    "BTTTriggerType" : 682,
    "BTTTriggerTypeDescriptionReadOnly" : "Did Open: https:\/\/myapps.microsoft.com\/signin\/*",
    "BTTTriggerTypeDescription" : "Detect if AWS SSO link is opened. The variable set in the script is then used in floating menu. This work BTT have to be a default browser. ",
    "BTTTriggerClass" : "BTTTriggerTypeOtherTriggers",
    "BTTUUID" : "8B6DD1E5-F3E2-4BB1-B1FF-011C89B8975E",
    "BTTPredefinedActionType" : 366,
    "BTTPredefinedActionName" : "Empty Placeholder",
    "BTTDidOpenURLAdress" : "https:\/\/myapps.microsoft.com\/signin\/*",
    "BTTAdditionalConfiguration" : "https:\/\/myapps.microsoft.com\/signin\/*",
    "BTTNotesInsteadOfDescription" : 1,
    "BTTEnabled" : 1,
    "BTTEnabled2" : 1,
    "BTTOrder" : 5,
    "BTTAdditionalActions" : [
      {
        "BTTActionCategory" : 0,
        "BTTLastUpdatedAt" : 1731676204.0622339,
        "BTTTriggerParentUUID" : "8B6DD1E5-F3E2-4BB1-B1FF-011C89B8975E",
        "BTTIsPureAction" : true,
        "BTTTriggerClass" : "BTTTriggerTypeOtherTriggers",
        "BTTUUID" : "8995DA6D-DDE9-4AE8-9E9A-EDE311E71111",
        "BTTPredefinedActionType" : 59,
        "BTTPredefinedActionName" : "Open URL  or  Open URL With Selection",
        "BTTOpenURL" : "{BTT_OPENED_URL}",
        "BTTOpenURLBrowser" : "Default",
        "BTTEnabled" : 1,
        "BTTEnabled2" : 1,
        "BTTOrder" : 0
      },
      {
        "BTTActionCategory" : 0,
        "BTTLastUpdatedAt" : 1748637158.5114899,
        "BTTTriggerParentUUID" : "8B6DD1E5-F3E2-4BB1-B1FF-011C89B8975E",
        "BTTIsPureAction" : true,
        "BTTTriggerClass" : "BTTTriggerTypeOtherTriggers",
        "BTTUUID" : "9BD579EA-FD39-48D6-ACB9-FAF81CA600FD",
        "BTTPredefinedActionType" : 172,
        "BTTPredefinedActionName" : "Run Apple Script (blocking)",
        "BTTAdditionalActionData" : {
          "BTTAppleScriptRunInBackground" : false,
          "BTTScriptType" : 0,
          "BTTAppleScriptString" : "-- Get the BTT_OPENED_URL variable. This is possible because BTT is default browser and also links are opened via Alfred\nset theURL to get_string_variable \"BTT_OPENED_URL\"\n\n-- Use text item delimiters to split the string. This will work only if in the URL account_id is present\nset AppleScript's text item delimiters to \"_\"\nset urlParts to text items of theURL\n\n-- Extract only account_id. This will work only if in the URL account_id is present\nset extractedValue to item 2 of urlParts\n\nset_persistent_string_variable \"custom_var_account_id\" to extractedValue\n\nset_persistent_string_variable \"custom_var_account_id_url\" to get_string_variable \"BTT_OPENED_URL\"\n\n",
          "BTTScriptExternalPath" : "\/Users\/myuser\/Library\/CloudStorage\/OneDrive\/Documents\/btt\/scripts\/aws_account_id_extract",
          "SelectedAction" : 172,
          "changedFile" : "4D6A38DA-DE75-4878-9D25-E41EA72E1298",
          "BTTAppleScriptUsePath" : false,
          "BTTScriptLocation" : 3
        },
        "BTTInlineAppleScript" : "-- Get the BTT_OPENED_URL variable. This is possible because BTT is default browser and also links are opened via Alfred\nset theURL to get_string_variable \"BTT_OPENED_URL\"\n\n-- Use text item delimiters to split the string. This will work only if in the URL account_id is present\nset AppleScript's text item delimiters to \"_\"\nset urlParts to text items of theURL\n\n-- Extract only account_id. This will work only if in the URL account_id is present\nset extractedValue to item 2 of urlParts\n\nset_persistent_string_variable \"custom_var_account_id\" to extractedValue\n\nset_persistent_string_variable \"custom_var_account_id_url\" to get_string_variable \"BTT_OPENED_URL\"\n\n",
        "BTTEnabled" : 1,
        "BTTEnabled2" : 1,
        "BTTOrder" : 1
      },
      {
        "BTTActionCategory" : 0,
        "BTTLastUpdatedAt" : 1732020880.779737,
        "BTTTriggerParentUUID" : "8B6DD1E5-F3E2-4BB1-B1FF-011C89B8975E",
        "BTTIsPureAction" : true,
        "BTTTriggerClass" : "BTTTriggerTypeOtherTriggers",
        "BTTUUID" : "BEB2F770-6550-4AA8-BFA8-71E47ADF39AC",
        "BTTPredefinedActionType" : 172,
        "BTTPredefinedActionName" : "Run Apple Script (blocking)",
        "BTTAdditionalActionData" : {
          "BTTTouchBarAppleScriptUsePath" : false,
          "BTTAppleScriptRunInBackground" : false,
          "BTTScriptType" : 0,
          "BTTAppleScriptString" : "-- used to calculate how much time have elapsed since the URL was opened. This is then used in FirstFloatingMenu\/AWS Login time item\nset currentTime to (current date)\rset timeString to time string of currentTime\r\rtell application \"BetterTouchTool\"\r\tset_persistent_string_variable \"custom_var_current_time\" to timeString\rend tell",
          "BTTScriptExternalPath" : "\/Users\/myuser\/Library\/CloudStorage\/OneDrive\/Documents\/btt\/scripts\/login_time_aws",
          "SelectedAction" : 195,
          "changedFile" : "9A4C70EF-3E1B-45E4-8741-552BF0030028",
          "BTTAppleScriptUsePath" : false,
          "BTTScriptLocation" : 2
        },
        "BTTInlineAppleScript" : "-- used to calculate how much time have elapsed since the URL was opened. This is then used in FirstFloatingMenu\/AWS Login time item\nset currentTime to (current date)\rset timeString to time string of currentTime\r\rtell application \"BetterTouchTool\"\r\tset_persistent_string_variable \"custom_var_current_time\" to timeString\rend tell",
        "BTTEnabled" : 1,
        "BTTEnabled2" : 1,
        "BTTOrder" : 7
      },
      {
        "BTTActionCategory" : 0,
        "BTTLastUpdatedAt" : 1732021037.9246368,
        "BTTTriggerParentUUID" : "8B6DD1E5-F3E2-4BB1-B1FF-011C89B8975E",
        "BTTIsPureAction" : true,
        "BTTTriggerClass" : "BTTTriggerTypeOtherTriggers",
        "BTTUUID" : "7A0187A8-86C5-4E2D-B2D8-B7E2E54E2C17",
        "BTTPredefinedActionType" : 292,
        "BTTPredefinedActionName" : "Assign or Set Value for Variable",
        "BTTVariableType" : 1,
        "BTTVariableName" : "custom_var_aws_timeout",
        "BTTVariableValue" : "60",
        "BTTEnabled" : 1,
        "BTTEnabled2" : 0,
        "BTTOrder" : 8
      }
    ],
    "BTTGestureNotes" : "Detect if AWS SSO link is opened. The variable set in the script is then used in floating menu. This to work, BTT have to be a default browser. "
  }
]

and as you can see in the js, the value for each item in the list is URL is starting exactly with "https://myapps.microsoft.com/signin/".
However it seems that this automation is not triggered (not shown in "Recently used" as well) if I select an item from the list which will trigger the named trigger which is opening the URL :smiley: .

The same automation is working if the URLs are opened from Alfred.

Additionally however I've just noticed something strange - I think that the "BTT_OPENED_URL" variable's value is not correctly shown in the "Variables & Scripting", but otherwise it is working as expected, since I'm using it in a script and also the 1st action (you can see it in the screenshot) in the automation itself is to "Open URL" and the value used is "{BTT_OPENED_URL}"

this trigger "Did Open URL" will only work if url's are opened from other apps with BTT, but in this case urls are opened from/by BTT. I could probably add support for this, but need to make sure it can't cause weird recursions.

Nice, thank you. Do you have any idea about the other issue - why the "{BTT_OPENED_URL}" variable is not showing the correct opened URL from Alfred ?

yes, it was still using BTT's old variable update mechanism that didn't update the scripting view. Will be fixed with next alpha. Closing & reopening the scripting view should probably also work to refresh