Editing    Analysis    Display    Archive Scripts    Useful Script Functions    Control

On-Line    Experiments    Examples of Method    Spectrum    User RequestedNew

Useful Script Functions
Sequencer Library new
Randomise Order of an Integer Array
NewsFlash
Hide/Restore Floating Windows
Clear Logs
DoButtons

Sequencer Library
PC: SeqLib.ZIP 2,200

SeqLib - a library of functions to help with calculations of sequencer variable values. SeqLib contains a much requested function; something that calculates the variable value required to set a DAC output to a specified voltage. This is the equivalent of the VDAC32() operator built into the sequence compiler but can be used in a much more flexible manner. Other SeqLib functions convert time to sequencer ticks and generate variable values suitable for writing to the digital outputs or controlling the cosine outputs.


Randomise Order of an Integer Array
PC: shuffle.ZIP 923

func Shuffle%()

This function randomises the order of items in an integer array. A typical application might be to randomise the order of presentation of common and rare auditory stimuli.


News Flash
PC: nwsflash.ZIP 1,240

Newsflash() / NFIdle()

If you add these functions to your own scripts you can display Message boxes similar to those generated by the built-in Message() procedure but with the following extra features:


Hide/Restore Floating Windows
PC: hiderest.ZIP 886

proc HideApps(); and proc RestoreApps();

These procedures can be used to hide all the floating windows and toolbars etc. at the start of a script and restore them at the end. This maximises the available screen area during script operation. The gFloat%[] array should be a global at the start of your script.

These procedures are used in many CED scripts. The particular variant given here keeps the script window itself hidden. You can find a slightly simplified version of these procedures and further information under App() in the Spike2 Help index.

These functions should be compatible with all versions of Spike2 for Windows.


Clear Logs
PC: clearlog.ZIP 882

proc ClearLogQ():

This Spike2 script procedure checks whether there is any text in the Log window. If the log contains text a Query box is displayed so that you can choose whether or not to clear the log before continuing. If you choose the answer No, the text caret is moved to the end of the log file. The procedure leaves the current view unchanged.

Add this function to the functions and procedures section of your own scripts. You can then call it at the beginning of script functions that write data to the log file or perhaps in the Quit() function, as an aid to keeping the log file in a tidy state.

This procedure should work in all versions of Spike2 for Windows


DoButtons
PC: dobuttons.ZIP 2,122

func DoButtons%()

This function allows you to set the enabled /disabled state of multiple toolbar buttons.

The ToolbarEnable() and ToolbarClear() script functions can only act on one (or all) buttons. Thus, you may need sequences of 4 or 5 calls to ToolbarEnable() at each point in the script where you need to set the enabled state of multiple buttons. The DoButtons%() function provides a method of setting the state of multiple buttons with a single function call. To use it, simply copy the DoButtons%() function into the functions and procedures section of your script and call it as illustrated in the example script.

This function requires Spike2 v5.14 or higher.


Some of these scripts have come from users rather than the CED team. If you have a script that you would like to offer to fellow users via this page, please tell Simon Gray. We provide some scripts for Signal too.

These scripts are stored as WinZip files, myscript.zip, except where they are shown as spike\scripts\myscript.s2s. Those latter files were installed with Spike2 and spike stands for the directory in which you installed Spike2. See the summaries by clicking on the description line, below. Then you can down-load them by clicking on the filename; please check the size received.
CED home page