Script

Navigation:  Views > View objects > Action items >

Script

Previous pageReturn to chapter overviewNext page

Script objects execute several lines of commands when the user clicks on the object. The Script object type is based on the object type 'Lines', i.e. it can display several lines of text with an optional background color filling the rectangle. Basically you can consider it to be a button that starts an action.

The edit command of a script object brings up the following dialog:

 

clip0194

 

The text field on top lets you write the description to inform the user about the script. The first line of the description will be displayed using bold letters.

The bottom part contains the script lines that are executed. Each line must contain one command. Each command may have several parts, separated by commas. The commands available at present are described below.

 

If you want to avoid that the user can change the script object you can check the 'Check password when user tries to edit script' option and set a password in the password editor.

 

The tables below show the available script commands with and without additional parameters.

 

Script commands without parameters

 

Script command

Explanation

acquire

Tells all spectrometer objects to acquire spectra

automatic export of measured spectra

Exports all measured spectra to the folder specified for automatic spectrum export.

automatic export of measured spectra to csv files

Exports all measured spectra to the folder specified for automatic spectrum export, using *.csv file format

automatic export of measured spectra to excel files

Exports all measured spectra to the folder specified for automatic spectrum export, using Excel file format.

automatic import of measured spectra

Executes automatic spectrum import for the current sample description

automatic import of measured spectra from csv files

Imports all measured spectra from the folder specified for automatic spectrum export, using *.csv file format

automatic import of measured spectra from excel files

Imports all measured spectra from the folder specified for automatic spectrum export, using Excel file format

clear workbook

Clears the workbook

connect to ado database

Connects to the Microsoft SQL database using the access data defined in the SQL section

connect to first mysql database

Connects to the first MySQL database using the access data defined in the SQL section

connect to second mysql database

Connects to the second MySQL database using the access data defined in the SQL section

data acquisition: do it

Starts a series of data acquisition events.

data acquisition: edit delay

Lets the user set the delay between measurements in a series of data acquisition events.

data acquisition: edit number of measurements

Lets the user set the number of measurements taken in a series of data acquisition events.

do not search path containing optoplex csv files

Sets a flag to false, skipping explicit folder search for Optoplex csv files. Use this option after the user has selected the folder and you want to use this folder from now on for the following actions.

edit climate

Opens a dialog to set climate parameters for integral quantity computations (CODE only)

edit sample description

Lets the user modify the sample description in a dialog

edit sample description exit script after cancel

Lets the user modify the sample description in a dialog. If the user exits the dialog by pressing the Cancel button, the following script lines are ignored.

edit username

Lets the user change the username. You can use this command to have operators type in their name, for example.

edit window tilt angle

Opens a dialog to set the tilt angle of a window glazing. Used for some computations in CODE.

exit program

Quits the program

export data acquisition results to workbook

Writes the final numbers and the spectra to the workbook sheet 'Data acquisition results'. If the sheet does not exist it is generated.

export fit results to workbook

Exports the current fit results to the workbook. If the workbook has the correct structure, a new column is added. Otherwise the correct workbook structure is generated, erasing the current workbook.

export results to sql database

Exports current sample, spectra and analysis results to the selected database

extract single spectra from optoplex csv files

Lets the user select a folder which contains Optoplex 5.1 csv files with data acquisition results. Individual files are generated in the subfolder '\single files\'. The single files can be used as input for batch processing or BREIN.

flip target and measured spectra

Exchanges target and measured spectra of all objects in the list of spectra

generate new substrate reset correction range

This command resets the correction range for automatic substrate generation. After its execution no correction is done anymore, until a new correction range is defined.

generate SQL table for fit results

Generates a new table in the SQL database which can be used to store the fit results of the current configuration

import all spectra from an optoplex ngq exsitu file

Executes the menu command 'actions/spectra/import/import all spectra from an Optoplex NGQ exsitu file'

import all spectra from an von ardenne exsitu file

