async function someJavaScriptFunction() {
let apps = await BTTActions.copyLaunchedApplicationsInFrontToBackOrder();
let appsString = JSON.stringify(apps);
await set_string_variable({variableName: "something", to: appsString});
}
However that array can be huge. You should probably filter it for your needs before saving it to a variable.
It's true that the array I get is a little bit crazy. I would prefer to have a new advanced condition with the list of foreground apps, if it's feasable.
What I am trying to achieve is:
know when there is only one app in foreground (Finder)
know when four apps (Finder,Totalmix,Cubase,Pages) are running without any other app running
@Andreas_Hegenberg your method copyLaunchedApplicationsInFrontToBackOrder is quite fast. I'd like to retrieve the same info in a thrid party app outside of BTT, but with AppleScript it is far slower (when trying to get all fields of apps and windows). Can you explain how you do it behind the scene? AppleScript? Swift?