Hardware manual
Impact Reference Guide Scriptor
4-119 Datalogic Automation Inc.
This section contains examples of scripts using the scriptor commands listed previously.
IMPORTANT: These scripts are examples only. They will not necessarily operate as-is, since they must be
modified to fit in your operating environment. Datalogic is not responsible for any malfunctions that may
result from the use of this code.
Main script
This is a main script that calls other scripts that connect to an Impact device, then load and save vision pro-
grams on that device.
main.bsh
/** main script that calls scripts that load and save vision programs **/
if(Scriptor.loadAndExecuteScript("C:/IMPACT/scripts/connect.bsh"))
{
boolean successful = Scriptor.loadAndExecuteScript("C:/IMPACT/scripts/
load.bsh");
if(successful)
{
Scriptor.loadAndExecuteScript("C:/IMPACT/scripts/save.bsh");
}
}
Connect script
This is the called script that connects to an Impact device.
connect.bsh
/** This script will connect to the device. **/
boolean successful = Scriptor.setProperty("Panel 1.IMPACT Connector.IP
Address","192.168.0.128");
if(successful)
{
successful = Scriptor.executeMethod("Panel 1.IMPACT Connector.Connect");
}
if(successful)
{
String isConnected = "false";
while(isConnected.equals("false"))
{
isConnected = Scriptor.getProperty("Panel 1.IMPACT Connector.Connected");
Scriptor.sleep(200); // sleep 200 milliseconds
if(isConnected == null) // couldn't get connected property
{
successful = false;
Scriptor.displayPrompt("Error getting connection status");
break;
}
}
}
Load script
This is the called script that loads the vision programs.
load.bsh
/** This script will load the specified vision programs. **/
boolean successful = Scriptor.setProperty("Panel 1.Load Vision Program.Browsing
Enabled","false");
if(successful)
{