Fully configurable MENU...

Dm114

Well-known member
These 2 macros allow creation and management of a fully configurable MENU: one for updating and customizing it (called MenuUpdt), the other one for everyday use of this MENU (called Menu).

The MENU is based on a simple unique 2-level dictionary (global variable) where the 1st level contains the name of every submenu and the 2nd level contains every line of each submenu (the main menu name -1st entry- is 0 and it must not be changed).

Structure and syntax of 2nd level elements:
• Key=[Sort number][Action ID]>[String] where
- [Sort number] is a 2-digit number to allow menu items ordering
- [Action ID] 1 character or a number (see below)
- ">" separator character (mandatory)
- [String] is the text to be executed according to alphabetical Action IDs (package, submenu or macro name, URL...)
• Value (string type)=text displayed on the menu window (can contain any character or emoji)

Every [Action ID] is case INsensitive except R and r (see below) and defines what MD action to run:
1 to n→referring to a short internal MD code in this macro (to avoid storing and calling very short and simple macros)
L→Launch external application
M→display a subMenu
R→Run macro even if disabled
r→Run macro only if enabled
T→Toggle a macro
W→Web site (open)
Other Actions could be easily added on demand...

⚠️ [String] is mandatory with alphabetical Action IDs and forbidden with numerical ones.

MENU 2-level dictionary structure:
Code:
+--0
|  +--0→Exit
|  +--Key #1→Value #1
|  :
|  +--Key #n→Value #n
|
+--Submenu #1
|  +--0→Back to main Menu
|  +--Key #1→Value #1
|  :
|  +--Key #n→Value #n
:
+--Submenu #n
   +--0→Back to main Menu
   +--Key #1→Value #1
   :
   +--Key #n→Value #n

where:
Key=[Sort number][Action ID]>[String]

ℹ️ For better readability, I personally chose to precede the text of each menu item (Value field, see above) with one or more emojis to visually symbolize as follows the function described by the text:
- submenu items look like this: "🗂️→" followed by an emoji symbolizing the general content of the submenu and then its name, e.g. "🗂️⚙️ System..." (to open System submenu)
- other functions (non-submenu) look like this: "⌨️ MacroDroid homepage" (to open MacroDroid homepage) or "🎭 Firefox private window"...

As I use the macro Menu every day, it runs flawlessly on my side.

The other one, MenuUpdt, is much more tricky and may have some issues I haven't found yet... Don't hesitate to report such issues. Thanks in advance.

Macro Menu to load and run first (to initiate MENU global dictionary with some given items). It is called "Menu_" in the Template Store due to 5-char min for macro names and has to be renamed to "Menu" (without "_") on your device:

Macro MenuUpdt:

Screenshot of the current main menu below:
20240229_153555.jpg
 

Dm114

Well-known member
I call Menu macro from Bar button, MD drawer and homepage shortcut.

To avoid loading MenuUpdt in memory (as it must not be called any time) it is disabled and run via the menu (with "R" Action type).
 

JoeReMi

Member
Hi! This looks really cool with lots of functionalities, great job! However these two actions appear to be invalid, even when viewing the Macro in the template store. Do you know what might be going on here?

1713283165274.png
 

Dm114

Well-known member
Hi! This looks really cool with lots of functionalities, great job! However these two actions appear to be invalid, even when viewing the Macro in the template store. Do you know what might be going on here?

View attachment 9426
Really weird as it is a very simple MD action. 🤔

Did you try to "re-Configure" these actions just to force editor to set this action (be careful not to modify parameters when validating).
 

JoeReMi

Member
Really weird as it is a very simple MD action. 🤔

Did you try to "re-Configure" these actions just to force editor to set this action (be careful not to modify parameters when validating).
Just tried, the actions are still invalid. Also good to mention: Removing these actions and attempting to add an action with the same settings in their place does not work. The actions do not appear.

This is happening on two of my devices ._.

edit: Will do some more testing to verify if that's actually the case. I take it this is not happening on your end?
 
Last edited:

Dm114

Well-known member
Just tried, the actions are still invalid. Also good to mention: Removing these actions and attempting to add an action with the same settings in their place does not work. The actions do not appear.

This is happening on two of my devices ._.

edit: Will do some more testing to verify if that's actually the case. I take it this is not happening on your end?
What MD version are you running?

Try to create this action from scratch in a new macro If it runs copy/paste it to the MENU macro. But this behavior is really surprising... 🤔🤔
 

JoeReMi

Member
What MD version are you running?

Try to create this action from scratch in a new macro If it runs copy/paste it to the MENU macro. But this behavior is really surprising... 🤔🤔
The action is not marked as invalid any more, so it seems to have worked. Thank you!

Question about the MenuUpdt macro: Its first option dialog does not seem to do anything (the buttons are off). What should I set these to?
 

Dm114

Well-known member
The action is not marked as invalid any more, so it seems to have worked. Thank you!

Question about the MenuUpdt macro: Its first option dialog does not seem to do anything (the buttons are off). What should I set these to?
Are you speaking about the one attached (below)?
20240417_163048.jpg
If so, it uses an array/dictionary called NewMENU
 

Dm114

Well-known member
The action is not marked as invalid any more, so it seems to have worked. Thank you!

Question about the MenuUpdt macro: Its first option dialog does not seem to do anything (the buttons are off). What should I set these to?
Sorry, I misread your question.
Is it this one?
20240417_163520.jpg
Hope it looks like this because sometimes, for some mysterious reasons, options disappear... 🤔

Anyway does everything runs flawlessly?

Hope so: I personally use the same version at the one you downloaded and it runs nicely in my side.
 

JoeReMi

Member
Yes, it's that one. The OptionDialog action block was not preselected on my end.

Can you tell me how to configure the input/output parameters?
 

Attachments

  • Screenshot_20240418-104759.png
    Screenshot_20240418-104759.png
    61.6 KB · Views: 3

Dm114

Well-known member
Yes, it's that one. The OptionDialog action block was not preselected on my end.

Can you tell me how to configure the input/output parameters?
I'm really sorry: this bug sometimes happens but @MacroDroidDev couldn't solve it yet! ☹️

As shown in my previous screenshot, you already have the content of this Option Dialog. Here are below the parameters to call the Action Blocks.
20240418_084449.jpg
They are all identical except the capital letter to provide to StringToReturn as follows:
• U (for Update) for the left button
• S (for Select) for the center button
• A (for Add) for the right button
Nothing to deal with "United States of America" 😉😀

Let's hope there's no other mess in some other Option Dialogs. 🤔

Good luck!
 
Top