Test

Revision as of 17:31, 30 November 2024 by JosueGd (talk | contribs) (→‎Magic Text Syntax)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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 Application name
Magic text {app_name}
Description Gets the name of the application that was opened or closed according to the context.
Does it require a trigger? Yes, it requires an Application Launched/Closed trigger to be present.
Name Application package
Magic text {app_package}
Description Gets the name of the application that was opened or closed according to the context.
Does it require a trigger? Yes, it requires an Application Launched/Closed trigger to be present.
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°.
Does it require a trigger? No
Name Bluetooth device name
Magic text {bluetooth_device_name}
Description Returns the name of the bluetooth device, may be more useful when using the "Any device" option.

For example, if headphones are connected, it will return the device name. {bluetooth_device_name} = Headphones 1 Pro

Does it require a trigger? Requires a Bluetooth trigger (device connected or device disconnected) to be present.
Name Cell connection type
Magic text {cell_connection}
Description Cell connection type, e.g. 3G, 4G, 5G.
Does it require a trigger? No
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)

Does it require a trigger? No
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.
Does it require a trigger? No
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.

Does it require a trigger? No
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
Name Application Launched/Closed
Magic text {app_name}
Gets the name of the application that was opened or closed according to the context.
Does it require a trigger? Yes, it requires an Application Launched/Closed trigger to be present.