Creating a Toybox dictionary

Henry Puppet

New member
As a beginner, I've struggled a bit to understand dictionaries and arrays so I decided to write myself a macro that creates one of each from scratch and explain what I'm doing step by step.
The result is a dictionary of Toybox commands along with usage information retrieved via the help command for each command.
I thought perhaps this might be useful for others wanting to learn how to create and use an array or dictionary or maybe just curious about Toybox commands. The macro does the following:

▫️Gets a list of available Toybox commands on your device
▫️Creates an array of the commands
▫️Creates a dictionary of commands where the name of the command is a key and the value is the usage information returned by 'command --help'.

If you're interested in how to create and use a dictionary or an array, there are no doubt more advanced examples around. This macro was designed to be simple and (I hope) clear for beginners like myself.

The macro does not execute any Toybox commands other than requests for help plus the general 'toybox' command to get a list of commands.

BE CAREFUL USING TOYBOX COMMANDS AS THEY CAN AFFECT SYSTEM SETTINGS AND POSSIBLY BRICK YOUR DEVICE.

I hope you find the macro useful and I welcome any suggestion for improvement. 🙂

Link to macro in the MacroDroid store
 

Henry Puppet

New member
I think you can modify and update macros.
Do not upload your changes as a new macro.
I
I think you can modify and update macros.
Do not upload your changes as a new macro.
When I tried to upload the macro after making a couple changes, it wouldn't let me upload.I got a message telling me that the template already existed so I deleted the existing one. How do I upload a modified macro?
 

Dimlos

Well-known member
  1. Display the macro you want to update in the template after you have finished editing the macro.
  2. Tap the arrow in the lower right corner to expand it.
  3. Tap the 3-point reader in the lower right corner and select Edit macro.
  4. Tap OK.
  5. Tap UPDATE TEMPLATE.
 

Henry Puppet

New member
  1. Display the macro you want to update in the template after you have finished editing the macro.
  2. Tap the arrow in the lower right corner to expand it.
  3. Tap the 3-point reader in the lower right corner and select Edit macro.
  4. Tap OK.
  5. Tap UPDATE TEMPLATE.
Thank you. I'll do that from now on. 🙂
 
Top