m
Line 20: Line 20:
  
 
Curly brackets are not supported on very old versions like v5.20 and below, but it's recommended to use them when interacting with dictionaries/arrays, as square brackets can get confusing very quickly.
 
Curly brackets are not supported on very old versions like v5.20 and below, but it's recommended to use them when interacting with dictionaries/arrays, as square brackets can get confusing very quickly.
 
=== Magic Text Syntax ===
 
 
Magic text for dictionaries/arrays is written like this:
 
 
<pre style="background-color: #e9e9e9; border-radius: 5px; padding: 10px;">
 
{lv=dictionary/array name[entry][sub-entry]}
 
</pre>
 
 
There can be as many [sub-entry] as you like. Be aware that this can get complicated very quickly! Curly `{}` braces have been added so that users can easily see the beginning and end of a dictionary/array magic text.
 
 
 
</div>
 
 
 
 
{| class="wikitable" style="width:100%; text-align:left; border:none; background-color:#f2f2f2; border-radius: 10px; border: 1px solid #ddd;"
 
|-
 
! style="background-color:#1665B0; color:white; width:50%;" | Name
 
! style="background-color:#1665B0; color:white; width:50%;" | am/pm
 
|-
 
| Magic text      || {am_pm}
 
|-
 
| Description      || am or pm depending on the time.
 
|-
 
| Does it require a trigger? || No
 
|}
 
 
{| class="wikitable" style="width:100%; text-align:left; border:none; background-color:#f2f2f2; border-radius: 10px; border: 1px solid #ddd;"
 
|-
 
! style="background-color:#1665B0; color:white; width:50%;" | Name
 
! style="background-color:#1665B0; color:white; width:50%;" | Android version
 
|-
 
| Magic text      || {android_version}
 
|-
 
| Description      || Returns the number of the android version.
 
|-
 
| Does it require a trigger? || No
 
|}
 
 
{| class="wikitable" style="width:100%; text-align:left; border:none; background-color:#f2f2f2; border-radius: 10px; border: 1px solid #ddd;"
 
|-
 
! style="background-color:#1665B0; color:white; width:50%;" | Name
 
! style="background-color:#1665B0; color:white; width:50%;" | Android version (SDK level)
 
|-
 
| Magic text      || {android_version_sdk}
 
|-
 
| Description      || Returns the SDK level of the Android version. e.g. Android 15 has an SDK level of 35.
 
|-
 
| Does it require a trigger? || No
 
|}
 
 
{| class="wikitable" style="width:100%; text-align:left; border:none; background-color:#f2f2f2; border-radius: 10px; border: 1px solid #ddd;"
 
|-
 
! style="background-color:#1665B0; color:white; width:50%;" | Name
 
! style="background-color:#1665B0; color:white; width:50%;" | Battery current now (mA)
 
|-
 
| Magic text      || {battery_current_now}
 
|-
 
| Description      || Amount of electrical current flowing from the battery at this moment, measured in milliamps (mA).
 
|-
 
| Does it require a trigger? || No
 
|}
 
 
{| class="wikitable" style="width:100%; text-align:left; border:none; background-color:#f2f2f2; border-radius: 10px; border: 1px solid #ddd;"
 
|-
 
! style="background-color:#1665B0; color:white; width:50%;" | Name
 
! style="background-color:#1665B0; color:white; width:50%;" | Battery temp ºC
 
|-
 
| Magic text      || {battery_temp}
 
|-
 
| Description      || Temperature in degrees Celsius, e.g. 34°.
 
|}
 
 
{| class="wikitable" style="width:100%; text-align:left; border:none; background-color:#f2f2f2; border-radius: 10px; border: 1px solid #ddd;"
 
|-
 
! style="background-color:#1665B0; color:white; width:50%;" | Name
 
! style="background-color:#1665B0; color:white; width:50%;" | Cell connection type
 
|-
 
| Magic text      || {cell_connection}
 
|-
 
| Description      || Cell connection type, e.g. 3G, 4G, 5G.
 
|}
 
 
{| class="wikitable" style="width:100%; text-align:left; border:none; background-color:#f2f2f2; border-radius: 10px; border: 1px solid #ddd;"
 
|-
 
! style="background-color:#1665B0; color:white; width:50%;" | Name
 
! style="background-color:#1665B0; color:white; width:50%;" | Cell id
 
|-
 
| Magic text      || {cell_id}
 
|-
 
| Description      || Number that identifies an individual cell within a cellular network. Used for mobile phones to connect to the network and for the network to send data to mobile phones
 
e.g. The cell identifier for a cell in New York City could be 310-200-0000. The LAC (310-200)
 
|}
 
 
{| class="wikitable" style="width:100%; text-align:left; border:none; background-color:#f2f2f2; border-radius: 10px; border: 1px solid #ddd;"
 
|-
 
! style="background-color:#1665B0; color:white; width:50%;" | Name
 
! style="background-color:#1665B0; color:white; width:50%;" | Cell tower signal strength
 
|-
 
| Magic text      || {cell_signal_strength}
 
|-
 
| Description      || Returns the signal strength that your mobile device is receiving from the nearest cell tower. It is expressed in units called decibels-milliwatts (dBm), with -50 dBm being the strongest signal and -110 dBm being the weakest.
 
|}
 
 
{| class="wikitable" style="width:100%; text-align:left; border:none; background-color:#f2f2f2; border-radius: 10px; border: 1px solid #ddd;"
 
|-
 
! style="background-color:#1665B0; color:white; width:50%;" | Name
 
! style="background-color:#1665B0; color:white; width:50%;" | Clipboard text
 
|-
 
| Magic text      || {clipboard}
 
|-
 
| Description      || Retrieves the text from the clipboard.
 
If you are on Android 10+ you should have a look at the [https://macrodroidforum.com/wiki/index.php/Action:_Clipboard_Refresh Refresh Cliboard action].
 
|}
 
 
{| class="wikitable" style="width:100%; text-align:left; border:none; background-color:#f2f2f2; border-radius: 10px; border: 1px solid #ddd;"
 
|-
 
! style="background-color:#1665B0; color:white; width:50%;" | Name
 
! style="background-color:#1665B0; color:white; width:50%;" | Current battery %
 
|-
 
| Magic text      || {battery}
 
|-
 
| Description      || Information on the current battery charge percentage, e.g. 80%.
 
|-
 
| Does it require a trigger? || No
 
|}
 
 
{| class="wikitable" style="width:100%; text-align:left; border:none; background-color:#f2f2f2; border-radius: 10px; border: 1px solid #ddd;"
 
|-
 
! style="background-color:#1665B0; color:white; width:50%;" | Name
 
! style="background-color:#1665B0; color:white; width:50%;" | Current Brightness
 
|-
 
| Magic text      || {current_brightness}
 
|-
 
| Description      || Information on the current brightness, e.g. 100.
 
|-
 
| Does it require a trigger? || No
 
|}
 
 
{| class="wikitable" style="width:100%; text-align:left; border:none; background-color:#f2f2f2; border-radius: 10px; border: 1px solid #ddd;"
 
|-
 
! style="background-color:#1665B0; color:white; width:50%;" | Name
 
! style="background-color:#1665B0; color:white; width:50%;" | Current Brightness (alternative Android 9)
 
|-
 
| Magic text      || {current_brightness_alternative}
 
|-
 
| Description      || Information on the current brightness, e.g. 100.
 
|-
 
| Does it require a trigger? || No
 
|}
 
 
{| class="wikitable" style="width:100%; text-align:left; border:none; background-color:#f2f2f2; border-radius: 10px; border: 1px solid #ddd;"
 
|-
 
! style="background-color:#1665B0; color:white; width:50%;" | Name
 
! style="background-color:#1665B0; color:white; width:50%;" | Current IP address
 
|-
 
| Magic text      || {ip}
 
|-
 
| Description      || Current IP in 172.217.12.141 format (randomly generated IP).
 
|-
 
| Does it require a trigger? || No
 
|}
 
 
{| class="wikitable" style="width:100%; text-align:left; border:none; background-color:#f2f2f2; border-radius: 10px; border: 1px solid #ddd;"
 
|-
 
! style="background-color:#1665B0; color:white; width:50%;" | Name
 
! style="background-color:#1665B0; color:white; width:50%;" | Foreground app
 
|-
 
| Magic text      || {fg_app_name}
 
|-
 
| Description      || Name of the application in the foreground, for example, Macrodroid.
 
|-
 
| Does it require a trigger? || No
 
|}
 
 
{| class="wikitable" style="width:100%; text-align:left; border:none; background-color:#f2f2f2; border-radius: 10px; border: 1px solid #ddd;"
 
|-
 
! style="background-color:#1665B0; color:white; width:50%;" | Name
 
! style="background-color:#1665B0; color:white; width:50%;" | Foreground package
 
|-
 
| Magic text      || {fg_app_package}
 
|-
 
| Description      || Package of the application in the foreground, for example, com.arlosoft.macrodroid.
 
|-
 
| Does it require a trigger? || No
 
|}
 
 
{| class="wikitable" style="width:100%; text-align:left; border:none; background-color:#f2f2f2; border-radius: 10px; border: 1px solid #ddd;"
 
|-
 
! style="background-color:#1665B0; color:white; width:50%;" | Name
 
! style="background-color:#1665B0; color:white; width:50%;" | New Line
 
|-
 
| Magic text      || \n
 
|-
 
| Description      || (Does not require { } or [ ]). It is a special character that marks the end of a line of text and the beginning of a new line. It is used to organize text into a readable and easy-to-read format.
 
For example, Hello world, the output would look like this:
 
Hello
 
world.
 
|-
 
| Does it require a trigger? || No
 
|}
 
  
 
== Magic Text Overview ==
 
== Magic Text Overview ==

Revision as of 06:31, 30 November 2024

Magic Text Overview

Many triggers, actions, and constraints allow you to configure some text fields. Often, you will find a button next to the text input field that contains the "..." label. This button displays a complete list of "magic text" fields available in the context you are using.

If you want to type them manually instead, if you know them, be aware that there may be spelling/typing errors.

How Magic Text Works

The magic text allows a different value to be substituted at the point of call, instead of the standard static text that never changes. For example, it's possible to add an action that references a variable via magic text, and that variable's value will be substituted at the point the action is executed.

Magic Text Formats

Magic text can be written in two ways:

  • Curly braces: {value}
  • Square braces: [value]

Curly brackets are not supported on very old versions like v5.20 and below, but it's recommended to use them when interacting with dictionaries/arrays, as square brackets can get confusing very quickly.

Magic Text Overview

Many triggers, actions, and constraints allow you to configure some text fields. Often, you will find a button next to the text input field that contains the "..." label. This button displays a complete list of "magic text" fields available in the context you are using.

If you want to type them manually instead, if you know them, be aware that there may be spelling/typing errors.

How Magic Text Works

The magic text allows a different value to be substituted at the point of call, instead of the standard static text that never changes. For example, it's possible to add an action that references a variable via magic text, and that variable's value will be substituted at the point the action is executed.

Magic Text Formats

Magic text can be written in two ways:

  • Curly braces: {value}
  • Square braces: [value]

Curly brackets are not supported on very old versions like v5.20 and below, but it's recommended to use them when interacting with dictionaries/arrays, as square brackets can get confusing very quickly.

Magic Text Syntax

Magic text for dictionaries/arrays is written like this:

{lv=dictionary/array name[entry][sub-entry]}

There can be as many [sub-entry] as you like. Be aware that this can get complicated very quickly! Curly `{}` braces have been added so that users can easily see the beginning and end of a dictionary/array magic text.



Name am/pm
Magic text {am_pm}
Description am or pm depending on the time.
Does it require a trigger? No
Name Android version
Magic text {android_version}
Description Returns the number of the android version.
Does it require a trigger? No
Name Android version (SDK level)
Magic text {android_version_sdk}
Description Returns the SDK level of the Android version. e.g. Android 15 has an SDK level of 35.
Does it require a trigger? No
Name Battery current now (mA)
Magic text {battery_current_now}
Description Amount of electrical current flowing from the battery at this moment, measured in milliamps (mA).
Does it require a trigger? No
Name Battery temp ºC
Magic text {battery_temp}
Description Temperature in degrees Celsius, e.g. 34°.
Name Cell connection type
Magic text {cell_connection}
Description Cell connection type, e.g. 3G, 4G, 5G.
Name Cell id
Magic text {cell_id}
Description Number that identifies an individual cell within a cellular network. Used for mobile phones to connect to the network and for the network to send data to mobile phones

e.g. The cell identifier for a cell in New York City could be 310-200-0000. The LAC (310-200)

Name Cell tower signal strength
Magic text {cell_signal_strength}
Description Returns the signal strength that your mobile device is receiving from the nearest cell tower. It is expressed in units called decibels-milliwatts (dBm), with -50 dBm being the strongest signal and -110 dBm being the weakest.
Name Clipboard text
Magic text {clipboard}
Description Retrieves the text from the clipboard.

If you are on Android 10+ you should have a look at the Refresh Cliboard action.

Name Current battery %
Magic text {battery}
Description Information on the current battery charge percentage, e.g. 80%.
Does it require a trigger? No
Name Current Brightness
Magic text {current_brightness}
Description Information on the current brightness, e.g. 100.
Does it require a trigger? No
Name Current Brightness (alternative Android 9)
Magic text {current_brightness_alternative}
Description Information on the current brightness, e.g. 100.
Does it require a trigger? No
Name Current IP address
Magic text {ip}
Description Current IP in 172.217.12.141 format (randomly generated IP).
Does it require a trigger? No
Name Foreground app
Magic text {fg_app_name}
Description Name of the application in the foreground, for example, Macrodroid.
Does it require a trigger? No
Name Foreground package
Magic text {fg_app_package}
Description Package of the application in the foreground, for example, com.arlosoft.macrodroid.
Does it require a trigger? No
Name New Line
Magic text \n
Description (Does not require { } or [ ]). It is a special character that marks the end of a line of text and the beginning of a new line. It is used to organize text into a readable and easy-to-read format.

For example, Hello world, the output would look like this: Hello world.

Does it require a trigger? No