Executes the menu command 'actions/spectra/import/import all spectra from an Von Ardenne exsitu file'

import all spectra from a zeiss thinprocess database

Opens the dialog to connect to a ThinProcess database and load spectra for a selected sample

increase automation step

increases the automation step counter by 1

increase sample index

Increases the sample index by 1

loop through batch results

Loops through all batch results, loading all spectra and the obtained fit parameters into the optical model

parameter variation

Starts the parameter variation routine, like the menu command "Actions/Parameter variation"

prepare batch fit using optoplex csv files

Lets the user select an Optoplex pane ID which is then used to prepare a batch fit for all positions found in the corresponding *.csv file.

prepare new batch fit

Prepares all required worksheets for a new batch fit

prepare optoplex ngq batch fit

Lets the user select an Optoplex NGQ exsitu file with spectra and prepares a new batch fit for all traverse positions found in the file

prepare von ardenne exsitu batch fit

Lets the user select a Von Ardenne exsitu file with spectra and prepares a new batch fit for all traverse positions found in the file

repeat parameter variation

Repeats the parameter variation routine, like the menu command "Actions/Repeat parameter variation"

reset automation step

Sets the counter for automation steps to zero

reset sample index

Sets the sample index to 0

save as

Executes the SaveAs dialog to save the program configuration

save simulated as measured spectra

Copies the simulated spectrum to the measured spectrum for all objects in the list of spectra

save simulated as target spectra

Copies the simulated spectrum to the target spectrum for all objects in the list of spectra

save workbook

Saves the workbook to a file

search path containing optoplex csv files

Sets a flag to true which forces explicit search of the input folder for Optoplex csv files.

select database

Shows a dialog to select the database

select material from database

Shows the optical constant database as a dialog so that the user can select a material (used in combination with the command 'assign selected database material to layer, stack index, layer index')

set automation log file

Shows a dialog to set the log file for automation results

set time marker

Sets the time marker. Use this option to control time critical actions.

show time since last time marker

Writes the number of milliseconds elapsed since the last time marker has been set to the message board.

start automaton timer

Starts the automation timer, i.e. a clock which generates periodic automation events

start batch fit

Starts the batch fit

start clock

Starts the internal clock

start fit

Starts the fit

stop automation timer

Stops the automation timer

stop batch fit

Stops the batch fit

stop clock

Stops the internal clock

stop fit

Stops the fit

toggle automation timer

Changes the state of the automation timer from on to off if it is on, or from off to on if it is off.

update data

Re-computes the whole configuration, used when the model needs an update after a parameter change

update database lists

Updates the lists of database objects

update plot

The main view is drawn, used when changes of the model should become visible to the user

update special computations

Tells all object in the list 'Special computations' to re-compute their data

write logging header

Writes the header for logging information to the workbook

write logging line

Writes a line of logging information to the workbook

 

 

Script commands with additional parameters

 

Script command

Explanation

Accept instruction

Use this command to give the user a chance to exit a script at a certain point. The command takes 3 string parameters: Title of the dialog, a text to explain the reason for the dialog popping up, a question. If the user leaves the dialog pressing 'Ok' the script is continued, otherwise discontinued.

 

Example:

accept instruction,Doing a measurement,Confirm acquiring a new spectrum,Put your sample on the sample stage. Press Ok when ready or Cancel to exit without doing a measurement.

Assign layer stack to spectrum simulation object, name of layer stack, name of spectrum simulation object

Assigns the layer stack with the given name to the specified spectrum simulation object

assign selected database material to layer, stack index, layer index

Assigns the selected database material (see the command 'select material from database') to the layer specified by layer_index in the layer stack given by stack_index. Both layer_index and stack_index are counted 1, 2, 3, ...

Check if calibration needed

Checks if a spectrometer has a valid calibration. 3 string parameters are passed: The name of the spectrometer object, an explanation for the operator, and a question that gives the operator the chance to move on with the script or to exit. Use this command at the beginning of a script that does measurements.

