Scripting With Mnova 5.3.0
Scripting With Mnova 5.3.0
MestreNova Scripting
by MESTRELAB RESEARCH
Mnova Scripting
2009 MESTRELAB RESEARCH
All rights reserved. No parts of this work may be reproduced in any form or by any means - graphic, electronic, or mechanical, including photocopying, recording, taping, or information storage and retrieval systems - without the written permission of the publisher. Products that are referred to in this document may be either trademarks and/or registered trademarks of the respective owners. The publisher and the author make no claim to these trademarks. While every precaution has been taken in the preparation of this document, the publisher and the author assume no responsibility for errors or omissions, or for damages resulting from the use of information contained in this document or from the use of programs and source code that may accompany it. In no event shall the publisher and the author be liable for any loss of profit or any other commercial damage caused or alleged to have been caused directly or indirectly by this document.
Mnova Scripting
Table of Contents
Foreword 0
Part I Scripts
1 Connecting ................................................................................................................................... 13 scripts with Mnova objects 2 Connecting ................................................................................................................................... 22 scripts with Mnova GUI 3 Mnova script reference ................................................................................................................................... 22 4 Mnova Properties ................................................................................................................................... 61 5 GUI Actions................................................................................................................................... 65 6 Running Scripts from the command line ................................................................................................................................... 70 7 Scripts Samples ................................................................................................................................... 71
Index
Part
Mnova Scripting
Scripts
Scripting with Mnova
Benefits and uses
The availability of scripting in Mnova provides opportunities and benefits both for skilled NMR and casual, non-expect users: Users are less dependent on the application developers for new features since scripting allows them to implement minor features themselves which can be deployed to less expect users. NMR administrators can write scripts to customize applications before deploying them to a group of users. For example, an NMR manager could create a script to automate some particular processing which he can distribute among his users in such a way that they will simply have to click one button (e.g. toolbar button) to apply that processing. Mnova developers can use scripting to prototype new features that can later be incorporated into the next version of the application. This is ideal when a client requires some processing/analysis feature not available in the application and cannot wait until a new version of Mnova is released. Mnova scripting language is based on an ECMAScript-based language making it easier for existing Web developers to customize and extend Mnova.
In essence, nearly everything that can be done with the Mnova graphical interface (UI) can be reproduced with Mnova's scripting module, making it very easy to automate repetitive tasks. For example, you may have to routinely process 1H NMR spectra using the same processing operations. You can create a script which wraps up all these processing functions in such a way that by simply clicking a toolbar button or pressing a keyboard shortcut, all of your 1H NMR spectra will be processed accordingly. Furthermore, if some particular processing function is not available in Mnova, you can create a script which modifies the spectral data points according to your requirements.
In this example we have defined a function called helloWorld() which will simply display a message box with the text Hello World. Note that MessageBox is in bold, meaning that Mnova script editor recognizes it as a valid function. Next, go to the edit control at the top of the script editor and type helloWorld(). Do not forget the brackets as they are required by the scripting framework in order to properly interpret the function. Once you have typed it, click on the green arrow at the right side of the edit control. You should get the pop up message box.
Mnova Scripting
It is also possible to write information directly on the output control in the script dialog by using the print command as showed below. This is very useful when debugging scripts.
As Mnova scripting is an ECMAScript-based language, you can use any of the many functions and statements supported by this standard such as loops, conditions, etc. Remember that JavaScript is ECMAScript based too so if you are familiar with it or with C/C++, writing Mnova scripts should be very easy for you. If you are not familiar with the ECMAScript language ( http://doc.trolltech.com/4.3/ecmascript.html), there are several existing tutorials and books that cover this subject, such as JavaScript: The Definitive Guide.
10
Mnova Scripting
This is very important to allow Mnova to find these scripts when starting in such a way that they can be added to the GUI of Mnova (e.g. Toolbars, Menus, etc). For example, type the following script: // <GUI menuname="Hello" shortcut="Ctrl+1" tooltip="Hello World" /> function HelloWorld() { MessageBox.information("Hello World"); } And save it in the scripts directory (program data ) . Now close Mnova and open it again.
11
You will appreciate that the script is available in the menu bar. The key to get this working lies in the first line of the script (and of course, in the fact that Mnova can locate the script as it has been saved in the appropriate folder): // <GUI menuname="Hello" shortcut="Ctrl+1" tooltip="Hello World" /> This line is used to instruct Mnova about the name to be displayed in the scripts menu along with the keyboard shortcut and the text used as a tooltip. For a full description on the usage of this line, see connecting scripts and Mnova GUI section below. In any case, you can add any desired (or remove any undesired) folder as a 'Script Directory' by following the menu 'Scripts/Scripts Directories':
It is also possible to create dialog boxes with controls. The script below shows a simple example.
12
Mnova Scripting
13
1.1
14
Mnova Scripting From that point, you can read relevant information of the NMR spectrum such as the number of points, spectral width, etc. For more information about the spectrum properties see the reference. Lets now move to a more comprehensive example which will illustrate, step by step, how to access all objects within an Mnova page.
Having access to multiple objects: the layout script As an illustrative example, we will build a script which will make it possible to organize different objects contained within a page. This script will be called layout for obvious reasons. To start off with, open a spectrum, a molecule and a picture (which could be, for example, your company logo). The following picture shows the initial conditions for this example:
The goal here will be to create a script which will arrange these 3 objects in such a way that the picture will be located at the left side of the page whilst the spectrum and the molecule will be moved next to the picture. // <GUI menuname="Layout"shortcut="Ctrl+2" tooltip="Layout" /> function layout() { var w = new DocumentWindow(Application.mainWindow.activeWindow()); var p = new Page(w.curPage()); var n = p.itemCount(); for(i=0; i<n; i++)
2009 MESTRELAB RESEARCH
15 { var item = p.item(i); var width = item.width(); var height = item.height(); switch(item.name()) { case "NMR Spectrum": item.left = p.left + 50; item.right = p.right - 10; item.top = p.top+20; item.bottom = p.bottom; break; case "Molecule": item.left = p.left + 50; item.right = item.left + width; item.top = p.top; item.bottom = p.top + height; break; case "Image": item.left = p.left; item.right = item.left + width; item.top = p.top; item.bottom = item.top + height; break; } } w.update(); } Every object in Mnova is contained in a page which in turn is contained in a document. So the first thing we should get access to is the document. This is done in this line: var w = new DocumentWindow(Application.mainWindow.activeWindow()); Basically we access to the document window (DocumentWindow) via the Application object. Once we have the document, we can easily access to the currently active page through Page object like this: var p = new Page(w.curPage()); Now we are ready to navigate through all the objects contained in this page. For every object, the exact type is checked within the switch command and then the objects are repositioned accordingly. This is the result for this example.
16
Mnova Scripting
17
The first thing to note is the NMRSpectrum object. It will allow us to construct a specialized NMR spectrum object if a valid item is provided. From that point on, we will be able to change any spectrum properties or gain access to any of its elements such as the spectrum title. In this particular example we read the title using nmrSpec.title property which is then plotted with the draw.text command and moved to the top of the page next to the logo image. Its important to note that in line tit = draw.text("<h3>"+nmrSpc.title+"</h3>", true); we are creating a new object (or item). This means that the array of items will not be the same now and the internal for loop will not longer be valid. One could think of just incrementing the number of items by one unit, but its not guaranteed that the internal order of the objects is the same after inserting a new one. The simplest solution is to make a temporary copy of the original objects in the page (before creating the title object) as this: var c = p.itemCount(); var i = 0; var itemArray = new Array(c); And then we can iterate through all these items: for( i = 0; i<itemArray.length; i++ ) { var item = itemArray[i]; // ... } The complete new script looks like this: // <GUI menuname="Layout2" shortcut="Ctrl+2" tooltip="Layout2" /> function layout2() { var w = new DocumentWindow(Application.mainWindow.activeWindow()); var p = new Page(w.curPage()); serialization.open("c:\\kk\\logo.jpeg"); var c = p.itemCount(); var i = 0; var itemArray = new Array(c); for(i=0; i<c; i++) { itemArray[i] = p.item(i); } for( i = 0; i<itemArray.length; i++ ) { var item = itemArray[i]; var width = item.width(); var height = item.height(); switch(item.name()) { case "NMR Spectrum": var nmrSpc = new NMRSpectrum(item); nmrSpc.left = p.left + 80; nmrSpc.right = p.right - 10; nmrSpc.top = p.top+20; nmrSpc.bottom = p.bottom; var tit = draw.text("<h3>"+nmrSpc.title+"</h3>", true);
18
Mnova Scripting tit.left = p.left+50; tit.top = p.top; print(item.name()); break; case "Molecule": item.left = p.left + 90; item.right = item.left + item.top = p.top+50; item.bottom = item.top + print(item.name()); break; case "Image": item.left = p.left; item.right = item.left + item.top = p.top; item.bottom = item.top + print(item.name()); break; } } w.update(); } Once you have the script saved (please bear in mind that the script file will need to have the same name as the function which you want to call, in this case the name of the script must be layout2.qs) in the Mnova scripts folder (and then have restarted the program), you will be able to add it to the toolbar just by following the menu: 'View/Toolbars/Customize Toolbars'. This will display the 'Customize Toolbars' dialog box. Then, click on the + button to create a new toolbar and type its name (Scripts Toolbar) by clicking on the Rename button.
width; height;
width; height;
19
Next, navigate to the 'Script' icon (Layout2) in the 'Actions' menu (at the left-hand side of the window) and Click on the 'Right Arrow' button to add the 'Layout2 script to the 'New Toolbar'.
20
Mnova Scripting
Finally, click on OK and you will be able to see the 'Layout2' icon in the 'New toolbar'. You will also be able to introduce the script in any existing contextual menu by following a similar procedure in the Customize Context menus dialog box.
1 Processing templates
It is possible within Mnova to process a 1D or 2D NMR spectrum via scripting by using the processing templates (generated with the Full Processing feature). As you can see in the below example, you can process (with an easy script) any kind of spectrum (1H, 13C, 1D or 2D). You only need to create the processing template for each experiment. In the example below we have created 3 different processing templates, one for the processing of 1H-NMR spectra (1H.mnp), the second for the processing of 13C-NMR spectra (13C.mnp) and the last one for the processing of COSY spectra (COSY.mnp). As you can see in the scripts, the three the templates were saved at c:/kk/ (of course
2009 MESTRELAB RESEARCH
21 you can change this path and also the name of the template files). function procTemplate() { var spec = new NMRSpectrum( nmr.activeSpectrum() ); var processing = new String; if (!spec.isValid()) return; if (spec.dimCount == 1) { if (spec.nucleus() == "1H") processing = "c:/kk/1H.mnp"; else if (spec.nucleus() == "13C") processing = "c:/kk/13C.mnp"; } else if (spec.dimCount == 2) { if (spec.nucleus(1) == "1H" && spec.nucleus(2) == "1H") processing = "c:/kk/COSY.mnp"; } nmr.processSpectrum(spec, processing); }
2 Processing interface
The Processing interface makes it possible to change or apply any processing operation available in Mnova. For example, lets make a simple script which will set an exponential weighting function: function myProcess() { var spec = new NMRSpectrum( nmr.activeSpectrum() ); var p = new NMRProcessing(spec.proc); p.setParameter("Apodization[1].Apply", true); p.setParameter("Apodization[1].Exp.Apply", true); p.setParameter("Apodization[2].Exp.Value", 0.5); print(p.getParameter("Apodization[1].Exp")); spec.proc = p; spec.process(); mainWindow.activeWindow().update(); } After creating a spectrum object which represents current active spectrum, we create a processing variable (p) which represents the processing operations for that particular spectrum. Once this new object is created, we can read or change its values using getParameter and setParameter functions. For instance, in this example we first set to true the Apodization property (otherwise no apodization will be applied) and then, after setting to true the exponential function, we set the line broadening to 0.5 Hz. Finally, when we are done, we assign this processing object to the spectrum object (spec.proc = p;) and we call spec.process(); to actually apply all the processing operations.
22
Mnova Scripting
1.2
This line is used to instruct Mnova about the name to be displayed in the scripts menu along with the keyboard shortcut and the text used as a tooltip. Please bear in mind that the user is also able to use any created image file as icon. In this case, the name of the script is MyProcess, the shortcut is Ctrl+1, the tooltip is Exponential 0.5 and the icon used was saved at C:/bin2.jpg. You will be able to see in the picture below, that we have added the script MyProcess to the Scripts menu with the corresponding shortcut (Ctrl+1) and that we have introduce our own icon on the toolbar (red square in the picture below).
Please bear in mind that the script file will need to have the same name that the function which you want to call, in this case the name of the script must be MyProcess.qs, because the name of the function is: myProcess().
1.3
Application
Application object
23
Arrow
Arrow page item. Inherits PageItem
o property endX: Number o property endY: Number o property startX: Number o property startY: Number o constructor Arrow(Arrow aArrow) Arrow aArrow o function toString(): String
Atom: You will find below a list of the objects related to the atom of the molecular structures
o property charge: Number o property elementSymbol: String o property isotope: Number o property label: String o property nH: Number o property nHAll: Number o property text: String o property valence: Number o constructor Atom(Atom aAtom)
24
Mnova Scripting Atom aAtom o function toString(): String String representation of the object
BinaryStream: The BinaryStream object provides serialization of binary data to a file. Example
scripts are present in the examples/scripts installation directory o property pos: Number Gets/sets the file position corresponding to the current position of the stream. Returns -1 if an error occurs o property endianness: Number Gets/sets the serialization endianness Valid Values: {BinaryStream.eBig, BinaryStream.eLittle} o Constructor BinaryStream(File aFile) File aFile Description:Constructs a BinaryStream that operates on aFile o Constructor BinaryStream(BinaryStream aStream) BinaryStream aStream Constructs a BinaryStream that is a copy of aStream o function atEnd(): Boolean Returns true if there is no more data to be read from the BinaryStream o Constructor skip(Number aSize) Number aSize Description:Skips the aSize bytes in the stream o function writeInt8(Number aValue) Number aValue Description:Writes a signed byte to the stream o function writeInt16(Number aValue) Number aValue Description:Writes a signed 16-bit integer to the stream o function writeInt32(Number aValue) Number aValue Description:Writes a signed 32-bit integer to the stream o function writeInt64(Number aValue) Number aValue Description:Writes a signed 64-bit integer to the stream o function writeInt8(Number aValue) Number aValue Description:Writes a signed byte to the stream o function writeBool(Boolean aValue) Boolean aValue Description:Writes a boolean to the stream o function writeReaI32(Number aValue)
2009 MESTRELAB RESEARCH
25 Number aValue Description:Writes a 32-bit real (float) to the stream o function writeReaI64(Number aValue) Number aValue Description:Writes a 64-bit real (float) to the stream o function writeString(String aValue) String aValue Description:Writes a String to the stream o function writeCString(String aValue) String aValue Description:Writes the '\0'-terminated (C-like) string to the stream o function writeBytes(String aValue, Number aSize) String aValue Number aSize Description:Writes aSize bytes from aValue to the stream o function readInt8() Description:Reads a signed byte from the stream o function readInt16() Description:Reads a signed 16-bit integer from the stream o function readInt32() Description:Reads a signed 32-bit integer from the stream o function readInt64() Description:Reads a signed 64-bit integer from the stream o function readBool() Description:Reads a boolean from the stream o function readReal32() Description:Reads a 32-bit real (float) from the stream o function readReal64() Description:Reads a 64-bit real (float) from the stream o function readString() Description:Reads a String from the stream o function readCString() Description:Reads the '\0'-terminated (C-like) string from the stream o function readBytes(Number aSize) Number aSize Description:Reads aSize bytes from the stream o function toString(): String
Bond:
2009 MESTRELAB RESEARCH
26
Mnova Scripting
o enumeration BondStereo: Number = {bsCisOrTrans, bsDown, bsEither, bsNone, bsUp} o enumeration BondType: Number = {btAny, btAromatic, btDouble, btDoubleOrAromatic, btSingle,
btSingleOrAromatic, btSingleOrDouble, btTriple}
o property atom1: Number o property atom2: Number o property bondStereo: BondStereo o property bondType: BondType o constructor Bond(Bond aBond) Bond aBond o function toString(): String
String reperesentation of the object
Dir: The Dir object provides access to directory structures and their contents. All the scripts are
present in the examples/scripts installation directory. Example scripts are present in the examples/ scripts installation directory
The Dir object provides access to directory structures and their contents o property absPath: String Returns the absolute path o property exists: Boolean Returns true if the directory exists o property name: String Returns the name of the directory o constructor Dir(String aDirPath) Constructs a Dir pointing to the given directory path String aDirPath o constructor Dir(Dir aDir) Constructs a copy of the aDir Dir aDir o function Dir.application(): String Returns the absolute path of the application executable o function cd(String aDirName): Boolean Changes the Dir's directory to dirName String aDirName o function cdUp(): Boolean
27 Changes directory by moving one directory up from the Dir's current directory o function Dir.cleanDirPath(String aDirPath): String Removes all multiple directory separators "/" and resolves any "."s or ".."s found in the path, aDirPath String aDirPath o function Dir.convertSeparators(String aDirPath): String Returns aDirPath with the '/' separators converted to separators that are appropriate for the underlying operating system String aDirPath o function Dir.current(): String Returns the absolute path of the application's current directory o function Dir.drives(): Array Returns a list of the root directories on this system o function entryList(String aWildcard, Number aKind, Number aSortFlags): String Returns a list of the names of all the files and directories in the directory, ordered according to the name and attribute filters String aWildcard - Filter that understands * and ? wildcards Number aKind - Filter option. Combination of the following flags Valid values: {Dir.AccessMask, Dir.All, Dir.Dirs, Dir.Drives, Dir.Executable, Dir.Files, Dir.Hidden, Dir.Modified, Dir.NoSymLinks, Dir.Readable, Dir.RWEMask, Dir.System, Dir.TypeMask, Dir.Writable} Number aSortFlags - Sort option. Combination of the following flags Valid values: {Dir.DirsFirst, Dir.IgnoreCase, Dir.Name, Dir.Reversed, Dir.Size, Dir.SortByMask, Dir.Type, Dir.Unsorted} o function fileExists(String aFileName): Boolean Returns true if the file called aFileName exists String aFileName o function filePath(String aFileName): String Returns the path name of a file in the directory. Does not check if the file actually exists in the directory String aFileName o function Dir.home(): String Returns the absolute path of the user's home directory o function mkdir(String aDirName): Boolean Creates a sub-directory specified by aDirName String aDirName o function mkpath(String aDirPath): Boolean Creates the directory path aDirPath. The function will create all parent directories necessary to
28
Mnova Scripting create the directory String aDirPath o function rmdir(String aDirName): Boolean Removes the directory specified by aDirName String aDirName o function rmpath(String aDirPath): Boolean Removes the directory path aDirPath. The function will remove all parent directories in aDirPath, provided that they are empty String aDirPath o function Dir.root(): String Returns the absolute path of the root directory o function Dir.setCurrent(String aDirPath): Boolean Sets the application's current working directory to aDirPath String aDirPath o function Dir.temp(): String Returns the absolute path of the system's temporary directory o function toString(): String
DocumentWindow:
Represents a document object. The DocumentWindow object is a member of the DocumentWindows collection. The DocumentWindows collection contains all the open document windows. o constructor DocumentWindow(DocumentWindow aDocWin) DocumentWindow aDocWin o function close() Closes the document window o function curPage(): Page Returns current page
See also: setCurPage, setCurPageIndex o function page(Number aIndex): Page Returns the page number aIndex Number aIndex o function pageCount(): Number Number of pages of the document o function selection(): Array Returns array of currently selected page items
29 o function setActive(PageItem aItem) Marks the aItem as active PageItem aItem o function setCurPage(Page aPage) Sets current page to aPage Page aPage See also: curPage, setCurPageIndex o function setCurPageIndex(Number aPageIndex) Sets current page index to aPageIndex Number aPageIndex See also: curPage, setCurPage o function setSelection(Array aItems) Marks the aItems as selected Array aItems o function toString(): String o function update() Refresh the current page
30
Mnova Scripting o function rectangle(Number aWidth, Number aHeight): Rectangle Adds a rectangle to the document Number aWidth - Width Number aHeight - Height o function text(String aText, Boolean aIsHtml): Text Adds a text box to the document String aText - Text Boolean aIsHtml - HTML text o function toString(): String Ellipse Ellipse page item. Inherits PageItem o constructor Ellipse(Ellipse aEllipse) Ellipse aEllipse o function toString(): String
o property name: String Returns the file name o property exists: Boolean Returns true if the directory exists o property size: Number Returns the file size o Constructor File(String aFileName) String aFileName Description:Constructs a new file object to represent the file with the given aFileName o Constructor File(File aFile) File aFile Description:Constructs a copy of the aFile o function open(Number aMode): bool Number aMode: This enum is used to describe the mode in which a file is opened Valid Values: {File.ReadOnly, File.WriteOnly, File.ReadWrite, File.NotOpen} Opens the file using aMode mode, returning true if successful o function close(): Boolean Closes the file and sets its open mode to File. NotOpen o function remove(): Boolean Removes the file. Returns true if successful. The file has to be closed before it is removed o function File.remove(String aFileName): Boolean
31 String aFileName: Removes the file specified by the given aFileName. Returns true if successful o function File.create(String aFileName): Boolean String aFileName: Creates the file specified by the given aFileName. Returns true if successful o function File.exists(String aFileName): Boolean String aFileName: Returns true if the aFileName exists o function File.rename(String aOldFileName, String aNewFileName): Boolean String aOldFileName String aNewFileName Renames the file aOldFileName to aNewFileName. Returns true if successful o function File.copy(String aFileName, String aNewFileName): Boolean String aFileName String aNewFileName Copies the file aFileName to aNewFileName. Returns true if successful o function toString(): String
FileDialog:
The FileDialog object provides methods that allow users to select files or directories
String aStartDirectory String aDialogTitle o function FileDialog.getOpenFileName(String aFileFilter, String aDialogTitle, String
aWorkingDirectory): String The function creates a file open dialog and returns an existing file name selected by the user
String aFileFilter String aDialogTitle String aWorkingDirectory o function FileDialog.getOpenFileNames(String aFileFilter, String aDialogTitle, String
aWorkingDirectory): Array The function creates a multiple file open dialog and returns one or more existing file names selected by the user
String aFileFilter String aDialogTitle String aWorkingDirectory o function FileDialog.getSaveFileName(String aFileFilter, String aDialogTitle, String
2009 MESTRELAB RESEARCH
32
Mnova Scripting aWorkingDirectory): String The function creates a file save dialog and returns a file name selected by the user
String aFileFilter String aDialogTitle String aWorkingDirectory Integral: The Integral objects allow us to get information about the integration analysis. The
objects of type Integrals have the following properties: o Number IntegralValue Description: returns the value of the integral o Number rangeMin Description: the minimum value of the integral range o Number rangeMax Description: the maximum value of the integral range o function Integral( Integral aIntegral): Integral aIntegral: Description: to create an integral o function Integral( SpectrumRegion aSpectrumRegion, NMRSpectrum aSpectrum): SpectrumRegion aSpectrumRegion: NMRSpectrum aSpectrum Description: to report the result of an automatic integral analysis from a region of a spectrum o function toString( ): return
Integrals: The Integral objects allow us to get information about the integration analysis. The
objects of type Integrals have the following properties: o property count: Number Number of integrals o property normValue: Number Integrals normalization factor
o Integrals ( ) Description: Constructs an empty integral list o Integrals ( Integrals aIntegralList) Integrals aIntegralList: Description: constructs the integral list o function at( Number aIndex): return Integral
33 Number aIndex: Description: Returns the integral at the position aIndex o function clear( ): return Description: to clear the integrals o function removeAt( Number aIndex): return Number aIndex: Description: to remove the integral at a determined chemical shift o function append( Integral aIntegral): return Integral aIntegral: Description: to add the integral to the list o function toString( ): return
JList. The JList objects allow us to get the information about the coupling constants values in the
multiplet report. The objects of type JList have the following properties: o Number count Description: number of coupling constants values o Number length Description: number of coupling constants values o JList ( JList aJList) JList aJList: o function at( ): return Number
Description: it returns the chemical shift value o function sort( Boolean bAscending): return Boolean bAscending: Description: it sorts the elements in ascending/descending order o function clear( ): return Description: deletes all the coupling constants o function removeAt( Number aIndex): return Number aIndex: Description: it removes the element o function append( Number aJ): return Number Number aJ: Description: to add the J to the list o function toString( ): return String
34
Mnova Scripting
MainWindow: Here it is a list of the objects related to the Mnova spectral window:
o MainWindow ( MainWindow aMainWnd) MainWindow aMainWnd o function newWindow( ): This function creates a new document window. Because no other statements in the document require the reference to the new window just opened, the statement does not assign its returned value to any variable. This is an acceptable practice in JavaScript if you dont need the returned value of a function or method. o function activeWindow( ): Returns a DocumentWindow object that represents the active document window o function doAction(String aActName) Performs a GUI action String aActName - See list of actions
o function toString( ): This function returns string values (it prints the information on the screen). Every JavaScript core language object and every DOM document object has a toString() method associated with it. This method is designed to render the contents of the object in as meaningful a way as possible. o function newDocument( ): returns a new document.
MessageBox:
The MessageBox object provides a modal dialog with a short message, an icon, and buttons laid out depending on the arguments
o enumeration Buttons: Number = {Abort, Apply, Cancel, Close, Discard, Help, Ignore, No,
NoButton, NoToAll, Ok, Open, Reset, RestoreDefaults, Retry, Save, SaveAll, Yes, YesToAll}
String aText Buttons aButton1 Buttons aButton2 Buttons aButton3 String aTitle o function MessageBox.information(String aText, Buttons aButton1, Buttons aButton2, Buttons
aButton3, String aTitle): Buttons Opens an information message box with the title aTitle, the text aText and the buttons specified. Returns the identity of the button that was activated
35
String aText Buttons aButton1 Buttons aButton2 Buttons aButton3 String aTitle o function MessageBox.question(String aText, Buttons aButton1, Buttons aButton2, Buttons
aButton3, String aTitle): Buttons Opens a question message box with the title aTitle, the text aText and the buttons specified. Returns the identity of the button that was activated
String aText Buttons aButton1 Buttons aButton2 Buttons aButton3 String aTitle o function MessageBox.warning(String aText, Buttons aButton1, Buttons aButton2, Buttons
aButton3, String aTitle): Buttons Opens a warning message box with the title aTitle, the text aText and the buttons specified. Returns the identity of the button that was activated
String aText Buttons aButton1 Buttons aButton2 Buttons aButton3 String aTitle Molecule:
Molecule page item Inherits PageItem
o property atomCount: Number o property bondCount: Number o constructor Molecule(Molecule aMolecule) Molecule aMolecule
36
Mnova Scripting
o function getMolfile(Boolean aOriginal = true): String Boolean aOriginal - If true returns original molfile, otherwise the molfile is created o function toString(): String
Multiplet: The multiplet objects allow us to get the multiplet report. The objects of type Multiplet
have the following properties: o String category Description: Category; multiplet (m), singlet (s), doublet (d) , triplet (t), etc.) o Number delta Description: chemical shift o String name Description: name of the multiplet o Number rangeMin Description: minimum value of the range of the multiplet o Number rangeMax Description: maximum value of the range of the multiplet o Number nH Description: number of Hydrogens o Multiplet (Multiplet aMultiplet) Multiplet aMultiplet: to create a multiplet o Multiplet (SpectrumRegion aSpectrumRegion, String aCategory) SpectrumRegion aSpectrumRegion: String aCategory:
Description: to create a multiplet indicating the region of the spectrum and the corresponding category (s, d, t, etc.) o Multiplet (SpectrumRegion aSpectrumRegion, NMRSpectrum aSpectrum)
37 SpectrumRegion aSpectrumRegion: NMRSpectrum aSpectrum: Description: to report the result of an automatic multiplet analysis from a region of a spectrum o function jList( Boolean aReduced): return Boolean aReduced: Description: returns the coupling constants o function setjList( JList aJList): return JList aJList: Description: to assign a list of coupling constants to a multiplet o function toString( ): return
Multiplets: The multiplets objects allow us to get the multiplet report. The objects of type
Multiplets have the following properties: o Number count Description: Number of multiplets o Multiplets ( Multiplets aMultipletList) Multiplets aMultipletList: o function at( Number aIndex): return Multiplet Number aIndex
Description: Returns multiplet at the position aIndex o function sort( Boolean bAscending): return Boolean bAscending: Description: Sort Ascending/Descending o function clear( ): return Description: delete all the multiplets o function removeAt( Number aIndex): return Number aIndex: Description: delete the multiplet at aIndex chamical shift o append ( Multiplet aMultiplet): return Multiplets aMultiplet: Description: to add the multiplet to the list o function toString( ): return String
38
Mnova Scripting MultipletTable aMultipletTable o function spectrum( ): return Description: spectrum to which the table makes reference function toString( ): return String
NMRPlugin: The NMRPlugin objects allow us to process our NMR spectra. The objects of type
NMRPlugin have the following properties: o NMRPlugin ( NMRPlugin aNMRPlugin) NMRPlugin aNMRPlugin o function activeSpectrum(): NMRSpectrum Returns the active spectrum o function beginModification(NMRSpectrum aSpectrum) Save the current state of a spectrum NMRSpectrum aSpectrum o function endModification(NMRSpectrum aSpectrum) Used with beginModification creates a User Processing Command that allows Do/Undo NMRSpectrum aSpectrum o function multipletTable(): MultipletTable Returns the current Multiplet Table o function peakTable(): PeakTable Returns the current Peak Table o function process(String aProcFile) Reads a processing file and apply it to the active spectrum String aProcFile - File Name o function processSpectrum(NMRSpectrum aSpectrum, String aProcFile) Reads a processing file and apply it to a spectrum NMRSpectrum aSpectrum String aProcFile o function toString(): String
NMRProcessing: The NMRProcessing objects allow us to process the NMR spectra. The
objects of type NMRProcessing have the following properties o Boolean isValid Description: The function isValid informs if the spectrum obtained is correct
39 o NMRProcessing ( ) o function toString( ): return o function getParameter( String aArgumentString): return Variant String aArgumentString: This string has the form function1.function2...functionN.parameter. Description: Returns the value of the aArgumentString processing parameter. For example: Apodization[1].Exp.Value to return the value of the exponential apodization function. In order to see the list of the aArgumentStrings, please click here o function setParameter( String aArgumentString, Variant aValue): return Variant String aArgumentString: This string has the form function1.function2...functionN.parameter Variant aValue: Value Description: Sets the value of the aArgumentString processing parameter.
This script can be used to obtain the desired parameters on your spectrum. You will be able to add or remove any parameter and to change the font by just using HTML code. function spectrumParams() { var spec = new NMRSpectrum( nmr.activeSpectrum() ); var htmlText = "<b>Nucleus</b>: %1 <br/> <b>Frequency: </b> %2 <br/> <b>Pulse Sequence: </b> %3 <br/> <b>psLabel: </b> %4 <br/> <b>Solvent: </b> %5 <br/> <b>Title: </b> %6"; var nuc = spec.getParam("Nucleus[1]"); var freq = spec.getParam("Spectrometer Frequency"); var seqfill = spec.getParam("Pulse Sequence"); var psLabel = spec.getParam("psLabel"); var Solvent = spec.getParam("Solvent"); var Title = spec.getParam("Title"); print(spec.getParam("Nucleus[1]")); print(spec.getParam("Spectrometer Frequency")); print(spec.getParam("Pulse Sequence")); print(spec.getParam("psLabel")); print(spec.getParam("Solvent")); print(spec.getParam("Title")); htmlText=htmlText.arg(nuc).arg(freq).arg(seqfill).arg(psLabel).arg(Solvent).arg(Title); draw.text(htmlText, true); } In this case, the script will print the parameters Nucleus, Spectrum Frequency, Pulse Sequence, psLabel, Solvent and Title. Please bear in mind that getParam function returns only parameters which exist in the table of parameters (including invisible ones). Please make sure that you have these parameters included on the table of parameters (via customization dialog).
NMRSpectrum: The NMRSpectrum objects allow us to get information about our spectra. The
objects of type NMRSpectrum have the following properties:
40
Mnova Scripting NMRSpectrum page item Inherits PageItem o property curSpecIndex: Number Get/set current spectrum index of arrayed experiment. Indexing is zero-based. o property dimCount: Number Number of dimensions o property experimentType: Number o property isReal: Boolean o property originalFormat: String Valid values: {"ASCII", "Bruker Aspect", "Bruker WIN-NMR", "Bruker XWIN-NMR", "Elscint", "GE/Nicolet", "JCAMP-DX", "JEOL Alice", "JEOL Delta", "JEOL EX/GX", "JEOL Lambda", "Lumisys", "MestReC", "MNova", "Nuts Type 1", "Nuts Type 2", "Nuts Type 3", "Old Gemini", "Predictor", "Siemens", "Spinsight", "SWANMR", "Techmag", "Unknown", "Varian", "VHelper"} o property proc: NMRProcessing o property solvent: String o property specCount: Number Returns number of spectra for arrayed experiments o property temperature: Number o property threshold: Number Threshold o property title: String o constructor NMRSpectrum(NMRSpectrum aSpectrum) NMRSpectrum aSpectrum o function autoDetectNoiseRegions(): Array Return a list of noise regions, only for 1D o function corrPearson(NMRSpectrum aSpectrum): Number NMRSpectrum aSpectrum o function count(Number aDim): Number Number of points in the dimension aDim Number aDim o function count(): Number Number of points in the last dimension o function fidImag(Number aIndex): Number Returns the imag value of the aIndex point in the spectrum fid Number aIndex
41 o function fidReal(Number aIndex): Number Returns the real value of the aIndex point in the spectrum fid Number aIndex o function fidSetImag(Number aIndex, Number aValue): Boolean Sets the imag value of the aIndex point in the spectrum fid Number aIndex Number aValue o function fidSetReal(Number aIndex, Number aValue): Boolean Sets the real value of the aIndex point in the spectrum fid Number aIndex Number aValue o function fitToHeight() Fits spectrum intensity to height o function frequency() o function frequency(Number aDim) Number aDim o function getParam(String aParamName): Variant String aParamName - Parameter name as it appears in the table of parameters. If the parameter is N-dimensional then specify the dimension in []. Example: getParam("Nucleus[2]") See also: setParam o function getProperty(String aParam): Variant String aParam - See details See also: setProperty o function horzZoom(Number aFrom, Number aTo) Without parameters makes a full zoom Number aFrom Number aTo o function hz(): Number o function hz(Number aDim): Number Number aDim o function imag(Number aIndex): Number Returns the imag value of the aIndex point in the spectrum data Number aIndex
42
Mnova Scripting o function isFID(Number aDim): Boolean Number aDim o function isReadOnlyParam(String aParam): Boolean String aParam o function isValid(): Boolean Is a valid spectrum object o function isValid(Number aDim): Boolean This dimension is less than dimCount Number aDim o function multiplets(): Multiplets Returns the list of multiplets of the spectrum o function nucleus(Boolean aHtml): String Boolean aHtml o function nucleus(Number aDim, Boolean aHtml): String Returns the nucleus of the dimension, if aHtml is true uses html Number aDim Boolean aHtml o function peaks(): Peaks Returns the list of peaks of the spectrum o function process(NMRProcessing aProc): Boolean Process the spectrum using aProc. Without parameter re-process the spectrum NMRProcessing aProc o function real(Number aIndex): Number Returns the real value of the aIndex point in the spectrum data Number aIndex o function scaleWidth(Number aDim): Number Number aDim o function scaleWidth(): Number o function setImag(Number aIndex, Number aValue): Boolean Sets the imag value of the aIndex point in the spectrum data Number aIndex Number aValue
43 o function setMultiplets(Multiplets aMultipletList) Multiplets aMultipletList o function setParam(String aParamName, Variant aValue) Assigns specified value to the named parameter. This function only allows to alter user defined parameters. String aParamName - Parameter name as it appears in the table of parameters. If the parameter is N-dimensional then specify the dimension in []. Variant aValue See also: getParam o function setPeaks(Peaks aPeakList) Peaks aPeakList o function setProperty(String aParam, Variant aValue) String aParam - See details Variant aValue See also: getProperty o function setReal(Number aIndex, Number aValue): Boolean Sets the real value of the aIndex point in the spectrum data Number aIndex Number aValue o function toString(): String o function vertZoom(Number aFrom, Number aTo) Without parameters makes a full zoom Number aFrom Number aTo o function zero(Number aDim): Number Number aDim o function zero(): Number o function zoom(Number aHFrom, Number aHTo, Number aVFrom, Number aVTo) Without parameters makes a full zoom Number aHFrom Number aHTo Number aVFrom
44
Description: This function returns the number of objects in the current page o function itemCount( ): retrieves the number of elements currently displayed in the page. o function item( Number aIndex, String aType): return Number aIndex: Number of elements String aType: Element Type Description: Returns the item of the page o function item( Number aIndex): return Number aIndex: Number of the element Description: Returns an item of the page o function addItem( PageItem aPageItem): return PageItem aPageItem: Item to be added Description: this function adds an item to the page o function update( ): return
45 Description: The update function will be used to refresh the page o function toString( ): return String
PageItem: Below you will find the list of the objects related with the item of a page.
Item of a page Inherited by: Molecule, NMRSpectrum, Text o Number angle Description: Width of the item o Number bottom Description: Returns the bottom margin of the item o Number height Description: Height of the itemNumber o left Description: Returns the left margin of the item o String name Description: Type of the element (arrow, ellipse, rectangle, polygon, image, text, NMR spectrum, molecule, OLE Object or Mass spectrum") o Number right Description: Returns the right margin of the item o Number top Description: Returns the top margin of the item o String uuid Description: The UUID structure defines Universally Unique Identifiers (UUIDs). UUIDs provide unique designations of objects such as interfaces, manager entry-point vectors, and client objects. A string UUID contains the character-array representation of a UUID. A string UUID is composed of multiple fields of hexadecimal characters. Each member has a fixed length, and fields are separated by the hyphen character. o Number width Description: Width of the element
o PageItem ( PageItem aPageItem) PageItem aPageItem o function toString( ): return String o function setProperty( String aParamName, Variant aValue): return String aParamName: Variant aValue: Description: The SetProperty sets the specified parameter with the corresponding value. In order to see the list of the aParamName, please click here o function getProperty( String aParamName, String aUnit): return Variant
46
Mnova Scripting String aParamName: String aUnit: Valid Values: { "mm" "cm" "inches" } Description: Retrieves parameter in the selected unit (mm, cm, inches). In order to see the list of the aParamName, please click here o function update( ): return Description: Redraw the item
Peak: The Peaks objects allow us to get information about the chemical shift of the signals. The
objects of type Peak have the following properties: o Number intensity Description: returns the intensity of the peak o Number type Description: returns the type of the peak. Valid Values: { "Peak.Compound" "Peak.Artifact" "Peak.Impurity" "Peak.Solvent" "Peak.CS_Ref" "Peak.Quantification_Ref" } o Number kind Description: returns the kind of the peak. Valid Values: { "Peak.Maximum" "Peak.Minimum" } o Peak ( Peak aPeak) Peak aPeak:
Description: Copy the peak o Peak (Number aPos, Number aIntensity) Number aPos: Number aIntensity: Description: to create a peak with a determined chemical shift (Number aPos) and intensity (Number aIntensity) o Peak (Number aPos, NMRSpectrum aSpectrum) Number aPos: Number NMRSpectrum aSpectrum: Description: too add a peak at a chemical shift 'aPos' in a 1D-NMR spectrum. The intensity of the peak is refilled with the spectral data o Peak (Number aPos1, Number aPos2, Number aIntensity) Number aPos1: Number aPos2: Number aIntensity: Description: to create a peak in a 2D-NMR spectrum with a determined chemical shift (Number aPos) and intensity (Number aIntensity)
2009 MESTRELAB RESEARCH
47 o Peak (Number aPos1, Number aPos2, NMRSpectrum aSpectrum) Number aPos1: Number aPos2: NMRSpectrum aSpectrum: Description: too add a peak at a chemical shift 'aPos' in a 2D-NMR spectrum. The intensity of the peak is refilled with the spectral data o function delta( Number aDim): return Number aDim: Description: returns the chemical shift value of the peak o function delta( ): return Description: returns the chemical shift value of the peak o function toString( ): return
Peaks: The Peaks objects allow us to get information about the Peak Picking. The objects of type
Peak have the following properties: o Number count Description:
o Peaks ( ) Description: Empty peak list o Peaks ( Peaks aPeakList) Peaks aPeakList: Description: o Peaks (NMRSpectrum aSpectrum, SpectrumRegion aRegion) NMRSpectrum aSpectrum: SpectrumRegion aRegion: Description: o function at( Number aDim): return Peak Number aDim: Description: Returns the peaks at the position aDim o function sort( Boolean bAscending): return Boolean bAscending: Description: it sorts the peaks in ascending/descending order o function sort( Boolean bHAscending, Boolean bVAscending): return
48
Mnova Scripting Boolean bHAscending: Boolean bVAscending: Description: it sorts the peaks in ascending/descending order. In 2D, the user can select a different sort in each dimension. o function clear( Number aIndex): return Number aIndex: Description: clear the peaks o function removeAt( Number aIndex): return Number aIndex: Description: remove the peaks at a determined chemical shift o function append( Peak aPeak): return Peak aPeak: Description: to add the peak to the list o function toString( ): return
Description: returns the spectrum to which the peak table makes reference o function toString( ): return
o function Process.execute(String aProgram, Array aArguments): Number String aProgram Array aArguments Description: Starts the program aProgram with the arguments aArguments in a new process, waits for it to finish, and then returns the exit code of the process o function Process.startDetached(String aProgram, Array aArguments): Boolean String aProgram Array aArguments Description: Starts the program aProgram with the arguments aArguments in a new process, and detaches from it. Returns true on success Rectangle: Rectangle page item Inherits PageItem
Serialization: is the process of converting an object into a form that can be readily transported.
For example, open and save documents. o Serialization ( Serialization aSerialization) Serialization aSerialization o function open( String aFileName): return Boolean String aFileName: File Name
Description: this function is used to open a file o function open( Array aFileNameList): return Array aFileNameList Description: Opens an array of files o function save( String aFileName, String aFormat): return String aFileName String aFormatValid Values: { "mnova" "mnlt" "mncs" "pdf" "ps" "eps" "bmp" "jpg" "mrc" "txt" "jcamp" "png" "ppm" "svg" "tiff" "xpm" "xbm" } Description: Saves a document (different formats available). o function toString( ): return String
Settings: You will find below a list of the objects related with saving and reading settings:
o Settings ( Settings aSettings) Settings aSettings o function value( String aKey, Variant aDefaultValue): return Variant String aKey: name of the key Variant aDefaultValue: Default value if the key doesn't exist or can't be read
Description: Read the value of a settings key o function setValue( String aKey, Variant aValue): return String aKey: a Settings key Variant aValue: value to be saved o function toString( ): return
50
Mnova Scripting The objects of type SpectrumRegion have the following properties o SpectrumRegion ( SpectrumRegion aSpectrumRegion) SpectrumRegion aSpectrumRegion: o SpectrumRegion ( Number aFrom, Number aTo) Number aFrom: Number aTo: Description: limits of the spectrum in 1D-NMR o SpectrumRegion ( Number aFrom1, Number aTo1, Number aFrom2, Number aTo2) Number aFrom1: Number aTo1: Number aFrom2: Number aTo2: Description: limits of the spectrum in 2D-NMR o function toString( ): return String o function from( Number aDim): return Number aDim: Description: Returns the from of the region in the aDim dimension o function to( Number aDim): return Number aDim: Description: Returns the to of the region in the aDim dimension o function dim( ): return Description: Dimension of the region
Text:
Text page item Inherits PageItem
o property htmlText: String o property plainText: String o constructor Text(Text aTextItem) Text aTextItem o function toString(): String
TextStream: The TextStream object provides an interface for reading and writing text to a file.
Example scripts are present in the examples/scripts installation directory. o property pos: Number
2009 MESTRELAB RESEARCH
51 Gets/sets the file position corresponding to the current position of the stream. Returns -1 if an error occurs o property precision: Number Gets/sets the current real number precision, or the number of fraction digits TextStream will write when generating real numbers o property notation: Number Gets/sets the real number notation Valid Values: {TextStream.nScientific, TextStream.nFixed, TextStream.nSmart} o Constructor TextStream(File aFile) File aFile Description:Constructs a TextStream that operates on aFile o Constructor TextStream(TextStream aStream) TextStream aStream Description:Constructs a TextStream that is a copy of aStream o function atEnd(): Boolean Returns true if there is no more data to be read from the TextStream o function write(Variant aParam1, ..., Variant aParamN): Boolean Variant aParam1 ... Variant aParamN Writes the arguments to the stream o function readLine(): String Reads one line of text from the stream and returns it o function readString(): String Reads a word from the stream and returns it. Words are separated by whitespace o function readNumber(): Number Reads a number from the stream and returns it o function read(Number aMaxLen): String Number aMaxLen Reads at most aMaxLen characters from the stream, and returns the data read as a String o function readAll(): String Reads the entire content of the stream, and returns it as a String o function skipWhiteSpace() Reads and discards whitespace from the stream until either a non-space character is detected, or until atEnd() returns true o function skip(Number aSize) Number aSize Skips the aSize bytes in the stream o function toString(): String
52
Mnova Scripting Below you will find a list of the argument strings (which have the form function1.function2...functionN.parameter) that you will be able to use in your processing scripts. These parameters appear in the graphical interface of the software (in the Processing / Full Processing menu) and are described in depth in the manual of Mnova (hyperlink a processing menu).
53
Boolean Rev[aDimension]: Reverse Boolean Transpose: Boolean Tilt45: Boolean CosySym: Symmetrize COSY-like Boolean JResolv: Symmetrize JResolved Boolean Invert: Boolean Reducet1: Reduce t1 Noise Boolean Inadequate: function DC: Drift Correction o Boolean Apply: o Number Value: Number of tail points
54
Mnova Scripting
Apodization
function Apodization[aDimension]: Apodization Apodization[].Apply: Boolean Apodization[].ConDif.Apply: Boolean Apodization[].ConDif.Value1: Number Apodization[].ConDif.Value2: Number Apodization[].ConDif.Value3: Number Apodization[].Exp.Apply: Boolean Apodization[].Exp.Value: Number Apodization[].FP.Apply: Boolean Apodization[].FP.Value: Number Apodization[].Gauss.Apply: Boolean Apodization[].Gauss.Value: Number Apodization[].Han.Apply: Boolean Apodization[].Han.Value: Number Apodization[].Lg.Apply: Boolean Apodization[].Lg.Value: Number Apodization[].Lr.Apply: Boolean Apodization[].Sine.Apply: Boolean Apodization[].Sine.Value: Number Apodization[].Sine2.Apply: Boolean Apodization[].Sine2.Value: Number Apodization[].Traf.Apply: Boolean Apodization[].Traf.Value: Number Apodization[].Trap.Apply: Boolean Apodization[].Trap.Value: Number
BC
2009 MESTRELAB RESEARCH
55 Baseline Correction
BC[].algorithm: String
Valid values: {"Bernstein", "PolyFit", "Whittaker"}
Binning
Binning
Binning[].Apply: Boolean Binning[].From: Number Binning[].Full: Boolean Binning[].To: Number Binning[].Width: Number
Comp
Compression
Comp.Ratio: Number
CosySym CosySym: Boolean
Cuts
Cuts[].Apply: Boolean Cuts[].List: Array - Array of SpectrumRegion
DC
Drift Correction DC.Apply: Boolean DC.Value: Number
56
Mnova Scripting
DS
Diagonal Supression DS.Apply: Boolean DS.Diagonal: String Valid values: {"Double", "Inverted", "Quad", "Std"} DS.Method: String Valid values: {"Convolution", "ShiftedConv", "Wavelet"} DS.Selectivity: Number
FT
Fourier Transform FT[].Hyper: Boolean FT[].Invert: Boolean FT[].Protocol: String Valid values: {"Echo-Antiecho", "Hyper", "None"} FT[].Quadrature: Boolean FT[].RealFT: Boolean
Inadequate
Inadequate: Boolean
Integration
Integration.Apply: Boolean Integration.Auto.AutoSensitivity: Boolean Integration.Auto.MergeDistance: Number Integration.Auto.MinArea: Number Integration.Auto.Sensitivity: Number Integration.Method: String Valid values: {"Auto", "Predefined"} Integration.regions: SpectrumRegionArray
57
Invert
Invert: Boolean
JResolv
JResolv: Boolean
LP
Linear Prediction LP[].Backward.Apply: Boolean LP[].Backward.First: Number LP[].Backward.Last: Number LP[].BasisPoints: Number LP[].Coefficients: Number LP[].Forward.Apply: Boolean LP[].Forward.First: Number LP[].Forward.Last: Number LP[].method: String Valid values: {"Burg", "Debug", "Toeplitz", "ZhuBax"} LP[].size: Number
Mult
Multiplet Analysis Mult.Apply: Boolean
Norm
Normalize Norm.Apply: Boolean Norm.Method: String Valid values: {"LargestPeak", "Manual", "PeakPos", "PeakRange", "TotalArea"} Norm.PeakPos: Number Norm.Range: NumberArray Norm.Value: Number
58
Mnova Scripting
PC
Phase Correction PC[].Method: String Valid values: {"Global", "Magnitude", "Manual", "Metabonomics", "NoPC", "Power", "Selective"} PC[].Ph0: Number - In radians PC[].Ph1: Number - In radians
PP
Peak Picking PP.Apply: Boolean PP.f1Max: Number PP.f2Max: Number PP.MaxPeaks: Number PP.MergeMult: Boolean PP.Parabolic: Boolean PP.PeakType: String Valid values: {"All", "Negative", "Positive"} PP.Sensitivity: Number
Reducet1
Reducet1: Boolean
Ref
Reference Ref[].Apply: Boolean Ref[].AutoTune: Boolean Ref[].shift: Number Ref[].Torerance: Number
Rev
Reverse Rev[]: Boolean
59
Smooth
Smooth Smooth[].Apply: Boolean Smooth[].Average.Span: Number Smooth[].Method: String Valid values: {"Average", "SG", "Wavelet", "Whittaker"} Smooth[].SG.Order: Number Smooth[].SG.Width: Number Smooth[].Wavelet.Fraction: Number Smooth[].Wavelet.Scales: Number Smooth[].Wavelet.Soft: Boolean Smooth[].Wavelet.Universal: Boolean Smooth[].Whittaker.AutoLambda: Boolean Smooth[].Whittaker.Lambda: Number
SS
Signal Supression SS.Apply: Boolean SS.Method: String Valid values: {"Convolution", "ShiftedConv", "Wavelet"} SS.Selectivity: Number SS.Signals: NumberArray
Tilt45
Tilt45: Boolean
Transpose
Transpose Transpose: Boolean
Trunc
Truncate
2009 MESTRELAB RESEARCH
60
Mnova Scripting
ZF
Zero Filling ZF[].size: Number
61
1.4
Mnova Properties
Below you will find the spectrum properties (aParamName) that you can manage via script, by using the functions SetProperty and GetProperty. You will find an example script in the examples/scripts installation directory and also in the 'Script Samples' chapter. All of these properties can also be selected by using the GUI:
62
Mnova Scripting
Axes
axes.color: String Valid values: {"#RRGGBB", "Color Keywords"} axes.font: String axes.horizontal.label: String axes.horizontal.maxdigits: Number axes.horizontal.showlabel: Boolean axes.horizontal.units: String Valid values: {"hz", "ppm", "pt", "sec"} axes.margin.cm: Number axes.margin.inches: Number axes.margin.mm: Number axes.vertical.label: String axes.vertical.maxdigits: Number axes.vertical.showlabel: Boolean axes.vertical.units: String Valid values: {"hz", "ppm", "pt", "sec"}
Background
background.color: String Valid values: {"#RRGGBB", "Color Keywords"} background.opacity: Number
Contours
contours.negativenumber: Number contours.positivenumber: Number contours.scaling: Number
Curve
curve.color: String Valid values: {"#RRGGBB", "Color Keywords"} curve.linestyle: String
Grid
grid.color: String Valid values: {"#RRGGBB", "Color Keywords"} grid.showframe: Boolean grid.showhorizontal: Boolean grid.showover: Boolean grid.showtracesframe: Boolean grid.showvertical: Boolean
Integrals
integrals.curve.color: String Valid values: {"#RRGGBB", "Color Keywords"} integrals.curve.margin: Number integrals.curve.maxheight: Number integrals.curve.shape: String Valid values: {"Ellipse", "Rectangle"} integrals.curve.show: Boolean integrals.label.color: String Valid values: {"#RRGGBB", "Color Keywords"} integrals.label.decimals: Number integrals.label.font: String integrals.label.margin: Number integrals.label.position: String Valid values: {"Curve", "Segment"} integrals.label.show: Boolean integrals.show: Boolean
Legend
legend.show: Boolean legend.textwidth.cm: Number
64
Mnova Scripting
legend.textwidth.inches: Number legend.textwidth.mm: Number legend.width.cm: Number legend.width.inches: Number legend.width.mm: Number
Multiplets
multiplets.decimals: Number multiplets.font: String multiplets.fontcolor: String Valid values: {"#RRGGBB", "Color Keywords"} multiplets.labelcolor: String Valid values: {"#RRGGBB", "Color Keywords"} multiplets.margin: Number multiplets.show: Boolean
Palette
palette: String
Peaks
peaks.color: String peaks.decimals: Number peaks.font: String peaks.pointer: String Valid values: {"Arrow", "Line", "None"} peaks.show: Boolean peaks.showtick: Boolean peaks.units: String Valid values: {"hz", "ppm"}
You will find below an example of a script to change some properties of your spectra. In this case, the colour of the spectrum will be changed to red, the peaks font to Arial and the integral curves will be showed. function properties() {
65 var spec = new NMRSpectrum(nmr.activeSpectrum()); spec.setProperty("curve.color","red"); spec.setProperty("peaks.font","Arial"); spec.setProperty("integrals.curve.show", true); spec.update(); mainWindow.activeWindow().update(); }
1.5
GUI Actions
You will find below the GUI actions that you will be easily able to run with an easy script. The script below will apply an "Auto Peak Picking" analysis: function doActionTest() { mainWindow.doAction("nmrAutoPeakPicking"); } If you want to run any other action just replace the red action with any action of the the list below. Of course, you can add to the script as many actions as you want.
66
Mnova Scripting nmrAssignment65Cu: 65Cu nmrAssignment6Li: 6Li nmrAssignment7Li: 7Li nmrAutomaticPhaseCorrectionGlobal: Auto (Global Method) nmrAutomaticPhaseCorrectionMetabonomics: Auto (Metabonomics) nmrAutomaticPhaseCorrectionSelective: Auto (Selective Method) nmrAutoPeakPicking: Automatic nmrBaselineCorrection: Baseline Correction... nmrBinning: Binning... nmrBitmapPlot: Bitmap Plot nmrCompare: Predict Compare nmrCompression: Compression... nmrContourPlot: Contour Plot nmrDeleteAllPeaks: Delete All nmrDeleteCurrentIntegral: Delete Integral nmrDeleteCurrentMultiplet: Delete Multiplet nmrDiagonalSuppression: Diagonal Suppression... nmrDriftCorrection: Drift Correction... nmrEditIntegral: Edit Integral... nmrEditMultiplet: Edit Multiplet... nmrExtractActiveSpectrum: Extract Active Spectrum nmrExtractAllSpectra: Extract All Spectra nmrFilterFalsePosJCor: Filter False Positives nmrFitHorzTraceToHeight: Fit Horizontal Trace to Height nmrFitTracesToHeight: Fit Traces to Height nmrFitVertTraceToHeight: Fit Vertical Trace to Height nmrFT: Fourier Transform... nmrFullAutoBaselineCorrection: Full Auto nmrFullProcessing: Full Processing... nmrHighlightActiveSpec: Highlight Active Spectrum nmrHighPassFilter: Signal Suppression... nmrIntegrateAuto: Autodetect Regions nmrIntegrateDeleteAll: Delete All nmrIntegrateDeleting: Delete Manually nmrIntegrateManual: Manual nmrIntegrateOptions: Options... nmrIntegratePredefined: Predefined Regions nmrIntegrateShow: Show Integrals nmrInvert: Invert nmrJCor: J-Correlator... nmrLinearCombination: Arithmetic... nmrMagnitude: Magnitude nmrManualPeakPicking: Manual nmrManualPhaseCorrection: Manual Correction nmrMultipletCopyC: Copy Multiplets nmrMultipletDeleteAll: Delete All Multiplets nmrMultipletReportC: Report Multiplets nmrMultipletsAuto: Automatic nmrMultipletsDeleteAll: Delete All nmrMultipletsManual: Manual nmrMultipletsShow: Show Multiplets nmrNormalize: Normalize... nmrPeakByPeak: Peak by Peak nmrPeakDeleting: Delete Manually
67 nmrPeakPickingCopy: Copy nmrPeakPickingOptions: Options... nmrPeakPickingReport: Report nmrPeaksShow: Show Peaks nmrPower: Power nmrPredictHighlight: Predict nmrPredictHighlightShow: Show Highlighting nmrReducet1Noise: Reduce t1 Noise nmrReference: Reference nmrResEnh: Resolution Booster... nmrReverseBothAxes: Both Axes nmrReverseHorizontally: Horizontally nmrReverseVertically: Vertically nmrScaleArrayed: Scale Stacked Spectra... nmrSelectTraces: Select Traces Graphically nmrSetupArrayed: Setup Stacked Spectra... nmrShowFT1: Spectrum after 1st FT nmrShowFT2: Spectrum after 2nd FT nmrShowHorzTrace: Show Horizontal Trace nmrShowOriginalFID: Original FID nmrShowProcessedFID: Processed FID nmrShowTraces: Show Traces nmrShowVertTrace: Show Vertical Trace nmrSmooth: Smoothing... nmrSpectralMoments1stOrder: First Order nmrSpectralMoments2ndOrder: Second Order nmrSpectralMomentsNone: Do Not Apply nmrStackedPlot: Stacked Plot nmrSuperimposedFromSelection: Superimpose Spectra nmrSymmetrizeJResolved: J-Resolved nmrSymmetrizeRealSquareMatrix: COSY-like nmrTilt45: Tilt 45 nmrTracesSetup: Setup... nmrTranspose: Transpose nmrTruncate: Truncate... nmrVisualVerification: HSQC nmrVisVerShowAll: Show All Rectangles nmrVisVerShowGreens: Show Green Rectangles nmrVisVerShowReds: Show Red Rectangles nmrVisVerShowYellows: Show Yellow Rectangles nmrWhiteWashedPlot: Whitewash Stacked Plot nmrZeroFilling: Zero Filling and LP...
68
Mnova Scripting drwFontUnderline: Underline drwModeArrow: Arrow drwModeEllipse: Ellipse drwModeLine: Line drwModePoly: Polygon drwModeRect: Rectangle drwModeSelect: Select drwModeText: Text
69 action_View_Cut_restore: &Restore action_View_DecIntensity: &Decrease Intensity action_View_Fit2Height: &Fit to Height action_View_FullView: &Full View action_View_History: &History... action_View_IncIntensity: &Increase Intensity action_View_LargeIcons: Large &Icons action_View_NextPage: Ne&xt Page action_View_Pan: &Pan action_View_PreviousPage: Pre&vious Page action_View_Rulers: &Rulers action_View_Tables_Close_All: Close &All action_View_Zoom_FullSpec: &Full Spectrum action_View_Zoom_in: Zoom &In action_View_Zoom_Manual: &Manual Zoom action_View_Zoom_out: Zoom &Out actionAlignBottom: Align Bottom actionAlignCenterHorz: Center Horizontally actionAlignCenterVert: Center Vertically actionAlignLeft: Align Left actionAlignPaperCenter: Center on Page actionAlignPaperCenterHorz: Center on Page Horizontally actionAlignPaperCenterVert: Center on Page Vertically actionAlignRight: Align Right actionAlignTop: Align to Top actionBringDown: Send Down actionBringToBack: Send to Back actionBringToFront: Bring to Front actionBringUp: Bring Up actionCustomize_Context_Menus: Customize Context Menus... actionTileHorizontally: Tile &Horizontally actionTileSpectraHorizontally: Tile Spectra Hori&zontally actionTileSpectraVertically: Tile Spectra Ve&rtically actionTileVertically: Tile &Vertically Another example of this tool to apply several actions to all the spectra opened in the same document:
70
Mnova Scripting
This script will generate a stack plot of all the opened spectra. You can use this script to run whatever doAction you d
1.6
"C:\Program Files\Mestrelab Research S.L\MestReNova\MestReNova.exe" "C:\Program \Mestrelab Research S.L\MestReNova\scripts\myScript.qs" -sf "myFunction",0.1,10,true,off In this case, MNova will run myFunction(0.1,10,true,"off") from myScript.qs with the arguments
Files
71 specified. No spaces after commas! 3. mestrenova -sf functionName,arg1,arg2,...argN In this case it is supposed that the function functionName is taken from one of the script directories, either MNova standard or user defined. Note: Command line arguments are separated with white-spaces. This is why it is important not to use white-spaces after commas. If script arguments contain white-spaces then use quotes: "C:\Program Files\Mestrelab Research S.L\MestReNova\MestReNova.exe" -sf openSpecWithMols,"C:\1H\fid". This doesn't need quotes: "C:\Program Files\Mestrelab Research S.L\MestReNova\MestReNova.exe" -sf openSpecWithMols,C:\1H\fid Complex case example: mestrenova specPath1 specPath2 -sf functionName,arg1,arg2 specPath3 specPath4 This will first open the spectra specPath1, specPath2, specPath3, specPath4. Next, apply the script: functionName(arg1, arg2)
1.7
Scripts Samples
Other Scripts samples:
All the scripts are present in the examples/scripts installation directory. Some of them will be described in this chapter. Please bear in mind that it is also possible to run scripts from the command line, just by typing the path where the Mnova .exe file and the script are located and -sf "name of the script function": "mestrenovaPathname" "scriptPathname" -sf "scriptFunctionToRun" For example: "C:\Program Files\Mestrelab Research S.L\MestReNova\MestReNova.exe" \Mestrelab Research S.L\MestReNova\scripts\myScript.qs" -sf "myFunction" It is also possible to specify arguments: "C:\Program Files
"C:\Program Files\Mestrelab Research S.L\MestReNova\MestReNova.exe" "C:\Program \Mestrelab Research S.L\MestReNova\scripts\myScript.qs" -sf "myFunction",0.1,10,true,off In this case, MNova will run myFunction(0.1,10,true,"off") from myScript.qs with the arguments specified. No spaces after commas!
Files
Do not forget to visit our script repository at: http://www.mestrec.com/recursos.php?idc=11&i18n=1 Open and Save Document Script: Lets take a look at an easy script which you can use to open a . mnova file and export it as a PDF file. In this case, we will open a .mnova file named 'Dimethoxy': function openSaveDocument() { //If the open function gives a 'false', it will mean that Mnova does not recognize the file if( serialization.open("/dimethoxy.mnova") ) { print("File Opened"); //Lets see what the document contains //To get the active document var dW = new DocumentWindow(Application.mainWindow.activeWindow()); //To get information about the number of the pages of the document print(dW.pageCount()); //To print the number of items and the description of them for each page
2009 MESTRELAB RESEARCH
72
Mnova Scripting for( var i = 0; i < dW.pageCount(); i++ ) { var pag = new Page(dW.page(i)); print ( "Page number "+i+" has "+pag.itemCount()+" items" ); for( var j = 0; j < pag.itemCount(); j++ ) { var item = new PageItem(pag.item(j)); print( "\t"+item.name ); //If the item is an NMR spectrum, it will print "This is an NMR spectrum", if not, the function isValid will give a "False" var spectrum = new NMRSpectrum(item); if(spectrum.isValid() ) print( "This is an NMR Spectrum" ); } } //To save as a PDF file serialization.save("/dimethoxy.pdf", "pdf"); } } To run this script, just copy it to the 'Edit Script' dialog box and type "openSaveDocument()" in the combobox. Please bear in mind that, you will need to write the corresponding path of the saved Mnova file in the line 4 of the script (in this case the dimethoxy.mnova file was saved in C:\ ). As you can see in the script, if Mnova does not recognize the spectrum, you will obtain a 'False' message in the output due to the statement: if( serialization.open("/dimethoxy.mnova") ) The line print("File Opened"); will give the corresponding message in the output, as you can see in the picture below:
73
The object 'Application' of the variable var dW = new DocumentWindow(Application.mainWindow. activeWindow()); gives us the 'Active Window' of the 'Main Window', that is to say, the document which we can see in the screen. The function print(dW.pageCount()); is used to know the number of the pages of the document. The following lines of the script are used to obtain information about the items included on the document. For example the function pageCount is used to know the number of pages of the document. The variable var pag = new Page(dW.page(i)); will analyze page by page to find the information. The line print ( "Page number "+i+" has "+pag.itemCount()+" items" ); will print the corresponding phrase in the output, following the number of the page (+i+) and the number of the items included in the page for( var j = 0; j < pag.itemCount(); j++ ). The variable var item = new
74
Mnova Scripting PageItem(pag.item(j)); will inform about the type of the item, and the function print( "\t"+item.name ); will print the name of the item. In this example (as we can see in the output of the picture below), the document has 2 pages; page 0 has 1 item, which is an NMR spectrum and page 1, has 5 items (NMR Spectrum, molecule, arrow, rectangle and ellipse). The variable var spectrum = new NMRSpectrum(item); will rebuild the active spectrum, and if the item is an NMR spectrum, it will print "This is an NMR spectrum", if not, the function isValid will give a "False" due to the lines: if(spectrum.isValid() ) // print( "This is an NMR Spectrum" );. Finally, the plugin serialization.save("/dimethoxy.pdf", "pdf"); will save the document as a PDF file in the specified location of the hard-disk (in this case, the PDF will be saved in C:\). Open a spectrum with molecules: It is possible to open spectra with molecules by using the openSpecWithMols.qs example script. You will need to add the directory where you have the script to the Scripts directories (by using the Script menu). Then restart Mnova and you will be able to run the script from the command line by typing: MestReNova path sf openSpecWithMols,Spectrum path For example: "C:\Program Files\Mestrelab Research S.L\MestReNova\MestReNova.exe" -sf openSpecWithMols,"C:\1H\fid" Where, the yellow is the path where you have installed Mnova and the red is the path of the spectrum that you want to open. // Opens a spectrum at aSpecPath and all the molfiles located in the same directory function openSpecWithMols(aSpecPath) { var dirPath = File.absDirPath(aSpecPath); var dir = Dir(dirPath); dir.cdUp(); var files = getMaskFiles(dirPath, dir.absPath, "*.mol", "*", false); files.push(dirPath); serialization.open(files); } Import_Process_Save_Loop Script: This script can be used to apply a previously existing 'full processing' template (in this case, it is a template saved at C:/temp/proc.mnp) to several spectra (saved at C:/spectra/ and inside sub-folders with the extension ".fid", for example: "C:/spectra/1H.fid") and to save the result in different files formats (.mnova, .pdf and .txt). This script in only valid for these spectra containing a FID file. /****************************************************************************************************** Copyright (C) 2007 Mestrelab Research S.L. All rights reserved. This file is part of the MNova scripting toolkit. Authorized users of MNova Software may use this file freely, but this file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. *****************************************************************************************************/ // This example function demonstrates how to apply some processing to a set of spectral files and to save the result in the different file formats. function import_process_save_loop()
2009 MESTRELAB RESEARCH
75 { const dirName = "c:/spectra"; // Source directory with spectra to be processed. const resultDirName = dirName; // Destination directory where processed spectra should be put. const procName = "c:/temp/proc.mnp"; // Processing file. It must be created in the Full Processing dialog of MestReNova. const fileMask = "fid"; // This mask specifies files to be processed. const dirMask = "*.fid"; // This mask specifies directories to be scanned for spectra. var dir = new Dir(dirName); if (!dir.exists) { MessageBox.critical("Directory " + dirName + " does not exist.",MessageBox.Ok); return; } dir.cdUp(); // The below function getMaskFiles is located in the files.qs script. // If you run import_process_save_loop from QSA Workbench then it is necessary to introduce getMaskFiles to the interpreter by importing files.qs. var files = getMaskFiles(dirName, dir.absPath, fileMask, dirMask, true); for(var i = 0; i < files.length; i++) { var dw = new DocumentWindow(Application.mainWindow.newWindow()); // Create new document window if (serialization.open(files[i])) { nmr.process(procName); const toReplace = new RegExp("[/|:]", "g"); fileName = resultDirName + "/" + files[i].replace(toReplace, "_"); // Generate a filename for processed spectrum. serialization.save(fileName+".mnova", "mnova"); // MestReNova file format serialization.save(fileName+".pdf", "pdf"); // Adobe PDF file format serialization.save(fileName+".txt", "ascii"); // ASCII print(fileName); // Prints file name in the debug window } dw.close(); // Close document window of processed spectrum } }
Parameters Script: This script can be used to obtain the desired parameters on your spectrum. You will be able to add or remove any parameter and to change the font by just using HTML code. function spectrumParams() { var spec = new NMRSpectrum( nmr.activeSpectrum() ); var htmlText = "<b>Nucleus</b>: %1 <br/> <b>Frequency: </b> %2 <br/> <b>Pulse Sequence: </b> %3 <br/> <b>psLabel: </b> %4 <br/> <b>Solvent: </b> %5 <br/> <b>Title: </b> %6"; var nuc = spec.getParam("Nucleus[1]"); var freq = spec.getParam("Spectrometer Frequency"); var seqfill = spec.getParam("Pulse Sequence"); var psLabel = spec.getParam("psLabel"); var Solvent = spec.getParam("Solvent"); var Title = spec.getParam("Title");
76
Mnova Scripting print(spec.getParam("Nucleus[1]")); print(spec.getParam("Spectrometer Frequency")); print(spec.getParam("Pulse Sequence")); print(spec.getParam("psLabel")); print(spec.getParam("Solvent")); print(spec.getParam("Title")); htmlText=htmlText.arg(nuc).arg(freq).arg(seqfill).arg(psLabel).arg(Solvent).arg(Title); draw.text(htmlText, true); } In this case, the script will print the parameters Nucleus, Spectrum Frequency, Pulse Sequence, psLabel, Solvent and Title. Please bear in mind that getParam function returns only parameters which exist in the table of parameters (including invisible ones). Please make sure that you have these parameters included on the table of parameters (via customization dialog). Fid Test Script: you will get information about the real and the imaginary part of the FID by running this script: function fidTest() { var spec = new NMRSpectrum( nmr.activeSpectrum() ); print(spec.fidImag(0)); if( spec.fidSetImag(0,0) ) print(spec.fidImag(0)); print(spec.fidReal(0)); if(spec.fidSetReal( 0, 0 ) ) print(spec.fidReal(0)); spec.process(); mainWindow.activeWindow().update(); } The command print(spec.fidImag(0)) will return the value of the imaginary part of the FID at the aIndex point (in this case; 0. You can type any number from zero to the number of points of your spectrum), whilst the line print(spec.fidReal(0)); will give you the value of the real component. The object fidsetImag; sets the imaginary value of the aIndex point of the spectrum fid. Integral Test Script: This script can be used to get information about the integrals of the spectrum: function integralTest() { var spec = new NMRSpectrum( nmr.activeSpectrum() ); var intList = new Integrals(spec.integrals()); print(intList); print(intList.count); print(intList.normValue); var myInt = new Integral(intList.at(0)); print(myInt); print(myInt.rangeMax(1)); print(myInt.rangeMin(1)); if( spec.dimCount > 1 ) { print(myInt.rangeMax(2)); print(myInt.rangeMin(2)); }
77 print("Integral Value "+myInt.integralValue()); print("Normalized value "+myInt.integralValue(intList.normValue)); var sReg = new SpectrumRegion(7.2, 7.5); var newInt = new Integral( spec, sReg, false ); print(newInt); print(newInt.integralValue()); spec.integrals().append(newInt); spec.process(); } The first part of the script is used to count the integrals and to report the normalized value applied to the integrals (in the list 'intList'). With the second part of the script, the user is able to select any integral of the list (in this case the integral which appears in the first position, if we wanted to select the second integral, we should have to type var myInt = new Integral(intList.at(1));). Then the scripts returns the absolute value and the limits of the selected integral. The third part of the script returns the absolute and the normalized value of the integral. The last part of the script can be used to add a new integral to the list (in this case an integral with the spectral region from 7.2 to 7.5 ppm). the script reports the absolute value of this integral. Multiplet Test Script: This script is valid to obtain information about the multiplets of the spectrum and also to apply a 'manual multiplet analysis': function multipletTest() { var spec = new NMRSpectrum( nmr.activeSpectrum() ); print(spec.multiplets()); var sMult = new Multiplets(spec.multiplets()); print(sMult.count); print(sMult.at(2)); var sReg = new SpectrumRegion(7.0, 7.5); var mult = new Multiplet( spec, sReg ); var myMultiplets = new Multiplets(); myMultiplets.append( mult ); var mult2 = new Multiplet( spec, new SpectrumRegion(3.80,3.90) ); myMultiplets.append( mult2 ); var nM = new Multiplet(new SpectrumRegion(3.65,3.75), "t"); nM.name="My mulltiplet"; myMultiplets.append(nM); print(myMultiplets); spec.setMultiplets(myMultiplets); print(spec.multiplets()); spec.process(); } The first part of the script creates a list of the multiplets which appear on the spectrum and prints some information about the selected multiplet (in this case, the multiplet number 2, but of course you can select any other multiplet). The second part of the script creates a multiplet in the selected region 'sReg' (in this case the region is 7.0-7.5 ppm. It works as a manual multiplet analysis). Then, it creates a new empty list of multiplets which is added. The third part of the script consists in a new region (from 3.80 to 3.90 ppm) to apply the multiplet
2009 MESTRELAB RESEARCH
78
Mnova Scripting analysis. The following part of the script is used to add a multiplet manually to the multiplet list (the user will be able to remove this part of this script without any problem). In this case, we wanted to add a triplet, which appears in the region from 3.65 and 3.75 ppm, with the name 'My multiplet'. The end of the script is used to replace the original multiplet list for the list which we have just created. Peak Test Script: A similar script used to obtain information about the chemical shift and the intensity of the peaks of a 1D-NMR spectrum: function peakTest() { var spec = new NMRSpectrum( nmr.activeSpectrum() ); var sR = new SpectrumRegion( 0, 9.5 ); var ps = new Peaks(spec, sR); //fill the list with the peaks in sR print(ps); var p = new Peak(1.265, spec); print(p); ps.append(p); spec.setPeaks(ps);//Set the peaks to ps print( spec.peaks()); spec.process(); } After running this script, we will get the peak picking analysis of a 1D-NMR spectrum from 0 to 9.5 ppm (of course, we will be able to change this range). Then, a new peak at 1.265 ppm will be added to the peak list (again, you can add any other peak, if you want), reporting the intensity value of this new peak. Finally, the spectrum will be re-analyzed to obtain the new number of peaks. A similar script can be used for a 2D-NMR spectrum, but in this case we have to type the corresponding spectrum region in 2D mode: function peakTest() { var spec = new NMRSpectrum( nmr.activeSpectrum() ); var sR = new SpectrumRegion(4.0, 3.5, 75, 65 ); var ps = new Peaks(spec, sR); //fill the list with the peaks in sR print(ps); var p = new Peak(72.73, 3.17, spec); print(p); ps.append(p); spec.setPeaks(ps);//Set the peaks to ps print( spec.peaks()); spec.process(); } Multiplet Reporter script: Lets take a look now at a very important part of the 'Multiplet Reporter' script: // This function defines JACS-like multiplet report. // To customize report, edit this class or implement another one. function JACSMultipletReporter() { MultipletReporter.call(this); this.onlyElementName=false;
2009 MESTRELAB RESEARCH
79 // Define font size and font family this.font = "<font style=\"font-size: 10pt; font-family: Times New Roman\">"; this.nucleusTemplate="%1"; // Report header. %1 will be replaced with nucleusString, %2 with frequency, %3 with solvent this.header = "%1 NMR (%2 MHz, %3) δ "; // Multiplet templates. %1 - delta, %2 - category, %3 - nH this.reportRange = true; // set to true to get multiplet range instead of delta. this.withoutJsTemplate = " %1 (%2, %3H)"; // multiplet template without J's this.withJsTemplate = " %1 (%2, %4, %3H)"; // multiplet template with J's this.rangeTemplate = "%1 – %2"; // J's list template. %1 - list of J's this.jListTemplate = "<i>J</i> = %1"; this.jPrecision = 1; // J's precision this.deltaPrecision = 2; // delta precision this.mSeparator = ", "; // multiplet separator this.jSeparator = ", "; // J's separator this.start = this.font; this.end = ".</font>"; } JACSMultipletReporter.prototype = new MultipletReporter(); JACSMultipletReporter.prototype.toString = function() { return "JACSMultipletReporter()"; } (...) The user will be able to change the multiplet report template to obtain the desired multiplet report; for example: this.onlyElementName=false; changing false with true, we will obtain only the element name without the atomic mass (For example: H, C instead of 1H, 13C). The function: this.font = "<font style=\"font-size: 10pt; font-family: Times New Roman\">"; will define the font size and the font family of the multiplet report. The line: this.header = "%1 NMR (%2 MHz, %3) δ "; is used to print the header of the report, where %1 will be the nucleus (H or C), %2 the frequency of the spectrometer (in MHz), and %3 the solvent, followed by a delta symbol (d). For example: "1H NMR (500 MHz, CDCl3) ". The sentence: this.reportRange = true is used to obtain the multiplet range instead of the chemical shift. The functions: this.withoutJsTemplate = " %1 (%2, %3H)" and this.withJsTemplate = " %1 (%2, %4, %3H)" are used to customize the appearance of the multiplet report by changing the positions of %1, %2, %3H, or %4 (where, %1 means: chemical shift; %2 means: type of multiplet (s, d, t, etc); %3H means: number of hydrogens and %4 means the coupling constant value). As you can see, the first line shows a multiplet without coupling constants, (while the last line shows a multiplet with coupling constants). So, if you need to obtain something like this (Japanese format):
80
Mnova Scripting 1H NMR (300 MHz, Solvent) d ppm 6.43-6.22 (1 H, m), 3.17 (1 H, q, J = 7.15 Hz) etc You should modify both lines, as you can see below: this.withoutJsTemplate = %1 (%3H, %2)"; this.withJsTemplate = " %1 (%3H, %2, %4)"; If you prefer to obtain something like this: 1H NMR (300 MHz, Solvent) d ppm 1.23 (d, J = 1.2 Hz, 3 H), etc Just replace the original lines with: this.withoutJsTemplate = %1 (%2, %3H)"; this.withJsTemplate = " %1 (%2, %4, %3H)"; To obtain the coupling constant symbol in normal instead of italic, just modify the script by removing the italic format (<i>J</i>). If you prefer to obtain it in "bold" just type: this.jListTemplate = "<b>J</b> = %1"; The following paragraph will be used to customize the appearance of the coupling constants list: this.jPrecision = 1; // J's precision this.deltaPrecision = 2; // delta precision this.mSeparator = ", "; // multiplet separator this.jSeparator = ", "; // J's separator The first line is used for the precision of the coupling constants values, the second will be used for the precision of the chemical shift and the remaining two lines will print the separation between the multiplets and the coupling constants values. If you need to obtain the coupling constants in descending order, replace 'true' with 'false' in the following line:
If you want to obtain the multiplet chemical shifts in ascending order, just replace the 'false' with 'true' in the script:
To obtain the multiplet range in ascending order, just replace the rangeMin with rangeMax (and vice versa) in the line below of the script: shiftStr = this.rangeTemplate.argDec(multiplet.rangeMax, 0, 'f', this.deltaPrecision).argDec(multiplet. rangeMin, 0, 'f', this.deltaPrecision);
81 Title and Solvent: running this script, you will get the title and the solvent on your spectrum // <GUI menuname="title1" shortcut="Ctrl+2" tooltip="Title_and_Solvent" /> function title1() { //To get the active spectrum var spectrum = nmr.activeSpectrum(); //The function isValid informs about if the spectrum obtained is correct print( spectrum.isValid() ); var tit = draw.text("<h3>"+ spectrum.title+" "+spectrum.solvent+"</h3>", true); } Zoom: This script can be used to apply a zoom into a selected range of a spectrum. In order to select the horizontal range, just type the desired values between the brackets on the line spc.horZoom(1.0 , 5.0); If you want to set the vertical zoom, just change the values of the line spc.vertZoom(-100, 7000 ) function spectrumZoom() { var spc = nmr.activeSpectrum(); if( !spc.isValid() ) return; spc.horZoom(1.0, 5.0); spc.vertZoom(-100, 7000); spc.update(); mainWindow.activeWindow().update(); } Properties Script: You will find below a script example to change some properties of your spectra. In this case, the colour of the spectrum will be changed to red, the peaks font to Arial and the integral curves will be showed. You will find all the available properties at the 'Mnova Properties' chapter: function properties() { var spec = new NMRSpectrum(nmr.activeSpectrum()); spec.setProperty("curve.color","red"); spec.setProperty("peaks.font","Arial"); spec.setProperty("integrals.curve.show", true); spec.update(); mainWindow.activeWindow().update(); } Cutting: This script can be used to apply cuts to the spectra. You will obtain two cuts in your spectrum, between 1.0-3.5 and 7.0-8.0 ppm respectively. function myProcess() { var spec = new NMRSpectrum( nmr.activeSpectrum() ); var p = new NMRProcessing(spec.proc);
82
Mnova Scripting var regs = new Array(2); regs[0] = new SpectrumRegion(1.0, 3.5); regs[1] = new SpectrumRegion(7.0, 8.0); print(p.getParameter("cuts")); p.setParameter("cuts.apply", true); p.setParameter("cuts.list", regs); spec.proc = p; spec.process(); mainWindow.activeWindow().update(); } Magnitude Active Spectrum script: Lets see another script; in this case this script is used to obtain the 1D-NMR spectra in magnitude. Just open a 1D-NMR spectrum in Mnova, load this script by following the menu 'Script/Edit Script', type "magnitudeActiveSpectrum()" in the edit box and click on the green triangle to run the Script. You will obtain automatically your 1D-NMR spectrum in magnitude. Please bear in mind that it is also possible to run scripts from the command line, just by typing the path where the Mnova .exe file and the script are located and -sf "name of the script function": "mestrenovaPathname" "scriptPathname" -sf "scriptFunctionToRun" For example: "C:\Program Files\Mestrelab \Mestrelab Research "magnitudeActiveSpectrum" Research S.L\MestReNova\MestReNova.exe" "C:\Program S.L\MestReNova\scripts\magnitudeActiveSpectrum.qs" Files -sf
83
Threshold Script: This script will allow the user to adjust the threshold of the color scheme in 2DNMR spectra: // <GUI menuname="threshold2D" shortcut="Ctrl+T" tooltip="threshold2D" /> function threshold2D() { var spectrum = nmr.activeSpectrum(); if(!spectrum.isValid() ) return var th = spectrum.threshold;
84
Mnova Scripting var dlg = new Dialog(); dlg.title = "Threshold"; var edit = new LineEdit(); edit.label = "Threshold"; edit.text = th; dlg.add(edit); if (dlg.exec()) { spectrum.threshold = edit.text; } spectrum.update(); mainWindow.activeWindow().update(); } Running this script will show the 'Threshold' dialog box. From this window, the user will be able to adjust the threshold of the colour scheme by just typing the desired value and clicking on the 'OK' button.
ProcessTest Script: This script can be used to get some data from Mnova, save it as a file, next run some external program in order to make calculations (or whatever you need) and once the external program finishes, Mnova will get the result from another file. In this case the external program is the 'NotePad'. function processTest() { fileName = Dir.temp() + "MNova_Process_Text.txt"; var f = new File(fileName); f.open(File.WriteOnly); var s = TextStream(f); s.write("Hello Notepad!"); f.close(); print(Process.execute("notepad.exe", fileName)); f.open(File.ReadWrite); s.pos = f.size; print(s); s.write("\r\nHi again!"); f.close(); print(Process.startDetached("notepad.exe", fileName)); } MultiOpen script: Mnova incorporates a script named 'MultiOpen'. This tool is very useful if, for example, you always process your spectra in the same way, or when you have to routinely handle a large number of datasets.
85
A practical example: 'multiopen script' allows to open simultaneously a collection of several spectra. Make sure that all spectra are located in the same folder. After that, select 'Run Script...' on the 'Script Menu' or click on the 'Run Script' icon on the toolbar and then click 'Ok' after finding the corresponding script (in this case, the script is called 'multiOpen'). Then, select the directory where the spectra are located and a window like the one below will open:
Finally, write the 'File Mask' name (you can use wildcards, so this could be, for example, '*', '???', fid or
2009 MESTRELAB RESEARCH
86
Mnova Scripting ser), tick 'Recursively' and click 'OK'. All selected spectra will open simultaneously. The user can also use the 'Full Processing' command to automate the processing of both 1D & 2D NMR data sets. (You can find a full description of this tool further on in the Automated Processing chapter.)
You will find below the script used to obtain the above spectrum: //<GUI menuname="APF" tooltip="Auto Process and Layout A Spectrum"/> /****************************************************************************************************** Copyright (C) 2008 Mestrelab Research S.L. All rights reserved. This script is created for automatically processing and formatting the currently opened spectrum. Authorized users of MNova Software may use this file freely, but this file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. *****************************************************************************************************/
2009 MESTRELAB RESEARCH
87 function APF() { // Processing file. It must be created using the Full Processing dialog of MestReNova. // Change this to your actual path where this file is located. const procFile = "C:/H1-Varian.mnp"; // Company Logo file. Change this to your actual file path: const logoFile = "C:/MestreLab-logo.jpg"; // Load the logo file: serialization.open(logoFile); // Reprocess the spectrum using the processing parameter file: // nmr.process(procFile); // Now change the layout of the objects: var w = new DocumentWindow(Application.mainWindow.activeWindow()); var p = new Page(w.curPage()); var c = p.itemCount(); var i = 0; var itemArray = new Array(c); for(i=0; i<c; i++) { itemArray[i] = p.item(i); } for( i = 0; i<itemArray.length; i++ ) { var item = itemArray[i]; var width = item.width(); var height = item.height(); switch(item.name()) { case "NMR Spectrum": var nmrSpc = new NMRSpectrum(item); nmr.processSpectrum(nmrSpc, procFile); nmrSpc.left = p.left + 10; nmrSpc.right = p.right - 60; nmrSpc.top = p.top+25; nmrSpc.bottom = p.bottom-8; // Change the zoom range to 10 - 0: nmrSpc.horZoom(0.0, 10.0); // Display title/solvent: Note if the title is empty, use the filename for the resulting files. var title2Use = nmrSpc.title; if( !title2Use) title2Use = "<No Title>"; var tit = draw.text("<h4>" +title2Use+"/"+nmrSpc.solvent+"</h4>",true ); tit.left = p.left+30; tit.top = p.top+5; // Display the parameters: var params = "<b>Title: </b>" + nmrSpc.getParam("Title"); params += "<br/><b>Owner: </b>" + nmrSpc.getParam("Owner"); params += "<br/><b>Solvent: </b>" + nmrSpc.getParam("Solvent"); params += "<br/><b>Pulse Sequence: </b>" + nmrSpc.getParam( "Pulse Sequence"); params += "<br/><b>Acquisition Date: </b>" + nmrSpc.getParam( "Acquisition Date"); params += "<br/><b>Temperature: </b>" + nmrSpc.getParam(
2009 MESTRELAB RESEARCH
88
Mnova Scripting "Temperature"); params += "<br/><b>Number of Scans: </b>" + nmrSpc.getParam( "Number of Scans"); params += "<br/><b>Spectrometer Frequency: </b>" + nmrSpc.getParam("Spectrometer Frequency"); params += "<br/><b>Spectral Width: </b>" + nmrSpc.getParam( "Spectral Width"); params += "<br/><b>Lowest Frequency: </b>" + nmrSpc.getParam( "Lowest Frequency"); params += "<br/><b>Nucleus: </b>" + nmrSpc.getParam("Nucleus"); params += "<br/><b>Acquired Size: </b>" + nmrSpc.getParam( "Acquired Size"); params += "<br/><b>Spectral Size: </b>" + nmrSpc.getParam( "Spectral Size"); var par = draw.text("<font face=\"arial\", size=1>"+params+"</font>", true); par.left = p.right - 60; par.top = p.top+30; break; case "Molecule": item.left = p.left + 15 item.right = item.left + width; item.top = p.top+30; item.bottom = item.top + height; print(item.name()); break; case "Image": item.left = p.right-width-10; item.right = item.left+width; item.top = p.top+6; item.bottom = item.top + height; print(item.name()); break; } } w.update(); } AP: This complex script (which includes the multiopen script) can be used to open, process (by applying a processing template) a batch of 1D NMR spectra and then create two pages in the same document with different formats (changing the phase correction, zoom, cuttings, etc..) and saving the resulting pages as PDF, and .mnova files. The script will also generate a .log file with the processing hour and date. Please make sure that you use the correct paths for the 'processing template' and also for the logo. In this case, both are saved directly in C:\. Do not forget to visit our script repository at: http://www.mestrec.com/recursos.php?idc=11&i18n=1 //<GUI menuname="AP" tooltip="Auto Process and Save Multiple Spectra"/> /****************************************************************************************************** Copyright (C) 2008 Mestrelab Research S.L. All rights reserved. This script is created for auto processing and saving multiple 1D NMR spectra into a desginated folder.
89 Authorized users of MNova Software may use this file freely, but this file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. *****************************************************************************************************/ function AP() { // Processing file. It must be created using the Full Processing dialog of MestReNova. // Change this to your actual path where this file is located. const procFile = "C:/H1-Varian.mnp"; // Company Logo file. Change this to your actual file path: const logoFile = "C:/MestreLab-logo.jpg";
DESIGN,
// First allow the user to locate the folder where the NMR data are: var dirSettingsKey=new String("Multi Open/Last Directory"); var dirName = settings.value(dirSettingsKey,Dir.home()); dirName = FileDialog.getExistingDirectory(dirName, "Locate the folder where you raw data are located:"); // print("Directory: " + dirName); settings.setValue(dirSettingsKey,dirName); var dialog = new Dialog; dialog.title = "How to Locate NMR Data"; var leDirectory = new LineEdit; leDirectory.label = "Directory:"; if (dirName) leDirectory.text = dirName; dialog.add(leDirectory); var leDirMask = new LineEdit; leDirMask.label = "Sub-Directory Mask:"; leDirMask.text = "*"; dialog.add(leDirMask); var leFileMask = new LineEdit; leFileMask.label = "File Mask:"; leFileMask.text = "fid"; dialog.add(leFileMask); var recursiveSettingsKey=new String("Multi Open/Recursive"); var cbRecursive = new CheckBox; cbRecursive.text = "Recursively" dialog.add(cbRecursive); cbRecursive.checked = settings.value(recursiveSettingsKey,false); if(!dialog.exec()) return; var pdfDirSettingsKey=new String("Multi Open/Last PDF Directory"); var pdfDirName = settings.value(pdfDirSettingsKey,Dir.home()); pdfDirName = FileDialog.getExistingDirectory(pdfDirName, "Locate the folder where the results are to be saved:"); // print("Directory: " + pdfDirName); settings.setValue(pdfDirSettingsKey,pdfDirName);
90 // // // //
Mnova Scripting print("Directory: " + dirName); print("Directory Mask: " + leDirMask.text); print("File Mask: " + leFileMask.text); print("PDF Directory: " + pdfDirName); var dirName = leDirectory.text; var dir = new Dir(dirName); if (!dirName || !dir.exists) { MessageBox.critical("Directory " + dirName + " does not exist.", MessageBox.Ok); return; } dir.cdUp(); var pdfDir = new Dir(pdfDirName); if (!pdfDirName || !pdfDir.exists) { MessageBox.critical("PDf Directory MessageBox.Ok); return; }
"
pdfDirName
"
does
not
exist.",
settings.setValue(recursiveSettingsKey,cbRecursive.checked); var filesFound = getMaskFiles(dirName, dir.absPath, leFileMask.text, cbRecursive.checked); // print("Files Found: " + filesFound);
leDirMask.text,
// Now, process all the files one by one, and save them into .mnova and .pdf files: import_process_save_loop(filesFound, procFile, logoFile, dirName.length, pdfDirName); } // Open and process all spectra: function import_process_save_loop(files, procName, logoFile, dirNameLength, pdfDirName) { // Open a log file: var logFileName = pdfDirName+ "/log.txt"; var f = new File(logFileName); f.open(File.WriteOnly); var s = TextStream(f); // Add the starting date and time in the log file: var dt = new Date(); s.write("Starting time:"); s.write(dt); s.write("\r\n"); for(var i = 0; i < files.length; i++) { var dw = new DocumentWindow(Application.mainWindow.newWindow()); // Create new document window s.write(files[i]); s.write("\r\n"); // Ignore files starting with "scout": if( files[i].indexOf("scout") > -1) { s.write("\t-Ignored.\r\n");
2009 MESTRELAB RESEARCH
91 } else { // Generate a filename for the resulting PDF file: var fileName = Get_folder_name(files[i], dirNameLength, pdfDirName); // Open and display the spectrum as the first page (full spectrum with parameters etc): if(!Open_Process_Spectrum(files[i], procName, 1)) { s.write("\t-Error opening and processing the file.\r\n"); } else { var ignore = ChangeLayout(logoFile, fileName, 1); if( ignore) { s.write("\t-Skipped due to unexpected spectral type or error changing layout.\r\n"); } else { // Open and display the spectrum again as the second page (auto cut, without parameters): if(!Open_Process_Spectrum(files[i], procName, 2)) { s.write("\t-Error opening and processing the file.\r\n"); } else { var ignore = ChangeLayout(logoFile, fileName, 2); if( ignore) { s.write("\t-Skipped due to unexpected spectral type or error changing layout.\r\n"); } // Save the two pages into one PDF and .mnova file (remove the '//' if you want other files be saved): else { serialization.save(fileName+".pdf", "pdf"); // Adobe PDF file format s.write("\t-Generated "+fileName+".pdf\r\n"); serialization.save(fileName+".mnova", "mnova"); ASCII } } } } } dw.close(); // Close document window of processed spectrum } // Done. Close the log file. s.write("Completed time:"); dt = new Date(); s.write(dt); // MestReNova file format \\serialization.save(fileName+".txt", "ascii"); //
92
Mnova Scripting s.write("\r\n"); f.close(); } function Open_Process_Spectrum(specFileName, procName, flag) { if (serialization.open(specFileName)) { nmr.process(procName); var spec = new NMRSpectrum( nmr.activeSpectrum()); var proc=new NMRProcessing(spec.proc); // Get the auto cut regions, and add to cut the solvent peak if flag = 2: if( flag==2) { var regs = spec.autoDetectNoiseRegions(); auto cut regions as SpectrumRegion object regs.push(new SpectrumRegion(0.5,-0.5)); regs.push(new SpectrumRegion(2.60, 2.45)); regs.push(new SpectrumRegion(3.45,3.25)); regs.push(new SpectrumRegion(4.5,5.0)); // print("New REGS"+regs); proc.setParameter("cuts.apply", true); proc.setParameter("cuts.list", regs); cuts list to the process object } // Re-apply the processing parameters: spec.proc = proc; spec.process(); return 1; } return 0; } function Get_folder_name(aFileName, dirNameLength, pdfDirName) { var result = new String; var found = -1; for(var i=aFileName.length-1; i >= 0; i--) { var c = aFileName[i]; if( c == '\\' || c=='/') { found=i; break; } } var name = new String; for( var i=dirNameLength+1; i < found; i++) { var c= aFileName[i]; if( c == '\\' || c == '/') { name += ' '; c = '_'; // Changed by Len Chao
2009 MESTRELAB RESEARCH
//this returns a list of // remove ref // remove dmso // remove water // remove water //now we apply the
93 } name += c; } result = pdfDirName + "/"+name; return result; } function Get_filename_from_path(pathName) { var result = new String; var found = -1; for(var i=pathName.length-1; i >= 0; i--) { var c = pathName[i]; if( c == '\\' || c=='/') { found=i; break; } } for( var i=found+1; i < pathName.length; i++) { var c= pathName[i]; result += c; } return result; } // Display spectrum and other objects (title, logo, and parameters etc) as desired. // Currently spectra other than 1D H-1 are ignored. You can change to do 1D C13 or 2D etc. function ChangeLayout(logoFile, fileName, flag) { var returnValue =0; // if returnValue=1 then ignore the spectrum. // Load the logo file: serialization.open(logoFile); // Now change the layout of the objects: var w = new DocumentWindow(Application.mainWindow.activeWindow()); var p = new Page(w.curPage()); var c = p.itemCount(); var i = 0; var itemArray = new Array(c); for(i=0; i<c; i++) { itemArray[i] = p.item(i); } for( i = 0; i<itemArray.length; i++ ) { var item = itemArray[i]; var width = item.width(); var height = item.height(); switch(item.name()) { case "NMR Spectrum": var nmrSpc = new NMRSpectrum(item);
2009 MESTRELAB RESEARCH
94
Mnova Scripting
nmrSpc.left = p.left + 10; nmrSpc.right = p.right; if(flag == 1) nmrSpc.right -= 60; nmrSpc.top = p.top+25; nmrSpc.bottom = p.bottom-8; / Change the zoom range to 10 - 0: nmrSpc.horZoom(0.0, 10.0); // Display title/solvent: Note if the title is empty, use the filename for the resulting files. var title2Use = nmrSpc.title; if( !title2Use) title2Use = "<No Title>"; var tit = draw.text("<h4>" +title2Use+"/"+nmrSpc.solvent+"</h4>",true ); tit.left = p.left+30; tit.top = p.top+5; // Display the parameters: var params = "<b>Title: </b>" + nmrSpc.getParam("Title"); params += "<br/><b>Owner: </b>" + nmrSpc.getParam("Owner"); params += "<br/><b>Solvent: </b>" + nmrSpc.getParam("Solvent"); params += "<br/><b>Pulse Sequence: </b>" + nmrSpc.getParam( "Pulse Sequence"); params += "<br/><b>Acquisition Date: </b>" + nmrSpc.getParam( "Acquisition Date"); params += "<br/><b>Temperature: </b>" + nmrSpc.getParam( "Temperature"); params += "<br/><b>Number of Scans: </b>" + nmrSpc.getParam( "Number of Scans"); params += "<br/><b>Spectrometer Frequency: </b>" + nmrSpc.getParam("Spectrometer Frequency"); params += "<br/><b>Spectral Width: </b>" + nmrSpc.getParam( "Spectral Width"); params += "<br/><b>Lowest Frequency: </b>" + nmrSpc.getParam( "Lowest Frequency"); params += "<br/><b>Nucleus: </b>" + nmrSpc.getParam("Nucleus"); params += "<br/><b>Acquired Size: </b>" + nmrSpc.getParam( "Acquired Size"); params += "<br/><b>Spectral Size: </b>" + nmrSpc.getParam( "Spectral Size"); var par = draw.text("<font face=\"arial\", size=1>"+params+"</font>", true); par.left = p.right - 60; par.top = p.top+30; break; case "Molecule": item.left = p.left + 15 item.right = item.left + width; item.top = p.top+30; item.bottom = item.top + height; print(item.name()); break; case "Image":
2009 MESTRELAB RESEARCH
95 item.left = p.right-width-10; item.right = item.left+width; item.top = p.top+6; item.bottom = item.top + height; print(item.name()); break; } } w.update(); return returnValue; }
Thank you!
Thank you for reading this Manual, and for purchasing this release version of MNova. We will be very keen to read your feedback on the application, to hear about any bugs you may find and to also listen to any additional ideas or suggestions you may have.
Please remember that you can send all those, and any queries about the software, or requests for help, to:
Keep checking our web site (www.mestrelab.com) for additional information on our range of software packages, and for news on our company.