Application Button Functions

Application button functions let you update the active state of customizable buttons 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()

Set a Button State

Use the AppButtonSetState() function to set all buttons with the specified ID or name to the specified state. Before you use this function, you can use the AppButtonSetStateIsRegistered() function to see if it is registered with an Automation1 Studio, Automation1 MachineApps, or a custom .NET application.

Program Example

// Set a button to its default state
AppButtonSetState("Button1", "Default State")
// Use a variable to iterate over state IDs
var $stateIterator as integer = 0
// Set a button to each of its three states in order
for $stateIterator = 0 to $stateIterator < 3
	AppButtonSetState(1, $stateIterator)
	$stateIterator++ 
end