Scripting to apply a processing template


To find out more about Scripts and automation within the Mnova Suite visit our scripts section. It is really easy to create a script to apply processing templates to your spectra. Just follow this procedure:

1. First of all, you will need to create a processing template for each type of experiments. For example, I am going to create a processing template for HETCOR spectra. To create this template, just open the HETCOR experiment in Mnova and follow the menu ‘Processing/Processing Template’. Finally add the desired processing options for F1 and F2. I have added Gaussian 4Hz, ZF=2K in F2, and Sine=0º, ZF=2K and magnitude in F1 Finally, click on the Save button to save the resulting processing template:

Create other processing template scripts to process 1H and 13C spectra and save them to your hard disk.

2. Now we are going to create a script to launch this processing template just with one click. Run Mnova, follow the menu ‘Scripts/Edit Script’ and copy the below script:

//<GUI menuname="proc"shortcut="Ctrl+2"tooltip="Process 1H 13C and HETCOR"/> function proc() { var spec = new NMRSpectrum( nmr.activeSpectrum() ); var processing = new String; if (!spec.isValid()) return; if (spec.dimCount == 1) { if (spec.nucleus() == "1H") processing = "C:/1H.mnp"; else if (spec.nucleus() == "13C") processing = "C:/13C.mnp"; } else if (spec.dimCount == 2) { if (spec.nucleus(1) == "1H" && spec.nucleus(2) == "13C") processing = "C:/HETCOR.mnp"; } nmr.processSpectrum(spec, processing); spec.process(); mainWindow.activeWindow().update(); }

The beauty of this script is that you can create different processing templates for your spectra. You will only need to create each processing template to each kind of spectra and save them in C: (of course you can save the template wherever you want, but you will need to modify the corresponding path in the script; see the parts highlighted in yellow in the script above). You can also add several processing templates for different experiments. For example, for a COSY spectrum; in that case, you will need to add the corresponding information to the script:

if (spec.nucleus(1) == "1H" && spec.nucleus(2) == "1H") processing = “C:/COSY.mnp”;

4. Once you have made the relevant changes in the script, save it in the scripts folder of Mnova (you can also save the script in any other folder, but you will need to add this folder by following the menu ‘Scripts/Scripts Directories).

5. Restart Mnova, and follow the menu ‘Scripts’. You will see under this menu an entry named ‘Proc’. You can run this script directly from this menu, or also just by using the shortcut ‘Ctrl+2’ (you can modify this shortcut in the first line of the script).

6. In addition. it will be possible to add a button to run this script from any toolbar of the interface. To do it, just right click on any toolbar and select ‘Customize toolbars’. Find in the right side of the window (almost at the end) the script named ‘Proc’ and add it to the desired toolbar by using the blue arrow button and clicking OK:

This will add an icon to the desired toolbar, which will allow you to run the script just by clicking on it:


About Author


Comments are closed.