Example:

 

check if calibration needed, spectrometer1,Warning: Calibration not valid, Do you want to continue measuring a new spectrum anyway?

 

continue if fit stopped, max waiting time in seconds

Waits until a running fit is stopped or until the maximum number of seconds has elapsed. If the fit is still running a delay of 500 ms is executed. If the maximum number of seconds has been reached the script continues. Make sure that you call 'stop fit' with a short delay after this command to make sure that the fit is not running anymore before the next script commands are executed. Otherwise an inconsistent program status can occur.

create fit parameter,list index, object index, subobject index, subsubobject index, parameter index

Creates a new fit parameter for the specified list and the specified object in that list.

delay since last time marker, milliseconds

Pauses the script until the given milliseconds have passed since the last time marker has been set.

edit fit parameter, fit parameter name

Shows a dialog which lets the user change a fit parameter

edit master parameter, master parameter name

Shows a dialog which lets the user change a master parameter

generate new substrate, r, t, d_glass,spectral_min, spectral_max,number_of_points, spectral_unit

Generates a new substrate in the folder \database\automatic_subtrate_update\. The optical constants are computed using the measured data in the spectrum objects r (reflectance) and t (transmittance). The thickness is taken from d_glass (mm). The spectral range is taken from the given values of spectral_min, spectral_max, number_of_points and spectral_unit. If a 'correction range' (see below) has been defined it is used.

generate new substrate correction range, spectral_min, spectral_max

Defines a spectral range (based on the vales spectral_min and spectral_max) for a check of the condition R+T<=1. If R+T is >1 it is assumed that R is too high (caused by scratches or  surface contamination of the reference mirror). A correction factor for the reflectance spectrum is computed which ensures that R+T<=1 in the whole correction range.

go to view, name

selects the view with the given name as the current view

import pane wizard spectra from window text file, stack index, layer index

Loads pane wizard spectra for the layer given by layer index in the stack given by stack index from a Window text file

load configuration from sql database, configuration index

Loads the configuration with the specified index from the connected SQL database

move master parameter, name, start_value, final_value, steps

Used for animations: Moves the value of a master parameter from the initial value to the final value, taking the specified number of steps and a delay of 25 ms in between each step. For each step, the whole model is re-computed and the current view updated.

object command, argument 1, argument 2, ...

This is a general script command which may have several arguments, depending on the object to be called. Usually the first argument is the name of the object to be activated, followed by the name of an action and more parameters to be passed.

 

The section below lists the implemented commands of various object types.

rename material, index, new name

Gives the material list object specified by index a new name

rename material dialog, index

Gives the material list object specified by index a new name by showing a user dialog

rename worksheet, new name

Renames the currently selected worksheet of the workbook

save material to database, index

Saves the material list object specified by index to the database

save workbook to measurement report folder,filename,subfolder,confirmation_request

Saves the current content of the workbook (as Excel file, using the extension *.xlsx) to a subfolder of the measurement report folder, using the specified filename.

 

The filename and subfolder strings are so-called 'text functions'. You can pass text in the regular way, or use the marker _function with subsequent text to compute the text which is finally passed to the routine. With the function "_function label my_label" you can pass the current text of the label named "my_label". This can be a filename which has been set by the user in a previous dialog.

 

If you send the string 'confirm' as confirmation_request you will get a message dialog giving information about successful saving of the file.

If you send the string 'message board' as confirmation_request information about successful saving of the file will be written to the message board, without a modal dialog. You have to open the message board to inspect the message.

If the information_request string is left empty no information about file saving is given at all.

 

set automation time interval, milliseconds

Sets the automation time interval to the given number of milliseconds

set emissivity, spectrum name, position, value

Sets an emissivity value which then can be used for the computation of a U- or g-values.

