Help with variables

agkbos42

New member
Can anyone post examples of macros they use that contain variables so I can see how to use correctly, its been a tough concept for me and seeing examples would go a long way in understanding how to use them
 

Endercraft

Moderator (& bug finder :D)
Simple macro I made a while ago.
Call_ringer.png
You can also use the attached .macro file.

In this example the variable is set to thevringer volume. It's here to restore the original volume after the call as the volume is modified.
 

Attachments

  • Call_ringer.macro
    4.5 KB · Views: 5

Dm114

Well-known member
Simple macro I made a while ago.
View attachment 6463
You can also use the attached .macro file.

In this example the variable is set to thevringer volume. It's here to restore the original volume after the call as the volume is modified.
I guess you wrote this macro a long time ago because you now know that it's not possible to modify ringer volume while a call is incoming... 😉

The volume change will be effective for next calls.
 

Dm114

Well-known member
Can anyone post examples of macros they use that contain variables so I can see how to use correctly, its been a tough concept for me and seeing examples would go a long way in understanding how to use them
You should have a look to MD Wiki to get more familiar with MacroDroid.
 

Endercraft

Moderator (& bug finder :D)
I guess you wrote this macro a long time ago because you now know that it's not possible to modify ringer volume while a call is incoming... 😉

The volume change will be effective for next calls.
I just tested to confirm and it did seems to work as intended, the volume definitely went up....
 

Dm114

Well-known member
I just tested to confirm and it did seems to work as intended, the volume definitely went up....
That's amazing! As far as I remember, Jamie himself confirmed that in some recent posts.

Anyway apart from volume, it's not possible to change ringtone while a call is incoming. I'll check on my side for volume a bit later...
 

dhj49er

Well-known member
Can anyone post examples of macros they use that contain variables so I can see how to use correctly, its been a tough concept for me and seeing examples would go a long way in understanding how to use them
Here is another example of using variables.

In the screenshot

The BTCycle is a Boolean variable - true when my BT cycle computer is connected and false when it's disconnected.

I use this type of variable extensively, as it's extremely easy to use for constraints as shown in the screenshot.

The BT Cycle is a string variable.

I recommend that you work out a strategy for naming global variables, as the number of global variables can increase significantly.

For example, I try to make the name self defining and try to start the variable name with the function of the macro.

That way it makes it easier to find a specific variable in the list, especially useful as the number of global variables increases.

In the screenshot all the variables start with BT as the macro is a Bluetooth macro.

Similarly all my WiFi related macros use global macros starting with WiFi eg WiFiConnected, WiFiCalling.

Don't worry if you decide to change a global variable name - it can be done easily from the variable list and MD will change every occurrence of the variable in your macros for you automatically.
 

Attachments

  • Screenshot_20230824_201128_MacroDroid.jpg
    Screenshot_20230824_201128_MacroDroid.jpg
    450.5 KB · Views: 19
Top