3b. Practical scripting guide: How to record a macro

Creating a macro is done in the following way:

 

1. Perform the task, that should be automated in the form of a script, first manually.
2. Look in the 'log' tab. Copy the task commands that are generated while performing the task (see figure). These commands are logged in QSA script language.
3. Open the script editor via the BrainVoyager QX menu option 'File' > 'Scripts...' > 'Edit scripts...'.

a. Create an empty function and give the function a name. Here we call the function 'newFunction' but it could be any name; although there should not be spaces between the words. 'function my new function()' won't work because the computer will think these are several commands instead our one instruction to create a new function.

 

function newFunction() {

 

}

 

(see Chapter 1a).

b. Paste the copied task commands in it.

 

function newFunction() {

<paste the Log text here>

}

 

4. Save your new script.

Next: 3c. Practical scripting guide: How to create a graphical component
Index