Application Indicator Functions
Application Indicator functions let you update the active state of customizable indicators that are part of the Buttons & Indicators module. These AeroScript functions run on the Automation1-iSMC. But they are handled through a connected Automation1-MDK application known as Automation1 MachineApps. Before you use these functions, you must connect an Automation1 MachineApps application that registers for this callback to the controller. If a MachineApp uses the Buttons & Indicators module with a button or indicator that you can control with AeroScript, it automatically registers for the necessary callbacks. To see if a MachineApp is registered to handle those callbacks, use the example program that follows.
Program Example
// Returns true if a MachineApp is registered to handle
// the callbacks used by the Buttons & Indicators module.
// You can use this to see if a MachineApp with a button
// or an indicator that you can control through AeroScript is open.
var $isRegisteredByAMachineApp as integer
$isRegisteredByAMachineApp = AppButtonSetStateIsRegistered() ||
AppIndicatorOnIsRegistered() || AppIndicatorOffIsRegistered()
AppIndicatorOn()
Use the AppIndicatorOn()
function to turn on all indicators with the specified ID or name. You can specify the display text, animation, animation cycle duration, foreground color, and background color for the indicator. Before you use this function, you can use the AppIndicatorOnIsRegistered()
function to see if it is registered with an Automation1 Studio, Automation1 MachineApps, or a custom .NET application.
function AppIndicatorOn($indicatorId as integer, $displayText as string, $animationType as IndicatorAnimationType, $backgroundColor1 as string, $foregroundColor1 as string, $backgroundColor2 as string, $foregroundColor2 as string, $duration as integer)
Turns the specified indicator on. This function must have a connected Automation1 Studio, Automation1 MachineApps, or a custom .NET application that registers to handle it. If there is not an application connected to your controller that can handle this function, an error will occur. If you need to do a check, call the AppIndicatorOnIsRegistered() function.
Arguments
$indicatorId The ID of the indicator to turn on.
$displayText The text to display on the indicator.
$animationType The animation to display on the indicator.
$backgroundColor1 The first background color to show on the indicator.
$foregroundColor1 The first foreground color to show on the indicator.
$backgroundColor2 The second background color to show on the indicator. This color is only used for certain values of $animationType.
$foregroundColor2 The second foreground color to show on the indicator. This color is only used for certain values of $animationType.
$duration The duration in milliseconds for each color displayed.
function AppIndicatorOn($indicatorName as string, $displayText as string, $animationType as IndicatorAnimationType, $backgroundColor1 as string, $foregroundColor1 as string, $backgroundColor2 as string, $foregroundColor2 as string, $duration as integer)
Turns the specified indicator on. This function must have a connected Automation1 Studio, Automation1 MachineApps, or a custom .NET application that registers to handle it. If there is not an application connected to your controller that can handle this function, an error will occur. If you need to do a check, call the AppIndicatorOnIsRegistered() function.
Arguments
$indicatorName The name of the indicator to turn on.
$displayText The text to display on the indicator.
$animationType The animation to display on the indicator.
$backgroundColor1 The first background color to show on the indicator.
$foregroundColor1 The first foreground color to show on the indicator.
$backgroundColor2 The second background color to show on the indicator. This color is only used for certain values of $animationType.
$foregroundColor2 The second foreground color to show on the indicator. This color is only used for certain values of $animationType.
$duration The duration in milliseconds for each color displayed.
For the animation type, refer to the descriptions that follow:
- Solid displays the indicator background as the $backgroundColor1 color and the $displayText as the $foregroundColor1 color.
- Flash cycles between two display states - the indicator background as the $backgroundColor1 color for the $duration in milliseconds and the indicator background as transparent for the $duration in milliseconds. The $displayText is displayed as the $foregroundColor1 color for both cycles.
- Two Color Flash cycles between two display states - the indicator background as the $backgroundColor1 color with the $displayText as the $foregroundColor1 for the $duration in milliseconds and the indicator background as the $backgroundColor2 color with the $displayText is as the $foregroundColor2 for the $duration in milliseconds.
- Color Sweep cycles between two display states - the indicator background as the $backgroundColor1 color with the $displayText as the $foregroundColor1 for the $duration in milliseconds and the indicator background as the $backgroundColor2 color with the $displayText is as the $foregroundColor2 for the $duration in milliseconds. This animation gradually transitions between the two colors.
All colors can be specified in one of the formats that follow:
- A hexadecimal string formatted as #RRGGBB. The first two characters are the red channel value, the next two characters are the green channel value, and the final two characters are the blue channel value.
- A hexadecimal string formatted as #RRGGBBAA. The first two characters are the red channel value, the next two characters are the green channel value, the next two characters are the blue channel value, and the final characters are the alpha channel value.
- As a predefined string with one of the values listed in the chart that follows. For more information, see Microsoft's Colors Class reference.
function AppIndicatorOnIsRegistered() as integer
Returns if the AppIndicatorOn() function is registered by an application.
Returns
If the function is registered by an application, returns 1. Otherwise, returns 0.
AppIndicatorOff()
Use the AppIndicatorOff()
function to turn off all indicators with the specified ID or name. Before you use this function, you can use the AppIndicatorOffIsRegistered()
function to see if it is registered with an Automation1 Studio, Automation1 MachineApps, or a custom .NET application.
function AppIndicatorOff($indicatorId as integer)
Turns the specified indicator off. This function must have a connected Automation1 Studio, Automation1 MachineApps, or a custom .NET application that registers to handle it. If there is not an application connected to your controller that can handle this function, an error will occur. If you need to do a check, call the AppIndicatorOffIsRegistered() function.
Arguments
$indicatorId The ID of the indicator to turn off.
function AppIndicatorOff($indicatorName as string)
Turns the specified indicator off. This function must have a connected Automation1 Studio, Automation1 MachineApps, or a custom .NET application that registers to handle it. If there is not an application connected to your controller that can handle this function, an error will occur. If you need to do a check, call the AppIndicatorOffIsRegistered() function.
Arguments
$indicatorName The name of the indicator to turn off.
function AppIndicatorOffIsRegistered() as integer
Returns if the AppIndicatorOff() function is registered by an application.
Returns
If the function is registered by an application, returns 1. Otherwise, returns 0.
Program Example
// Turn on an indicator by ID with a solid background.
AppIndicatorOn(0, "ON", IndicatorAnimationType.Solid, "limegreen", "#ffffff", "", "", 0)
// Use a variable to store a core value.
var $orange as string = "orange"
// Turn on an indicator by name with an animation that uses predefined color options.
AppIndicatorOn("Indicator1", "WARNING", IndicatorAnimationType.ColorSweep, "gold", $orange, "yellow", $orange, 750)
// Turn on an indicator with an animation that uses hexadecimal values.
AppIndicatorOn(2, "LOADING", IndicatorAnimationType.Flash, "#98b9d6", "#5d6163ff", "", "", 500)
// Turn off an indicator.
AppIndicatorOff(3)