Can BTT check menus?

@Andreas_Hegenberg
Every app has menu items that are activated or not under certain circumstances. An example with BTT is this.

Is there a way that BTT can check whether the menu item “Einfügen und Stil anpassen” can be selected or not?

I have not found anything in the Advanced Conditions. Maybe I have overlooked it.

In any case, you could do crazy things with it :joy: and also less crazy things. :slightly_smiling_face:

Thanks!

advanced conditions can not be used for this, you'd need to use a script:

async function checkMenuItem() {
    let menuItemDetailsString =   await get_menu_item_details("Bearbeiten;Einfügen und Stil anpassen");
    let menuItemDetails = JSON.parse(menuItemDetailsString);

    return menuItemDetails.enabled;
}

1 Like

Perfect thank you very much, I will try it out :slightly_smiling_face:

The script works perfectly! Sometimes it is better to determine the availability of a menu item than the name of a field. Thanks again :slightly_smiling_face:

Just for completeness, this scripting function allows 3 things to be checked depending on what property you return:

1.) Check if a menu item is enabled:

    return menuItemDetails.enabled;

2.) Check if a menu item is available, regardless of enabled or disabled:

    return menuItemDetails.available;

3.) Check if a menu item has a checkmark:

    return menuItemDetails.checked;
  1. is also very useful, thank you. 2) I do not understand. Are there menu items that can disappear completely? Or do you mean menu items that only become visible by pressing a modifier?

yes, for example some app might have that menu item and some other app might not have it

(e.g. to determine whether an app supports text formatting you could check whether the "paste and match style" menu item is available because plain text apps don't have that)

1 Like

Mm, you can really use that in a very targeted way. Have you posted this script before, or am I the only one who thinks it's clever because it's not really clever at all? :thinking:

It has been requested multiple times here in the forum and has been added to BTT in March 2024 :wink:

Good, then it's like hot water. At some point, I discovered that it exists. But it was actually invented long before that. :innocent:

1 Like

Maybe it was you who requested it and forgot about it by now? :sweat_smile: