306    WM-OM-E Rev I 
          End If 
     Next 
To do the same thing we could also write this, using the index only once:  
OldXK = X (0) 
     For K = 1 To Total 
     XK = X (K) 
          If XK > OldXK Then 
          Y = Cos (XK) * Sin (XK) * Sqr (XK) 
          OldXK = XK 
          End If 
     Next 
VBS runs slower than the "internal" calculations, because the scripts are interpreted. This could be 
serious for calculations where many operations are needed on each sample, such as convolution, 
correlation, and long digital filters. 
Scripting Ideas 
What can we do in a VBS script that we cannot do with the normal instrument functions? Here are 
some possibilities. 
•  Create a new function that acts on waveform values. 
•  Create a new parameter. 
•  Create a new form of non-linear vertical scale. 
•  Create a new form of non-linear horizontal scale. 
•  Move some or all data horizontally, including reflections. 
•  Combine data to form digital filters. 
•  Show several function results side by side. 
•  Show several function results interleaved. 
You can even create output data that are not related to the input. The output data need not even be 
in the same domain as the input data, because the system treats them as pure numbers. So you 
can create your own transforms into the frequency domain, for example.