BrainVoyager v22.0

Scripting and Automation

Writing and running cross-platform scripts within BrainVoyager provides an important possibility to simplify analysis of large multi-subject data sets removing the need to use the mouse and keyboard to run the same preprocessing and analysis steps again and again. While script programs may reduce also the amount of user errors, it is nonetheless important to check the validity of the performed analysis steps (see also section Quality Assurance Tools). To learn about JavaScript scripting in BrainVoyager please consult the Scripting Getting Started Guide and Scripting Reference Manual that have been installed in the "GettingStartedGuides" directory within the BrainVoyager folder. On Windows, shortcuts will be also available directly from the "Program Files" menu in the folder "BrainVoyager". Since BrainVoyager 20 it is also possible to use the Python language for scripting.

BrainVoyager QX 2.1 introduced an important extension to the provided scripting (and plugin) system that allows to create and use cross-platform graphical user interface (GUI) components for scripts as well as for plugins (see topic Writing GUI Scripts in the Plugins Developer Guide). The new extensions have been defined on the basis of a new scripting layer that replaces the scripting module (QSA) of previous versions (BrainVoyager QX version 2.1 and earlier). The adaptation of old "QSA" scripts to the new scripts is very easy since the old and new scripting language are both based on (slightly different versions of) JavaScript. Consult the Scripting Reference Manual to learn how to move to the new scripting system. In BrainVoyager QX 2.1 scripts could not read or write custom files. This possibility has been added in BrainVoyager QX 2.2 and is described in chapter 4 Reading and writing files in the Scripting Reference Manual.

While running scripts within BrainVoyager is what one often wants, there might be working scenarios that would benefit from the possibility to run scripts from outside the program. On Windows, this is made possible by the COM (Component Object Model) binaray interface. On Windows, BrainVoyager is running as a COM server allowing all programs and scripts supporting the COM interface to remotely access BrainVoyager's functionality. Since Matlab supports the COM interface, it can be used to script BrainVoyager (as in pre- 2.0 versions). This might be particularly useful for power users who want to mix custom analysis routines written in Matlab with the processing and visualization capabilities of BranVoyager. For details, see the Scripting BrainVoyager from Matlab guide that has been installed in the "GettingStartedGuides" directory within the BrainVoyager folder. Other "COM aware" environments can also be used to automate BrainVoyager, including external script programs written in Visual Basic or JScript.

Since BrainVoyager QX 2.3 it is also possible to use AppleScript scripts on macOS to automate BrainVoyager. For details about this possibility, see the BrainVoyager AppleScript Guide that has been installed in the "GettingStartedGuides" folder within the "/Applications/BrainVoyager" folder. The guide is also available from the Help menu when running BrainVoyager on macOS.

Copyright © 2020 Rainer Goebel. All rights reserved.