This section demonstrates how the Sweep widget is controlled from a macro. The script executes two measurements. The first is a 3D scan, the second a 2D scan. The makro inserts values to the entry widgets that define the scan, like a user would do it. Finally the measurement is started by invoking the procedure that is attached to the Start button. This script can be started from the command line of the toplevel widget: run SweepList.pl.
#!/usr/bin/env perl use strict; use Spectra; # # the list of runs # my @list = ( # # first area, an example for a 3D scan # { w_sample_time => 0.49, w_start_inner => 3015, w_stop_inner => 3115, w_delta_inner => 5, w_start_middle => 10320, w_stop_middle => 10330, w_delta_middle => 10, w_delta_middle => 10, w_start_outer => 0, w_stop_outer => 1, w_delta_outer => 0.5,}, # # second area, 2D # { w_sample_time => 0.51, w_start_inner => 3015, w_stop_inner => 3115, w_delta_inner => 5, w_start_middle => 10340, w_stop_middle => 10350, w_delta_middle => 10,}, ); # # make sure that the Sweep menu is visible # Sweep::main(); foreach my $run ( @list) { # # the outer loop is disabled by default # $Sweep::h{ flag_outer} = 0; $Sweep::h{ flag_outer} = 1 if( defined( $run->{ w_start_outer})) $Sweep::h{ flag_middle} = 1; foreach my $key ( keys %$run) { if( $key =~ /^w_.+/) { $Sweep::h{ ${key}}->delete( '0', 'end'); $Sweep::h{ ${key}}->insert( '0', $run->{ $key}); } else { $Sweep::h{ $key} = $run->{ $key}; } } $Sweep::h{ w_test}->invoke(); goto finish if( !Spectra::yesno( "Start to measure")); $Sweep::h{ w_start}->invoke(); goto finish if( $Spectra::SYM{interrupt_scan}); } finish: 1;