The U- or g-values to be computed must be linked to the spectrum. The name of this spectrum is passed as second item of the command. The third parameter identifies the position in the stack, counted as 1, 2, 3, 4 beginning on top of the stack (which means 'outside'). Finally, the fourth parameter is the value of the emissivity.

set label, label name, label caption

Changes the caption of the label (a view element) specified by the name 'label name'

set master parameter, master parameter name, new value

Assigns a new value to the specified master parameter

set measurement report folder, folder name

Sets the folder for actions involving measurement reports

set number of spectral points,n

Sets the number of spectral points to n for all materials and spectra

set path for automatic spectrum export, path

Sets the path for automatic spectrum export. If the specified path is empty the default folder \database\spectra\automatic\ is used.

set sample description,sample 0815

Changes the sample description to the new text 'Sample 0815'

set sample position x, number

Sets the x-coordinate of the sample position to number

set sample position y, number

Sets the y-coordinate of the sample position to number

set sample position z, number

Sets the z-coordinate of the sample position to number

show message dialog,text

Shows a modal dialog with the given text on the screen. The dialog has an Ok button only - there is no Cancel option.

show pane wizard, stack index, layer index

Opens the pane wizard for the layer given by layer index in the stack given by stack index

show workbook as model dialog, explanation

Transfers the text given by 'explanation' to the workbook and then shows the workbook as modal dialog (which must be closed before the program continues to do other things)

simple object command, object name, command

Passes a command to the object with the given name

take sample position y from traverse, name

Asks the traverse with the given name for its current position and takes it as y-coordinate of the sample position

verify function value, the function, min, max, the_quantity

Evaluates the function value which is given by the user-defined function. A warning on the screen is raised if the function value is outside the interval [min, max]. The text given by 'the quantity' is used in the warning text. You can use this function to inform the user of a spectrometer saturation or a temperature which is too high.

verify function value exit script when false, the function, min, max, the_quantity

The same as 'verify function value' but in addition to a warning message on the screen the current script is not continued. Use this function to verify that your equipment is ready for the following actions of the script.

view object command, object name, height, new value

Sets the position parameter 'height' of the view object to the indicated value

view object command, object name, hide

Hides the specified view object

view object command, object name, left, new value

Sets the position parameter 'left' of the view object to the indicated value

view object command, object name, show

Show the specified view object

view object command, object name, slide height, initial value, final value, steps

Used for animation: Change the position parameter 'height' of the view object from the initial value to the final value, taking the indicated number of steps with a delay of 25 milliseconds in each step

view object command, object name, slide left, initial value, final value, steps

Used for animation: Change the position parameter 'left' of the view object from the initial value to the final value, taking the indicated number of steps with a delay of 25 milliseconds in each step

view object command, object name, slide top, initial value, final value, steps

Used for animation: Change the position parameter 'top' of the view object from the initial value to the final value, taking the indicated number of steps with a delay of 25 milliseconds in each step

view object command, object name, slide width, initial value, final value, steps

Used for animation: Change the position parameter 'width' of the view object from the initial value to the final value, taking the indicated number of steps with a delay of 25 milliseconds in each step

view object command, object name, top, new value

Sets the position parameter 'top' of the view object to the indicated value

view object command, object name, width, new value

Sets the position parameter 'width' of the view object to the indicated value

workbook command

Sends the whole script line to the workbook for further processing

 

Implemented object commands

Object commands are sent to objects specified by their name. It is important to use unique names within a configuration - if several objects have the same name the transfer of a command to the wanted object may fail. If an object command is sent by a script line, the following lists are checked in the given sequence:

 

1.list of materials

2.spectrometer list

3.list of spectra

4.list of layer stacks

5.view list

6.list of special computations

7.workbook

 

Script commands that help to import Zeiss ThinProcess spectra

There are some useful script commands for handling ThinProcess spectrum import. These are explained in a separate section.

 

 

 

 

The commands which can be executed for the various types of objects are summarized in the following sections.