Hooks: before/after move command

Sometimes it is necessary that some action is taken before a motor starts to move and that some other action is taken after it finished a move. A hook has been implemented that allows you define a command that is executed before the move starts (bmc) and a second command that is exeecuted after the move (amc). Here is an example:

 
mot1_bmc= "perl [online_dir]bmc.pl mot1"
mot1_amc= "perl [online_dir]amc.pl mot1"

vm1_bmc= "perl [online_dir]bmc.pl vm1"
vm1_amc= "perl [online_dir]amc.pl vm1"

For each motor can be different scripts. In our example the scripts are trivial. They just produce some output. The BMC script is:

#!/usr/bin/perl -w
# file /online_dir/bmc.pl
use strict; 
use Spectra; 
Spectra::log( "BMC: $ARGV[0] is at " . gmup( $ARGV[0])); 
1;

And the AMC script looks like this:

#!/usr/bin/perl -w
# file /online_dir/amc.pl
use strict; 
use Spectra; 
Spectra::log( "AMC: $ARGV[0] is at " . gmup( $ARGV[0])); 
1;

The function Spectra::log() writes to online.log and to the log-window, if Online has been started as “online -tki”.