Document overview

Macro Programming documentation

This product documentation is part of the Waters Micromass Online Information System for Macro Programming. The use of this information relies upon the user having a good understanding of the basics principles of software programming using the Visual Basic Language.

Documentation conventions

Instructions in this documentation adhere to the following conventions.

> | Denotes the path for selecting menu commands, for moving from one menu to another, or for performing a task. Example: Click File > Open
< > | Indicates that you must enter variable information, such as a path or filename. Example: Enter open <filename>

Online Information System overview

Contact information

Copyright information


Access information

Welcome to our Online Information System

This MassLynx Macro Programming topic database is part of the Waters Corporation Online Information System. This system is designed to answer your questions while you work with Waters Corporation products and the Macro Programming product suite. You can easily resize this information system window, move it, and hide or show the navigation pane as required.

Viewing information in this window

Use standard window-operating procedures to manipulate this window. For example, you can drag a corner of this window to resize it or click the Minimize button in the top-right corner to temporarily shrink it into a button at the bottom of your screen. Once you find the task-related information you need, click the Hide icon in the top-left corner of the window to close the navigation panel on the left, keeping only the contents of the topic displayed. After using the information to help you complete your task, you can then click the Show icon to redisplay the navigation panel if desired.

Navigating to a topic for complete details

When you select the Contents tab, the navigation pane on the left side of the Help window contains a list of topics based on the common tasks you perform with this product suite.

  • Click the plus sign to show the sections within a topic

  • Click the minus sign to hide the sections within a topic

  • Double-click a topic entry to display the related information in place of the text you are now reading

You can also click the Index or Search tab in this navigation bar to locate a specific piece of information in this online information system based on a key word or phrase

Printing topic content

To print a single topic, click the Print toolbar button or right-click within the topic, and then click Print.

To print multiple topics simultaneously, click the Contents tab within the navigation pane of the Help window, navigate to the folder that contains the topics you want to print, and then click Print to print the selected topic or the selected heading and all its subtopics.

Tip: The header and footer information that appears at the top and bottom of the pages when you print a topic from the Help system is controlled by the same print settings you have defined for Internet Explorer. From Internet Explorer's File menu, click Page Setup to specify what you want to print in the headers and footers of your topics. In the Page Setup dialog box, enter the appropriate code strings for the header and footer text that will print on your pages. You can click the What's This? Help button from within the dialog box to view a description of the available codes.

Copying information contained in a topic

To copy information from one of the topics in this online information system into another file:

  1. In the topic window, select the text you want to copy, right-click, and then select Copy from the shortcut menu that appears.

  2. Open the file in which you want to copy the information, and position the cursor where desired.

  3. From the Edit menu, click Paste.

Searching for information

When you want to quickly find information, you can check the index for this online information system or conduct a search for specific word(s).

To use the index in this online information system:

  1. In the left-hand navigation pane, click the Index tab.

  2. Scroll through the index or in the text box on the Index tab, type the word(s) you want to find within the index, and then click Display to show the topic contents.

To search for words in this online information system:

  1. In the left-hand navigation pane, click the Search tab.

  2. In the first text box on the Search tab, type the word(s) you want to find, and then click List Topics.

  3. When the list of topics that contain the word you want to find appears, double-click a title or click Display to show the topic contents.

Result: The topics listed contain the word(s) specified, though the words may not appear in the topic title. When you display the topic, the word(s) are highlighted where they appear within the topic contents.

Product documentation overview

Contact information

Copyright information


Copyright

Copyright © Waters Corporation 2005

All Rights Reserved.

This document contains information that is proprietary to Waters Corporation. The original recipient of this document may duplicate this document in whole or in part for internal business purposes only, provided that this entire notice appears in all copies. In duplicating any part of this document, the recipient agrees to make every reasonable effort to prevent the unauthorized use and distribution of the proprietary information.

The information in this Help system is subject to change without notice and should not be construed as a commitment by Waters Corporation. Waters Corporation assumes no responsibility for any errors that may appear in this Help system. This Help system is believed to be complete and accurate at the time of publication. In no event shall Waters Corporation be liable for incidental or consequential damages in connection with, or arising from, the use of this document.

Alliance, Millennium, Micromass, Empower, LAC/E, and SAT/IN are registered trademarks of Waters Corporation.

Microsoft and Windows are registered trademarks of Microsoft Corporation.

All other trademarks or registered trademarks are the sole property of their respective owners.

Online Information System overview

Product documentation overview

Contact information


Contact information

Waters Corporation contact information

Technical support

If you have enhancement requests or technical questions regarding the use of any Waters Corporation product, contact us as follows:

Internet | http://www.waters.com
Standard mail | 34 Maple Street Milford, MA 01757
Telephone | 508 478-2000 or 800 252-4752 (In the USA or Canada) Refer to http://www.waters.com for complete telephone listings according to geographic location.

Your comments

We welcome your feedback on this online information system documentation or any other Waters Corporation product or document. We are also interested in your suggestions for any additional topics you want included in our product documentation. Please contact us at the following email address with your comments:

Tech_Comm@waters.com

Online Information System overview

Product documentation overview

Copyright information


Safety information

Chemical hazard

Good Laboratory Practice should be adhered to when using potentially toxic, caustic, or flammable solvents and analytes.

High temperature hazard

Warning: To avoid burns, take care when working with the instrument as the gas chromatography (GC) interface may be at high temperature.

Pinch hazard

Warning: A pinch hazard exists at the front and rear of the instrument. Do not put your fingers between the air mount frame and top of the instrument’s cubicles.

Trip hazard

Warning: A trip hazard exists at the rear of the instrument due to the large number of cable and pipe connections; take great care when working in this area.

High magnetic field hazard

Warning: Do not use the instrument if you have a cardiac pacemaker. Electromagnetic interference and magnetic fields may disrupt a pacemaker’s operation.

Warning: The magnetic field generated by the instrument is not quantified in terms of risk.

When working with the instrument:

  • Do not use any ferrous tools near the instrument.

  • Remove any magnetic items from your person.

These can become ballistic items that are a physical threat if they are allowed too close to the magnet.

Safety symbols

Warnings in this guide or on the instrument must be observed during all phases of service, repair, installation, and operation of the instrument. Failure to comply with these precautions violates the safety standards of the design and intended use of the instrument.

Waters Corporation assumes no liability for the your failure to comply with these requirements.

Safety symbols are used in this guide and on the instrument. A Warning is an instruction that draws your attention to the risk of injury or death; a Caution is an instruction that draws attention to the risk of damage to the instrument.

Warning: General warning indicating a potential health or safety hazard. See the operator’s guide for instructions.

Avertissement: Symbole d’avertissement indiquant qu’un produit ou composant pose un risque potentiel pour votre santé et sécurité.Consultezlemanueldel’utilisateur.

Warning: Hazardous voltages.

Avertissement: Tensions dangereuses.

Warning: Hot surfaces.

Avertissement: Surfaces chaudes.

Warning: Corrosive substances.

Avertissement: Substances corrosives.

Warning: Toxic substances.

Avertissement: Substances toxiques.

Warning: Flammable substances.

Avertissement: Substances inflammables.

Warning: Laser radiation.

Avertissement: Rayonnements laser.

Warning: UV radiation.

Avertissement: Rayonnements UV.

Caution: Care must be taken to avoid the possibility of damaging the instrument, or affecting its operation.

Attention: Utilisez l’instrument en faisant preuve de beaucoup de précaution pour éviter de l’endommager et ainsi nuire à son fonctionnement.


System Requirements

This section is divided into the following sections:

  • Operating System

  • PC Specification

Operating System

MassLynx version 4.1 shall operate with Microsoft Windows 2000 SP4 or Windows XP Professional with SP2.

PC Specifications

Compaq EVO 510:

512 MB RAM

20 GB ATA hard drive, 80 GB recommended

1.44 MB floppy drive, 31/2 inch

CD/RW drive

17inch monitor SVGA

Microsoft serial mouse

Embedded Ethernet controller

Auxiliary Intel Pro 100+ Network NIC

NVIDIA Riva AGP2x Graphics Card

Embedded Audio and Integrated Premier Sound

Printer supported by Windows NT

NTFS

IBM M50 ThinkCentre:

Pentium 4, 3.0 GHz/800 MHz FSB, 512 KB Cache

IBM 1024 MB SDRAM

Pro Keyboard

Optical 3Button ScrollPoint Mouse PS2 and USB

160 GB 7200 RPM (Serial ATA150 hard drive)

DVD MultiBurner

Veritas Multi Burner Software

Windows XP® Professional

Intel Extreme Graphics 2 Direct AGP 32 MB Graphics Chipset

IBM M51 ThinkCentre:

Pentium 4, 3.2 GHz/800MHz FSB, 1 MB Cache

IBM 1024 MB SDRAM

Pro Keyboard

Optical 3Button ScrollPoint Mouse PS2 and USB

160 GB 7200 RPM (Serial ATA150 hard drive)

DVD MultiBurner

Roxio Easy CD Creator & DVD Creator 6

Com 2 Cable

Windows XP® Professional

IBM Intellistation 2.2 GHz:

IBM Intellistation MPro 2.2 GHz

512 MB

73.4 GB Ultra160 SCSI Hard Drive

1.44 MB Floppy Drive, 3 ½ inch

CD/RW drive

17 inch monitor

Microsoft Serial Mouse

Embedded Ethernet controller

Auxiliary Intel Pro 100+ Network NIC

Matrox Millennium G450 Video

Printer supported by Windows NT

NTFS

IBM ZPro Dual XEON Processor 2.4 GHz:

IBM ZPRO Dual XEON Processor Intellistation -- Dual XEON Processors, 2.4 GHz

512 MB RAM

36.4 GB SCSI HHD

120 GB 7200 RPM ATA/100 EIDE HDD

IBM DVD Multi Burner

In order to create Modules, your system must include Microsoft Visual Basic 6.0.


Installing Microsoft Visual Basic V6.0

  1. Load Microsoft Windows. Close down any Windows applications like MassLynx which are currently running.

  2. Insert the Microsoft Visual Basic version 6.0 CD in the CD-ROM drive.

  3. If the setup program doesn't run automatically, use the Microsoft Windows explorer to select the CD-ROM drive [D:] and double click on "setup.exe" in the files list in order to initiate execution of setup.

  4. Select "Install Visual Basic 6.0" and work through the setup instructions as they appear on screen.


Writing Macro Programs to Work with MassLynx

MassLynx Macro Programs are created using the Visual Basic programming system. Full documentation is provided with Visual Basic and it is recommended that you read the Microsoft Visual Basic Programmers Guide before you attempt to write a Macro Program. It is also recommended that you work through the on-line tutorial supplied with Visual Basic as this introduces you to the concepts involved when using Visual Basic and shows you examples of applications that you can create.


MassLynx Datafile Access Component

The MassLynx DAC is an ActiveX .DLL which allows easy access to MassLynx data files. Various classes within the DAC are used to access different aspects of MassLynx data:

  • DACAnalog – Allows access to the analog information held in a data file.

  • DACCalibrationInfo – Allows access to the calibration information from a data file.

  • DACChromatogram – Allows access to chromatogram data held in a data file.

  • DACExperimentInfo – Allows access to the information supplied by the Experimental Record dialogue of the MassLynx Data Browser.

  • DACExScanStats – Allows access to the instrument control statistics of a single spectrum's acquisition.

  • DACFunctionInfo – Allows access to the function information in a data file.

  • DACHeader – Allows access to the header information from a data file.

  • DACProcessInfo – Allows access to the process information held in a single function.

  • DACScanStats – Allows access to the scan statistics of a single spectrum.

  • DACSpectrum – Allows access to the Mass-Intensity pairs of a single spectrum.

A full description of the DAC is included in the MassLynx Interfacing Guide.


Working with MassLynx Data Files

Very often you will want to read information from an acquired data file in order to take further action in your program or to display or calculate a result. There are several functions within the MassLynx API to help you do this. You do not specifically need to know about the MassLynx data file format to access this data as the API supplies function calls the operate at a high level to supply data to your program.

Retrieving MassLynx Data File Information


Retrieving MassLynx Data File Information

To access information on the last accessed data file the MassLynx.BAS file contains the following function declaration:

GetSampleListFileVB (lpsFile As VGRAWFILE) As Long

lpsFile is the name of the variable in which we will receive the information and is of the type VGRAWFILE. Several pre-defined data types are used to manipulate MassLynx data files, from within MassLynx modules. These data types must be created before being passed as parameters to the functions and procedures within the MassLynx modules.

Declare a variable lpsFile to be of VGRAWFILE type:

Dim lpsFile As VGRAWFILE

then call the procedure, supplying this variable as a place to hold the information:

GetSampleListFileVB(lpsFile)

You can now read the file information by using the lpsFile variable. For instance if you wanted to read the name of the data file you would look at:

lpsFile.lpVGFile.szName.

  • VGFILE data type

  • VGRAWFILE data type

  • RAWHEADER data type

  • DMRAWHEADER data type

  • DMRAWSTATS data type


The VGFILE data type

VGFILE Data Type

The VGFILE type is used to hold data on files accessed by MassLynx, such as, where the file can be found, the name of the file, its extension, and what spectral information has been viewed.

Type VGFILE

wType | As Integer | Reserved for MassLynx
szDirectory | As String * 260 | The directory where the file can be found
szName | As String * 256 | The name of the data file i.e. "V50"
szExtension | As String * 256 | The extension of the data file
dwEntry | As Long | This value holds the last scan number viewed in spectrum
dwSize | As Long | This holds the last scan number of the last file opened by MassLynx

End Type


The VGRAWFILE data type

VGRAWFILE Data Type

The extended VGRAWFILE contains two additional properties, for holding the current data file function and process.

Type VGRAWFILE

lpVGFile | As VGFILE | VGFILE data type
wFunc | As Integer | The Acquisition Function number
wProc | As Integer | The Processed data number

End Type

Note: Every time a data file is opened a process number is assigned for each process performed on it (centre, subtract etc.). However if for example, the third processed data file (wProc number 3) is saved then for that particular data file wProc #3 is reserved and cannot be used again. If the file is opened again at some later time and processed, the wProc numbers assigned to each new accessed data file would be 1, 2, 4, 5… etc as wProc number 3 is reserved.


The RAWHEADER data type

RAWHEADER Data Type

Every data file acquired by MassLynx is assigned a header data structure. This header can be used to retrieve information concerning the data file. Information on MassLynx data files can be read from the header, such as the sample description and Submitter information

Type RAWHEADER

nVersionMajor | As Integer | Major version of file format.
nVersionMinor | As Integer | Minor version of file format.
szAcquName | As String * 260 | Acquired filename, no extn.
szAcquDate | As String * 40 | Acquired date: DD-MMM-YYYY.
szAcquTime | As String * 40 | Acquired time: HH:MM:SS (24 hr).
szJobCode | As String * 80 | Job
szTaskCode | As String * 80 | Task
szUserName | As String * 80 | User
szLabName | As String * 80 | Lab
szInstrument | As String * 80 | Instrument
szConditions | As String * 80 | Conditions
szSampleDesc | As String * 121 | Sample description.
szSubmitter | As String * 80 | Sample submitter
szSampleID | As String * 80 | Sample ID
szBottleNumber | As String * 20 | Bottle/Vial number
lfSolventDelay | As Double | Solvent delay in decimal minutes.
bResolved | As Long | TRUE if resolved data file.
szPepFileName | As String * 260 | Assoc pep/embl filename-inc. dir+ext.
szProcess | As String * 81 | Process descriptor
bEncypted | As Long | Encryption
nAutosamplerType | As Long | Autosampler type
szGasName | As String * 25 | Gas name
szInstrumentType | As String * 25 | Instrument type
szPlateDesc | As String * 121 | Plate descriptor
afAnalogOffset(1 To 4) | As Single | Analogue channel offset times
nMuxStream | As Long | MUX flag
szInletMethodName | As String * 260 | Inlet Method name
szInletPreRunMethodName | As String * 260 | Inlet Pre run Method name
szInletPostRunMethodName | As String * 260 | Inlet Post run Method name
szInletSwitchMethodName | As String * 260 | Inlet Switch Method name
szHPLCMethodName | As String * 260 | HPLC Method name
szMSMethodName | As String * 260 | MS Method name
szTuneMethodName | As String * 260 | Tune file name
szFractionLynxName | As String * 260 | FractionLynx method name
szSpare(1 To 5) | As String * 260 | Spare fields

End Type


The DMRAWHEADER data type

DMRAWHEADER Data Type

To extend the header information the DMRAWHEADER type adds the number of functions acquired and the number analogue channels acquired

Type DMRAWHEADER

sRawHeader | As RAWHEADER
wFuncsInFile | As Integer
wAnalogsInFile | As Integer

End Type

Accessing Header files

To access the header files of MassLynx data to need to first declare the DMRAWHEADER data type. This is done as follows:

Dim myRawHeader AS DMRAWHEADER

The function DmRawReadHeaderVB is then called where the VGRAWFILE is passed to the function and the DMRAWHEADER is returned.

DmRawReadHeaderVB (LPVGRAWFILE As VGRAWFILE, lpDMRawHeader As DMRAWHEADER) As Integer


The DMRAWSTATS data type

DMRAWSTATS Data Type

Scan Statistics structure definition, at DM level. Information on individual scans can be stored in the following data type:

Type DMRAWSTATS

fLoMass | As Single | Scan start mass
fHiMass | As Single | Scan end mass
bMolecularMass | As Long | reserved for transforms
bCalibrated | As Long | Data is calibrated. = 1
fRT | As Single | Retention time in minutes
dwPeaksInScan | As Long | # Peaks found in the scan
fTIC | As Single | TIC of the Scan
fBPI | As Single | Base Peak Intensity
fBPM | As Single | Base Peak Mass
wOverload | As Integer | Reserved
bContinuum | As Long | Data is continuum = 1
nIonMode | As Long | Ion Mode (0 - 9)
nSegment | As Long | Scan segment ID number
bGotExtended | As Long | TRUE if extended information valid
sEx | As RAWSCANSTATSEX | Extended scan statistics

End Type

To read the Scan statistics the following function is available:

DmRawReadScanStatsVB (LPVGRAWFILE As VGRAWFILE, ByVal dwScanNumber As Long, ByVal wCalibrate As Integer, lpDmRawStats As DMRAWSTATS) As Integer

The VGRAWFILE must be passed to the function, along with the scan number (dwScanNumber) that you want the details for, and whether you want calibrated data (this is invariably set to TRUE) the scan statistics will be returned in the predefined lpDMRawStats data structure.


MassLynx Direct Calls

This is an index of the functions exported from the MassLynx Dynamic Link Libraries that can be called from VB macros.

  • ml_vb32.dll

  • dm32.dll

  • integr32.dll


ml_vb32.dll

  • AiScanStatus

  • GetApplicationWnd

  • GetGlobalDouble

  • GetGlobalFile

  • GetGlobalLong

  • GetGlobalString

  • GetMassLynxWorkingDir

  • GetSampleListFileVB

  • hmemcpy

  • hmemcpyFromLp

  • hmemcpyTolp

  • IsMassLynxEnabled

  • LCDADAcquisition

  • SetGlobalFile


AiScanStatus

Description:

This function returns the status of the acquisition. At any stage of the acquisition phase MassLynx could be any one of a number of states, e.g. scanning, waiting for the inlet system etc. this function allows applications to poll MassLynx during acquisition to determine its status.

Arguments:

None

Return:

(Integer) Scan status

AI_NOT_SCANNING
AI_SCANNING
AI_WAIT_INLET_START
AI_SOLVENT_DELAY
AI_INLET_RUNNING
AI_WAIT_INLET_STOP


GetApplicationWnd

Description:

This function returns the window handle of the specified MassLynx application.

Arguments:

Integer nServiceCode

Calling functions service code.

APP_CLI Top level MassLynx

APP_SPEC Spectrum

APP_CHRO Chromatogram

APP_QUAN Quantify

APP_TUNE Tune Page

APP_ELE Elecomp

APP_LIB Library

APP_PEP Protein Sequencing

APP_MAP Map

APP_NUC Nucleotide Sequencing

APP_LCMS Strip

APP_LCMSMERGE Combine Functions

Return:

(Integer) Handle of the requested window, if the application is not running NULL will be returned.


GetGlobalDouble

Description:

This function searches the Global buffer for a given KeyName returning the double value from the file in Result argument. If InitGlobal has not been called prior to this function, then it is called at the start however unlike the INI interface, FreeGlobal is not called before returning.

The Global memory is maintained by MassLynx. It is initialized from the USER.ini file and MassLynx writes back to the USER.ini file before closing down. For this reason it is important to recognise that any applications that call this function will only work correctly if an instance of MassLynx is running.

Arguments:

String lpAppName

The section name in the user.ini file

String lpKeyName

The keyword in the user.ini file

Double dDefault

Default with which to populate lpResult should the section and or keyword not be found in the user.ini file

Double dResult

This is the value at the specified section and keyword or the default if either or both can't be found

Return:

(Integer) TRUE for normal execution, FALSE if error


GetGlobalFile

Description:

This function searches the Global buffer for the current MassLynx data file which is returned in Result argument. If InitGlobal has not been called prior to this function, then it is called at the start however unlike the INI interface, FreeGlobal is not called before returning.

The Global memory is maintained by MassLynx. It is initialized from the USER.ini file and MassLynx writes back to the USER.ini file before closing down. For this reason it is important to recognise that any applications that call this function will only work correctly if an instance of MassLynx is running.

Arguments:

String lpAppName

The section name in the user.ini file

String lpKeyName

The keyword in the user.ini file

LPVGFILE lpsDefault

Default with which to populate lpResult should the section and or keyword not be found in the user.ini file

LPVGFILE lpsResult

This is the file at the specified section and keyword or the default if either or both can't be found

Return:

(Integer) TRUE for normal execution, FALSE if error


GetGlobalLong

Description:

This function searches the Global buffer for a given KeyName returning the long value from the file in Result argument. If InitGlobal has not been called prior to this function, then it is called at the start however unlike the INI interface, FreeGlobal is not called before returning.

The Global memory is maintained by MassLynx. It is initialized from the USER.ini file and MassLynx writes back to the USER.ini file before closing down. For this reason it is important to recognise that any applications that call this function will only work correctly if an instance of MassLynx is running.

Arguments:

String lpAppName

The section name in the user.ini file

String lpKeyName

The keyword in the user.ini file

Long lDefault

Default with which to populate lpResult should the section and or keyword not be found in the user.ini file

Long lResult

This is the value at the specified section and keyword or the default if either or both can't be found

Return:

(Integer) TRUE for normal execution, FALSE if error


GetGlobalString

Description:

This function searches the Global buffer for a given KeyName returning the string from the file in Result argument. If InitGlobal has not been called prior to this function, then it is called at the start however unlike the INI interface, FreeGlobal is not called before returning.

The Global memory is maintained by MassLynx. It is initialized from the USER.ini file and MassLynx writes back to the USER.ini file before closing down. For this reason it is important to recognise that any applications that call this function will only work correctly if an instance of MassLynx is running.

Arguments:

String lpAppName

The section name in the user.ini file

String lpKeyName

The keyword in the user.ini file

String lpDefault

Default with which to populate lpResult should the section and or keyword not be found in the user.ini file

String lpResult

This string contains the value at the specified section and keyword or the default if either or both can't be found

int nMaxSize

Maximum number of characters to copy to the lpResult string

Return:

(Integer) length of lpResult i.e. 0 if not found


GetMassLynxWorkingDir

Description:

This function returns the current MassLynx directory

Arguments:

String szWorkingDir

This string is populated with the working directory of the instance of MassLynx currently running.

Return:

None


GetSampleListFileVB

Description:

Retrieves name of currently executing raw data file from Sample List. This information is derived from the MLCurSmp.txt file which contains information pertaining to files being processed by the sample list and is maintained by the sample list.

Arguments:

VGRAWFILE lpsFile

The VGRAWFILE structure pointed to by this pointer is populated by the name of the MassLynx data file that is currently being processed by the sample list.

Return:

(Long) TRUE for success, FALSE for fail


hmemcpy

Description:

This function takes a copy of data at one address and writes it at another address.

Arguments:

As Any lpDest

Destination address

As Any lpSource

Source address

LONG lBytes

Number of bytes to copy

Return:

None


hmemcpyFromLp

Description:

This function takes a copy of data at one address and writes it at another address of type long.

Arguments:

As Any lpDest

Destination address

Long lpSource

Source address

LONG lBytes

Number of bytes to copy

Return:

None


hmemcpyTolp

Description:

This function takes a copy of data at one address of type long and writes it at another address.

Arguments:

Long lpDest

Destination address

As Any lpSource

Source address

LONG lBytes

Number of bytes to copy

Return:

None


IsMassLynxEnabled

Description:

Reports if MassLynx is disabled or enabled by the EnableMassLynx() function (Analogous to windows EnableWindow call. It is used to enable/disable MassLynx top level applications)

Arguments:

None

Return:

(Integer) TRUE if MassLynx is enabled, FALSE if MassLynx is not enabled


LCDADAcquisition

Description:

Checks to see if the LC pump is acquiring DAD data.

Arguments:

None

Return:

(Integer) TRUE if pump is acquiring DAD data.


S etGlobalFile

Description:

This function replaces a given KeyName in the global buffer with lpNewValue.

If InitGlobal has not been called prior to this function, then it is called at the start but unlike the INI interface, FreeIni is not called before returning. If the variable does not exist, it is only appended if bAppend is TRUE.

The original length of line is checked, if it is the same or greater than the NewValue, NewValue is copied over it ('\r' used to fill any leftover space). If the new value is longer than the original, but we still have extra space at the end of the buffer, then space is made within the buffer and the string is rewritten. If this is a new string, space is made at the end of the paragraph (modifying lParaSize) and the new string appended

If the lpacBuf is too small for the new string to be added, the buffer is GlobalRealloc'ed

Arguments:

String lpAppName

Section name in the User.ini file

String lpKeyName

Keyname in the User.ini file

VGFILE lpsNewValue

The VGFILE information that is to be written to the User.ini file

BOOL bAppend

If this value is set to TRUE the new entry will be written to the User.ini file even if the nominated section and keyname can not be found.

Return:

(Integer) TRUE for normal execution, FALSE for fail


dm32.dll

  • BroFileOpen

  • DmRawClose

  • DmRawIsAnalogTraceDesc

  • DmRawIsDADFunction

  • DmRawReadChromatogramVB

  • DmRawReadHeaderVB

  • DmRawReadScanStatsVB

  • DmRawReadSpectrumVB

  • DmRawScansInFunction

  • DmRawTimeToScan


BroFileOpen

Description:

Raw data browser enables selecting of files, functions and history. If szTitle is NULL the title of the dialog box defaults to Open. Flags are as follows:

BRO_SELECTDATA - Shows controls enabling user to add or replace data or to create a new window.

The above can be combined with one of the following flags to set the current selection

BRO_ADDDATA

BRO_REPLACEDATA

BRO_NEWWINDOW

BRO_REPLACEALLDATA

Upon successful completion one of these flags will be set to indicate current control state.

BRO_SELECTAPP - Shows controls enabling user to select chromatogram and spectrum options.

The above can be combined with either of the following flags to set the current selection

BRO_CHROAPP

BRO_SPECAPP

Upon successful completion either of these flags can be set to indicate current control state.

BRO_NOHISTORY - When set, the History browse button is disabled.

For more information on common dialog boxes see Windows SDK online documentation.

Arguments:

Long hWnd

Main window handle of the calling application

VGRAWFILE lpsInfo

Pointer to the VGRAWFILE structure that will be filled out by this function call

Long lplFlags

Open file control flags (see Description)

String szTitle

Title of the dialog box

Return:

(Integer) Non zero value if user selected a file, otherwise FALSE


DmRawClose

Description:

Closes current raw data file

Arguments:

None

Return:

None


DmRawIsAnalogTraceDesc

Description:

Arguments:

String szTrace

Return:

(Integer)


DmRawIsDADFunction

Description:

Determines if specified file holds DAD information. If specified function number is zero returns number of first DAD function.

Arguments:

VGRAWFILE lpsInfo

Raw file ID info

Integer wFuncNum

Function number

Return:

(Integer) number of DAD function otherwise zero


DmRawReadChromatogramVB

Description:

Reads specified chromatogram from datafile. Array pointers can be NULL if information not required. The function is provided with a VGRAWFILE structure detailing which data file and function number to read from. What type of chromatogram is read is dependant on the szChromatogram string, this may be "TIC" or "BPI" or the string can specify a mass from which to construct a chromatogram. The bCalibrated flag specifies whether the data read from the file will have calibrations applied to it or not. The array pointers lpfScan, lpfTime and lpfIntensity

This function provides the idea mechanism for reading chromatographic information from MassLynx data files

Arguments:

LPVGRAWFILE lpsInfo

Data file description

String szChromatogram

Chromatogram description string

Integer bCalibrate

TRUE for calibrated data, otherwise FALSE

Long lStartScan

Number of scan to start read, 1 is first

Long lNumScans

Number of scans to read

Single lpfScan

Pointer to array to hold scan numbers

Single lpfTime

Pointer to array to hold scan times

Single lpfIntensity

Pointer to array to hold scan intensities

Return:

(Long) number of scans read, otherwise zero


DmRawReadHeaderVB

Description:

Reads Header from specified datafile. This information is shown in the DMRAWHEADER structure.

Arguments:

VGRAWFILE lpsInfo

Specifies the MassLynx data file to read

DMRAWHEADER lpsRawHeader

Returns header information

Return:

(Integer) TRUE for success, FALSE for fail


DmRawReadScanStatsVB

Description:

This function reads the statistics for the specified scan. The statistics are stored in the DMRAWSTATS structure

Arguments:

VGRAWFILE lpsInfo

Specifies the MassLynx data file to read, also specifies which function in the data file to read

Long lScanNumber

Scan number to read

Integer bCalibrate

TRUE for calibrated data, otherwise FALSE

DMRAWSTATS lpsStats

Returns scan stats

Return:

(Integer) TRUE for success, FALSE for fail


DmRawReadSpectrumVB

Description:

Reads specified spectrum from datafile. The lpsInfo structure details the MassLynx data file and function number that is to be read. The scan that is to be read is specified by the lScanNumber argument, the index is one based. The lStartPeak and lNumPeaks arguments allow a range of peaks to be specified. The lpfMass and lpfIntensity are where the spectral data is held. Array pointers can be NULL if information not required.

This function is the ideal mechanism for retrieving mass and intensity pairs for spectra from MassLynx data files

Arguments:

VGRAWFILE lpsInfo

Data file description

Long lScanNumber

Scan number to read

Integer bCalibrate

TRUE for calibrated data, otherwise FALSE

Long lStartPeak

Number of peak to start read, 1 is first

Long lNumPeaks

Number of peaks to read

Single lpfMass

Pointer to array to hold peak masses

Single lpfIntensity

Pointer to array to hold peak intensities

Return:


DmRawScansInFunction

Description:

Determines number of entries in specified Raw file function. If function number is zero returns number of scans of analog information.

Arguments:

VGRAWFILE lpsInfo

Specified raw file and function

Return:

(Integer) Number of scans in function if valid. Returns negative value if function doesn't exits.


DmRawTimeToScan

Description:

Obtains the number of the scan with the nearest retention time to the specified time. Works within specified datafile, function and process. Times are in terms of decimal minutes.

Arguments:

VGRAWFILE lpsInfo

Specified MassLynx data file

Single fRetentionTime

Nearest retention time

Return:

(Long) Number of scan with retention time closest to 'fRetentionTime', or Zero if no valid scans found


integr32.dll

  • IntegrateChromatogramRange

  • IntegrateGetIniFile


IntegrateChromatogramRange

Description:

Calculates a list of peaks, given chromatogram description and integration parameters. Full chromatogram is generated, but peaks are detected over specified range. If range values are zero full range is used.

Get the information in the DMRAWCHRTYPE structure using the ChroDescToChroType() function which can be found in CHRO.bas.

Get the information in the INTEGRATE_CHRO_PARAMS structure using the IntegrateGetIniFile() function.

Arguments:

Long | hWnd | Parent window handle
VGRAWFILE | lpRawFile | MassLynx raw data file
DMRAWCHRTYPE | lpChroType | Chromatogram type
Long | hPeaks | Returns peaks
Long | wNumPeaks | Returns number of peaks
Long | hDm | Returns chromatogram handle
INTEGRATE_CHRO_PARAMS | lpIntParams | Integration Parameters
Long | dwScanStart | Scan to start peak detection
Long | dwScanEnd | Scan to end peak detection
Integer | wTraceNumber | Which trace to integrate

Returns: (Integer) TRUE for success, FALSE for fail

Description:

Calculates a list of peaks, given chromatogram description and integration parameters. Full chromatogram is generated, but peaks are detected over specified range. If range values are zero full range is used.

Get the information in the DMRAWCHRTYPE structure using the ChroDescToChroType() function which can be found in CHRO.bas.

Get the information in the INTEGRATE_PARAMS structure using the IntegrateGetIniFile() function.

Arguments:

Long hWnd

Parent window handle

VGRAWFILE lpsInfo

MassLynx raw data file

DMRAWCHRTYPE lpsType

Chromatogram type

Long lphPeaks

returns peaks

Long lpnNumPeaks

returns number of peaks

Long lphDm

returns chromatogram handle

INTEGRATE_PARAMS lpsParams

Integration Parameters

Long lScanStart

Scan to start peak detection

Long lScanEnd

Scan to end peak detection

Return:

(Integer) TRUE for success, FALSE for fail


IntegrateGetIniFile

Description:

This function populates an INTEGRATE_PARAMS parameters structure from MassLynx.ini file.

Arguments:

String | lpsName | Section in the MassLynx.ini file to read the integration parameters from
INTEGRATE_PARAMS | lpsParams | Integration parameters

Returns: (Integer) TRUE for success, FALSE for fail


Massme32.dll

  • MassMeasureEditParam

  • MassMeasureGetInFile

  • MassMeasureSetInFile

  • MassMeasureSpectrum

  • AutoPeakDetectGetInFile

  • AutoPeakDetectSetInFile


MassMeasureEditParam

Description:

Invokes the mass measure parameters dialogue box. The dialogue is initialised with the specified parameters and returns new parameter values when the dialogue box is exited. If the dialogue box not is not OK'ed parameter values are not modified.

Arguments:

Long | hWnd | Parent window handle
MASS_MEASURE_PARAM | sMassMeasParams | Mass measure parameters

Returns: (Integer) TRUE if dialogue box exited with OK, FALSE if exited with CANCEL or if an error occurred.


MassMeasureGetIniFile

Description:

Reads the mass measure parameters from the user specified paragraph of the MassLynx.ini file.

Arguments:

String | szPara | Paragraph name
MASS_MEASURE_PARAM | sMassMeasParams | Mass measure parameters

Returns: (Integer) TRUE for success, FALSE for fail


MassMeasureSetIniFile

Description:

Writes the mass measure parameters to the user specified paragraph of the MassLynx.ini file.

Arguments:

String | szPara | Paragraph name
MASS_MEASURE_PARAM | sMassMeasParams | Mass measure parameters

Returns: (Integer) TRUE for success, FALSE for fail


MassMeasureSpectrum

Description:

Mass-measures the current continuum spectrum. The spectrum window must be open when MassMeasureSpectrum is called.

Arguments:

Long | hWnd | Parent window handle
VGRAWFILE | lpRawFile | Raw spectrum to process
MASS_MEASURE_PARAM | lpParams | Mass measure parameters
Any | phDm | Handle for subtracted/smoothed data
Integer | bSubtract | Flag indicating returned data handle

Returns: (Integer) Handle for centred data if successful, NULL otherwise.


AutoPeakDetectGetIniFile

Description:

Reads the automatic peak detection parameters.

Arguments:

String | szPara | INI paragraph name
MASS_MEASURE_PARAM | sMassMeasParams | Mass measure parameters

Returns: (Integer) TRUE for success, FALSE for fail.


AutoPeakDetectSetIniFile

Description:

Writes the automatic peak detection parameters.

Arguments:

String | szPara | INI paragraph name
MASS_MEASURE_PARAM | sMassMeasParams | Mass measure parameters

Returns: (Integer) TRUE for success, FALSE for fail.


PeakPure.dll

  • CalculatePeakPurity

  • PureGEtInFile

  • PureSetInFile


CalculatePeakPurity

Description:

Calculates the peak purity for all the detected peaks in the dataset specified as part of the PURITY_INFO structure.

Arguments:

PURITY_INFO

sPurityInfo

Dataset and parameters

Returns: (Integer) 0 or -1 for fail. Anything else for success.


PureGetIniFile

Description:

Reads the peak purity parameters from the user specified paragraph (usually “ChrPeakPurity”) of the MassLynx.ini file.

Arguments:

String | szParagraph | Paragraph name, use:CHR_PEAKPURE_PARA
PURITY_PARAMS | lpsParam | Returned peak purity parameters.

Returns: (Integer) TRUE for success, FALSE for fail


PureSetIniFile

Description:

Writes the peak purity parameters to the user specified paragraph (usually “ChrPeakPurity”) of the MassLynx.ini file.

Arguments:

String | szParagraph | Paragraph name, use:CHR_PEAKPURE_PARA
PURITY_PARAMS | lpsParam | New peak purity parameters

Returns: (Integer) TRUE for success, FALSE for fail


MassLynx API Reference

The following sections describe the most useful Visual Basic subroutines, functions and data type declarations contained in the .BAS modules. Any function or module not described in this section is no longer supported.

Data type declarations

Many Data types are used by MassLynx API modules. Most can be found in the Windows API help provided with Visual Basic. Additional ones are documented.

Subroutines and Functions

An overview of all the subroutines is provided here, however for a full code listing the code itself must be viewed through Visual Basic.

About.BAS

Acquire.BAS

Chro.BAS

Declares.BAS

Dosutils.BAS

Error.BAS

Integrat.BAS

Iso.BAS

Library.BAS

MassLynx.BAS

Quan.BAS

Report.BAS

Spec.BAS


About.BAS

Gives a structure to an About... window to complex Modules with user input/output

  • Data type declarations

  • About

  • AboutEnd

  • AboutInfoDef


MassLynx Macro Programming Manual - About.BAS - Data type declarations

Data Type Declarations

AboutInfo - Holds the Information displayed by the about window

Type AboutInfo

bUseDefs As Integer | True if Default AboutInfo should be displayed
strDesc As String | Application Description
strVersion As String | Application Version
strCopyright As String | Copyright Name
strAppName As String | Name of the Application
strCaption As String | Caption
strDate As String | Date

End Type


About

Sub About (frmApp As Form, sAboutInfo As AboutInfo)

Displays the About window for an application.

FrmApp | FrmApp is the Name of the About Form (About.FRM)
sAboutInfo | This is the AboutInfor type, containing the informatoin to be displayed in the about box


AboutEnd

Sub AboutEnd ()

Removes a displayed About window.


AboutInfoDef

Sub AboutInfoDef (sAboutInfo As AboutInfo)

Fills the sAboutInfo structure with default values for the application.

sAboutInfo

Structure to be filled


Acquire.BAS

Provides a collection of MassLynx Acquire functions, for setting the instrument status and setting up/performing acquisitions.

  • Data type declarations

  • AcquCalibrate

  • AcquCaliNew

  • AcquControlPanel

  • AcquDataActive

  • AcquInlet

  • AcquOperate

  • AcquStop

  • AcquTune

  • AcquTuneCaption

  • AcquTuneExit

  • AcquTuneIonMode

  • AutoTune

  • CalibrateCaption

  • CalibrateMS

  • FillMLIonModes

  • IonMode_Set

  • WaitForAcquisition

  • WaitForSampleNum


MassLynx Macro Programming Manual - Acquire.BAS - Data type declarations

Data Type Declarations

MLIONMODE MassLynx Ionisation Modes.

Type MLIONMODE

Num | As Integer | Ionisation number
Text | As String * 4 | Description of ionisation mode
IDM | As Long | The ID number of the corresponding menu option.

End Type


AcquCalibrate

Function AcquCalibrate() As Integer

Start the instrument calibration facility, using current calibration parameters. Returns True if successful.


AcquCaliNew

Function AcquCaliNew () As Integer

Calibrate the MS. If the calibration was successful, i.e. if the calibration was updated, then the return value is True. If the calibration was unsuccessful then the return value is false.


AcquControlPanel

Function AcquControlPanel () As Long

Starts the acquisition control panel. Returns handle of Control Panel.


AcquDataActive

Function AcquDataActive () As Integer

Checks to see if data is actually being written to disk. Returns True if it is.


AcquInlet

Sub AcquInlet ()

Start the acquisition inlet editor.


AcquOperate

Sub AcquOperate (bOperate As Integer)

Set the instrument into operate or standby.

bOperate | True | Set the instrument to operate
 | False | Set the instrument to standby


AcquStop

Function AcquStop (dfTimeOut As Double) As Integer

Stops the current acquisition. Returns True if successful.

dfTimeOut

Time to wait for the system to stop acquiring

Note: Use CDbl(CVDate("hh:mm:ss") to create dfTimeOut.


AcquTune

Function AcquTune () As Integer

Start the tune page, using the current ionisation mode. Returns the handle of the Tune window.


AcquTuneCaption

Function AcquTuneCaption () As String

Returns the current Tune window caption.


AcquTuneExit

Sub AcquTuneExit ()

Exit from the tune page.


AcquTuneIonMode

Sub AcquTuneIonMode (lpIonMode As String)

Sets the tune page ionisation mode.

lpIonMode

Ionisation mode, see below

lpIonMode should be text from the following list:

Ionisation Mode | Ionisation number
EI+ | 0
EI- | 1
CI+ | 2
CI- | 3
FAB+ | 4
FAB- | 5
TSP+ | 6
TSP- | 7
ESP+ | 8
ESP- | 9
API+ | 10
API- | 11


AutoTune

Sub AutoTune ()

Start the instrument AutoTune facility using current autotune parameters.


CalibrateCaption

Function CalibrateCaption () As String

Returns the current calibration window caption.


CalibrateMS

Sub CalibrateMS (idStatus As Control)

Start the instrument calibration facility using current calibration parameters.

idStatus

The control passed will have its caption property changed to:
"MS Calibration Completed" if successful
"MS Calibration not Completed" if not successful

Note: idStatus msswith a caption property (e.g. a Label)


FillMLIonModes

Sub FillMLIonModes (MLModes() As MLIONMODE)

Fills an array with ion mode numbers and associated text.

MlModes

Array of MLIONMODE data types, each of which will correspond to an ion mode


IonMode_Set

Function IonMode_Set (nReqMode As Integer) As Integer

Sets the ionisation mode. Returns the current mode.

nModeEntry

Ionisation mode code, see below

nModeEntry should be one of the following values:

Ionisation number

Ionisation Mode

0

EI+

EI-

CI+

CI-

FAB+

FAB-

TSP+

TSP-

ESP+

ESP-

API+

API-


WaitForAcquisition

Sub WaitForAcquisition ()

Waits for an acquisition to start and finish before returning from the procedure.


WaitForSampleNum

Sub WaitForSampleNum (wSampNum As Integer)

Waits for the specified sample number to be acquired before returning from the subroutine.

wSampNum

Sample number to wait for


Chro.BAS

This document describes the user interface for the most useful Visual Basic functions and subroutines held in the file CHRO.bas

  • Data type declarations

  • ChroAlign

  • ChroAnalogue

  • ChroBPI

  • ChroCaption

  • ChroCentreAt

  • ChroClose

  • ChroCombineScans

  • ChroDescToChroType

  • ChroDisplayAcquRange

  • ChroDisplayDefault

  • ChroDisplayFrom

  • ChroDisplayRange

  • ChroDlg

  • ChroExit

  • ChroFileOpen

  • ChrohWnd

  • ChroIntegrate

  • ChroList

  • ChroListArray

  • ChroListArrayMaxInt

  • Chrom

  • ChroMassChro

  • ChroMoveFirst

  • ChroMoveLast

  • ChroNewTrace

  • ChroPeakList

  • ChroPeakListArray

  • ChroPeakListArrayBP

  • ChroPeakListBP

  • ChroPeakListField

  • ChroPrint

  • ChroReadChromatogram

  • ChroReadChromatogramProcess

  • ChroRealTime

  • ChroRealTimeAcqu

  • ChroRemove

  • ChroRemoveAll

  • ChroStats

  • ChroTIC

  • ChroToClip

  • ChroToolBar

  • ChroTraceDisp

  • ChroTraceSet

  • ChroXAxisLabel


MassLynx Macro Programming Manual - Chro.BAS - Data type declarations

Data Type Declarations

DMRAWCHRTYPE Describes the type of chromatogram

Type DMRAWCHRTYPE

nChroType | As Long | Chromatogram type
afMasses (DM_RAW_MAXMASSES) | As Single | Masses for mass chromatograms
wChan | As Integer | Analog channel number
lfWindow | As Double | Mass window
bAbsWindow | As Long | TRUE if mass window is absolute FALSE if mass window is PPM

End Type

CHRO_STATS Chromatogram integration parameters

Type CHRO_STATS

fPeakWidth | As Single | Peak width (mins)
fNoiseLevel | As Single | Peak-to-peak amplitude
bAutoNoise | As Long | Automatically detect noise

End Type

CHROMATOGRAM Single scan of chromatogram information

Type CHROMATOGRAM

Scan | As Long | Scan number
Time | As Single | Time of scan
Intensity | As Single | Intensity at scan

End Type

CHROPEAKLIST Chromatogram peak information

Type CHROPEAKLIST

TopScan | As Single | Scan of peak maximum
Height | As Single | Height of peak maximum
Area | As Single | Area of peak
Start | As Single | Start scan of peak
End | As Single | End scan of peak
StartHeight | As Single | Height of peak start
EndHeight | As Single | Height of peak end

End Type

CHROSTATS Chromatogram statistics

Type CHROSTATS

Num | As Integer | Number of entries
Min | As Single | Minimum intensity
Max | As Single | Maximum intensity
Ave | As Single | Average intensity
SD | As Single | Intensity SD
NoiseMin | As Single | Minimum noise intensity
NoiseMax | As Single | Maximum noise intensity
NoiseAve | As Single | Average noise intensity
NoiseSD | As Single | Noise intensity SD


ChroAlign

Sub ChroAlign (nTrace As Integer, fAlignTime As Single)

Sets the alignment value for a trace of a function.

nTrace | The trace to set the align time for
fAlignTime | The time to use in order to align the data


ChroAnalogue

Sub ChroAnalogue (As Integer, nMode As Integer)

Displays an analog channel.

nChannelReq |  | Analog channel number to be displayed
wMode | ADD | Adds the new trace to the current window
 | REPLACE | Replaces the currently active trace
 | NEW_WINDOW | Generates a new window for the new trace

The wMode setting is the same as checking the boxes in the Analog Chromatogram window. It is advisable to reset the mode when you have finished.


ChroBPI

Sub ChroBPI (wMode As Integer)

Produces a Base Peak Intensity Chromatogram for the current data file.

wMode | ADD | Adds the new trace to the current window
 | REPLACE | Replaces the currently active trace
 | NEW_WINDOW | Generates a new window for the new trace

The wMode setting is the same as checking the boxes in the data browser. It is advisable to reset the mode when you have finished.


ChroCaption

Function ChroCaption(wFull As Integer) As String

Returns the caption for the current chromatogram window.

wFull | True | Return process name and current raw file
 | False | Return process name only


ChroCentreAt

Sub ChroCentreAt (fCentre As Single, fWindow As Single)

Centres the current chromatogram on a selected scan width window.

fCentre | The scan to centre on
fWindow | The width to display either side of fCentre


ChroClose

Sub ChroClose ()

Closes the Chromatogram utility


ChroCombineScans

Sub ChroCombineScans (dwAveS As Long, dwAveE As Long, dwSub1S As Long, dwSub1E As Long, dwSub2S As Long, dwSub2E As Long, fMassWin As Single, fSubMult As Single)

Performs a combine operation on the currently active chromatogram using the average, subtract, window and multiplication parameters passed to the function. The parameters represent those fields available from the Combine dialogue box.

dwAveS | Scan number for the first scan to be combined
dwAveE | Scan number of the end scan to be combined
dwSub1S | Start scan of the first subtract region
dwSub1E | End scan of the first subtract region
dwSub2S | Start scan of the second subtract region
dwSub2E | End Scan of the second subtract region
fMassWin | Peak Separation for the combine
fSubMult | Scaling factor for the subtract regions


ChroDescToChroType

Function ChroDescToChroType (lpChroDesc As String, lpChroType As DMRAWCHRTYPE) As Integer

Takes a Chromatogram description and converts it to a DMRAWCHRTYPE, returns True if successful or False if an invalid chromatogram type is requested.

lpChroDesc | String description of chromatogram type
lpChroType | Resulting DMRAWCHRTYPE structure


ChroDisplayAcquRange

Sub ChroDisplayAcquRange ()

Rescales the Chromatogram Window to the acquired scan range/retention time of the currently active chromatogram trace


ChroDisplayDefault

Sub ChroDisplayDefault ()

Rescales the Chromatogram Window to the default scan range/retention time.


ChroDisplayFrom

Sub ChroDisplayFrom (LoScanTime As Single)

Draws the chromatogram from the start time indicated by the input parameter

LoScanTime

Scan number or retention tine to start drawing the chromatogram

The format of LoScanTime depends on the X-axis labelling mode, time or scan.


ChroDisplayRange

Sub ChroDisplayRange (StartPoint As Single, EndPoint As Single)

Draws the chromatogram between the start and end points provided by the parameters

StartPoint | Start of display range
EndPoint | End of display range

The format of Start/EndPoint depends on the X-axis labelling mode, time or scan.


ChroDlg

Function ChroDlg(nChroMenuID As Long, strCaption As String, bChild As Integer) As Long

Displays a dialogue box from the chromatogram.

nChroMenuID | Menu ID used to display the required box
strCaption | Caption of the required dialogue box
bChild | True if the dialogue box is to be a child window of the chromatogram

Return value is either the window handle of the required dialogue box, or zero if it was not found.


ChroExit

Function ChroExit() As Integer

Closes/exits the chromatogram. Returns true.


ChroFileOpen

Function ChroFileOpen(ByVAL strvFileName As String, nrMode As Integer) As Integer

Opens a data file. Returns True if successful, otherwise returns False.

strvFileName |  | File name to open
Mode | ADD | Adds the new trace to the current window
 | REPLACE | Replaces the currently active trace
 | NEW_WINDOW | Generates a new window for the new trace

The Mode setting is the same as checking the boxes in the data browser. It is advisable to reset the mode when you have finished.


ChrohWnd

Function ChrohWnd () As Integer

Returns the current window handle for the Chromatogram utility. This will allow switching to and from the chromatogram window, without having to close and reopen.


ChroIntegrate

Sub ChroIntegrate ()

Integrates the active chromatogram using the parameters already set in the MassLynx dialog.


ChroList

Function ChroList (ChroListFile As String) As Long

Writes out the current chromatogram to a file. Return value is the number of entries in the chromatogram.

ChroListFile

The file name to write the chromatogram to


ChroListArray

Function ChroListArray (CHROMATOGRAM() As CHROMATOGRAM) As Long

Creates an array of CHROMATOGRAM entries for the current chromatogram. The return value is the number of entries created.


ChroListArrayMaxInt

Function ChroListArrayMaxInt (List() As CHROMATOGRAM, MaxIntAtScan As CHROMATOGRAM) As Integer

Returns the position and information for the MaxInt from a chromatogram list.

List() | Supplied to the function, this is the list of peaks in the chromatogram (could be created by ChroReadChromatogram).
MaxIntAtScan | The chromatogram entry for the MaxInt scan

The return value is the position in the List() structure of the MaxInt


Chrom

Sub Chrom()

Starts the chromatogram window from MassLynx. The window will contain the last chromatogram displayed.


ChroMassChro

Sub ChroMassChro(strMasses As String, wMode As Integer, nFunc As Integer)

Produces a Mass Chromatogram trace as specified by the input parameters.

strMasses | <number> | Produces a single trace on mass <number>
 | <number1>,<number2> | Produces a trace for each of the masses
 | <number1>_<number2> | Produces a summed trace of all the masses in the range
 | <number1>+<number2> | Produces a summed trace of both masses
 | <number1>-<number2> | Produces a trace of <number2> subtracted from <number1>
wMode | ADD | Adds the new trace to the current window
 | REPLACE | Replaces the currently active trace
 | NEW_WINDOW | Generates a new window for the new trace
nFunc |  | Number of function to display

The wMode setting is the same as checking the boxes in the Mass Chromatogram window. It is advisable to reset the mode when you have finished.


ChroMoveFirst

Sub ChroMoveFirst()

Moves the current chromatogram to the bottom/first position.


ChroMoveLast

Sub ChroMoveLast()

Moves the current chromatogram to the top/last position.


ChroNewTrace

Sub ChroNewTrace (nMode As Integer)

Sets how new traces are added to the chromatogram window.

nMode | ADD | Adds the new trace to the current window
 | REPLACE | Replaces the currently active trace
 | NEW_WINDOW | Generates a new window for the new trace


ChroPeakList

Function ChroPeakList (ChroPeakListFile As String) As Integer

Writes out the current chromatograms peak list to a file. Return value is number of peaks in chromatogram.

ChroListFile

The file name to write the chromatogram to.

An integration must have been performed on the chromatogram before any peaks will be visible.


ChroPeakListArray

Function ChroPeakListArray(ChromatogramPeaks() As ChroPeakList) As Integer

Writes the detected peaks to an array. Each entry has a ChroPeakList data format. The return value is the number of entries created.

ChromatogramPeaks

Array produced by function.

An integration must have been performed on the chromatogram before any peaks will be visible.


ChroPeakListArrayBP

Function ChroPeakListArrayBP (ChroToCheck() As ChroPeakList) As Integer

Returns the position of the BPI from the input array.

ChroToCheck

Array to search for BPI.


ChroPeakListBP

Function ChroPeakListBP (cplFileNum As Integer) As Long

Returns the position of the BPI from the input file.

cplFileNum

File to search for BPI.


ChroPeakListField

Function ChroPeakListField (cplFileNum As Integer, cplRecNum As Long, cplField As Integer) As Single

Returns the requested field from a file.

cplFileNum |  | File containing desired record.
cplRecNum |  | Record to return.
cplField | CPL_TOPSCAN | Returns scan number of peak maximum
 | CPL_HEIGHT | Returns peak height
 | CPL_AREA | Returns peak area
 | CPL_START | Returns scan number of peak start
 | CPL_END | Returns scan number of peak end
 | CPL_STARTHEIGHT | Returns height at start of peak
 | CPL_ENDHEIGHT | Returns height at end of peak


ChroPrint

Sub ChroPrint (bLandScape As Integer)

Prints the current chromatogram contents.

bLandScape | True | Print in landscape mode
 | False | Print in portrait mode


ChroReadChromatogram

Function ChroReadChromatogram (lpFile As String, lpChroDesc As String, wFunc As Integer, fStart As Single, fEnd As Single, wScans As Integer, lpChro() As CHROMATOGRAM) As Long

Reads a chromatogram between the specified start and end points and produces a CHROMATOGRAM array of points in the chromatogram. Returns the number of entries in the array.

lpFile | File name to read chromatogram from
lpChroDesc | Chromatogram descriptor to be returned
wFunc | Function number to read
fStart | Start point for creation of list, 0 = first scan
fEnd | End point for creation of list, 0 = last scan
wScans | Start/end point type, True = by Scan number False = by Retention Time
lpChro() | List of entries returned back from function


ChroReadChromatogramProcess

Function ChroReadChromatogramProcess(lpFile As String, lpChroDesc As String, wFunc As Integer, wProc As Integer, fStart As Single, fEnd As Single, wScans As Integer, lpChro() As CHROMATOGRAM) As Long

Reads a chromatogram between the specified start and end points and for a specified process and produces a CHROMATOGRAM array of points in the chromatogram. Returns the number of entries in the array.

lpFile | File name to read chromatogram from
lpChroDesc | Chromatogram descriptor to be returned
wFunc | Function number to read
wProc | Process number to read
fStart | Start point for creation of list, 0 = first scan
fEnd | End point for creation of list, 0 = last scan
wScans | Start/end point type, True = by Scan number False = by Retention Time
lpChro() | List of entries returned back from function


ChroRealTime

Sub ChroRealTime (wRealTime As Integer)

Turns real time update on or off during an acquisition

wRealTime | True | Sets real time updates
 | False | Turns real time update off

ChroRealTime only works during an acquisition. The chromatogram is not updated during SolventDelay or WaitingForInletStart time periods.


ChroRealTimeAcqu

Sub ChroRealTimeAcqu ()

Displays the current acquiring data file in real time. The subroutine will not exit until the acquisition has finished.


ChroRemove

Sub ChroRemove (wGraph As Integer)

Removes a chromatogram from the current active window.

wGraph

Chromatogram number

If wGraph is 0 all chromatograms are removed.


ChroRemoveAll

Sub ChroRemoveAll ()

Removes all chromatograms from the current active window


ChroStats

Sub ChroStats (lpChroList() As CHROMATOGRAM, lpChroStats As ChroStats)

Calculate some special noise statistics about the chromatogram

lpChroList() | List of chromatogram entries
lpChroStats | Returned statistics including mean, ave, SD etc.


ChroTIC

Sub ChroTIC (bBPI As Integer, wMode As Integer, nFunc as Integer)

Displays a TIC chromatogram for the current dataset.

bBPI | True | Produce a BPI chromatogram
 | False | Produce a TIC chromatogram
wMode | ADD | Adds the new trace to the current window
 | REPLACE | Replaces the currently active trace
 | NEW_WINDOW | Generates a new window for the new trace
nFunc |  | Number of function to display

The wMode setting is the same as checking the boxes in the data browser. It is advisable to reset the mode when you have finished.


ChroToClip

Sub ChroToClip()

Copies the first 64 kbytes of the current chromatograms data.


ChroToolBar

Sub ChroToolBar (wBarOn As Integer)

Turns the chromatogram toolbar on or off

wBarOn | True | Enables the toolbar
 | False | Disables the toolbar


ChroTraceDisp

Sub ChroTraceDisp (strTrace As String, nMode As Integer, nFunc As Integer)

Display a chomatogram type as defined in the input parameters

strTrace | TIC | Produce a TIC chromatogram
 | BPI | Produce a BPI chromatogram
 | ANn | Produce an chromatogram for Analogue channel n
nMode | ADD | Adds the new trace to the current window
 | REPLACE | Replaces the currently active trace
 | NEW_WINDOW | Generates a new window for the new trace
nFunc |  | Number of function to display

The nMode setting is the same as checking the boxes in the data browser. It is advisable to reset the mode when you have finished.


ChroTraceSet

Function ChroTraceSet (nTrace As Integer) As Integer

Sets the current trace. Returns nTrace if successful, otherwise returns zero.

nTrace

The trace to set as the current trace


ChroXAxisLabel

Sub ChroXAxisLabel (ScanOrTime As Integer)

Used to determine the labelling convention for the X Axis

ScanOrTime | CX_TIME | Uses the retention time
 | CX_SCAN | Uses scan number


Declares.BAS

As the name suggests this module declares a number of external subroutines and functions for interfacing to and from Windows. Full descriptions of these functions can be found in the Visual Basic Language Reference. The module also contains some basic window handling functions.

  • Data type declarations

  • CheckDlgButton32

  • ClassName

  • CountSeps

  • DirFromPath

  • DlgBoxClose

  • DlgItemValidate

  • FindChildWindow

  • FindWindowCaption

  • Form_AutoPos

  • FormPosGet

  • FormPosRead

  • FormPosSet

  • FormPosWrite

  • GetAllChildren

  • GetAllWindows

  • GetATempFile

  • GetDlgItem32

  • GetIniSectionEntries

  • GetMenuText

  • GetPrivateProfileInteger

  • GetPrivateProfileStr

  • GetWindowCaption

  • GetWindowLayout

  • IniEntry_Remove

  • IniMultiEntryStr

  • IniSect_Remove

  • LTrimWS

  • MidStr

  • MnuDlg_Disp

  • NthString

  • PostMessage

  • ProcessActive

  • ProcsActive

  • ReadWindowLayout

  • RTrimWS

  • SendMessage

  • SetWindowLayout

  • StringToArray

  • StringToFloats

  • SZToVB

  • TrimWS

  • WaitForChildWindow

  • WaitForWindow

  • WindowInfo_Dump

  • WindowInfo_Get

  • WritePrivateProfileInteger

  • WritePrivateProfileStr

  • WriteWindowLayout


MassLynx Macro Programming Manual - Declares.BAS - Data type declarations

Data type declarations

RECT Describes a window rectangle

Type RECT

Left | As Long | Left coordinate
Top | As Single | Top coordinate
Right | As Integer | Right coordinate
Bottom | As Double | Bottom coordinate

End Type

WINDOWLINK Full window description

Type WINDOWLINK

hWnd | As Long | Handle of window
hParent | As Long | Handle of parent
strCaption | As String | Window caption
strClass | As String | Window class
nID | As Long | Control ID of window
sRect | As RECT | Coordinates of window

End Type

Size Windows SIZE structure

Type Size

cx | As Long | Width of rectangle
cy | As Long | Height of rectangle

End Type


CheckDlgButton32

Sub CheckDlgButton32 (hDlg As Long, nIDCheckBox As Long, bCheck As Long)

Wrapper for Windows CheckDlgButton routine.

hDlg | Dialogue box handle
nIDCheckBox | Control ID for check box
bCheck | State to set the button to


ClassName

Function ClassName (hWnd As Long) As String

Returns the class name for the specified window handle.

hWnd

Window handle


CountSeps

Function CountSeps (lpIniString As String, lpSep As String, awSepPos() As Integer) As Integer

Finds the position of separators in a string. Returns the number of separators.

lpIniString | String to search
lpSep | Separator to search for
awSepPos() | Array of separator positions


DirFromPath

Function DirFromPath (lpPath As String, wDirNum As Integer, awSepPos() As Integer) As String

Returns a substring of the input string, ending at the specified separator and starting at the previous one.

lpPath | String to search
wDirNum | Number of the ending separator
awSepPos() | Positions of all the separators


DlgBoxClose

Function DlgBoxClose (hDlg As Long, nID As Long, dfTimeOut As Double) As Integer

Closes down a dialogue box by calling either the OK or Cancel button. Returns True if dialogue box is closed.

hDlg | Dialogue box to close
nID | Control ID of button to use
dfTimeOut | Time to wait for the window to close. -1 if there is an indefinite wait.


DlgItemValidate

Function DlgItemValidate (hDlg As Long, nID As Long) As Long

Checks that a dialogue control is valid. Returns the handle of the dialogue item.

hDlg | Handle of the dialogue box
nID | Control ID to validate


FindChildWindow

Function FindChildWindow (hParent As Long, lpChildCaption As String) As Long

Returns the handle of a child window with the best fit to the supplied caption.

hParent | Parent window handle
lpChildCaption | Window caption to search for


FindWindowCaption

Function FindWindowCaption (lpCaption As String) As Long

Returns the handle of the window whose caption is the best fit to the input string.

lpCaption

Window caption to search for


Form_AutoPos

Sub Form_AutoPos (frmParent As Form, frmChild As Form)

Positions a child form automatically with respect to a parent form.

frmParent | Parent form
frmChild | Child form


FormPosGet

Sub FormPosGet (frm As Form, lpFormPos As RECT)

Gets the position of a form.

frm | Form to find the position of
lpFormPos | Position of the form


FormPosRead

Sub FormPosRead (lpFormSection As String, lpForm As String, lpFormIniFile As String, lpFormPos As RECT)

Reads the form positioning and sizing information from an .INI file.

lpFormSection | .INI file section containing form information
lpForm | Name of the field within lpFormSection
lpFormIniFile | .INI file to read from
lpFormPos | Positional information of the form


FormPosSet

Sub FormPosSet (frm As Form, lpFormPos As RECT)

Sets the position of a form.

frm | Form to set the position of
lpFormPos | Position of the form


FormPosWrite

Sub FormPosWrite (lpFormSection As String, lpForm As String, lpFormIniFile As String, lpFormPos As RECT)

Writes the form positioning and sizing information to an .INI file.

lpFormSection | .INI file section containing form information
lpForm | Name of the field within lpFormSection
lpFormIniFile | .INI file to write to
lpFormPos | Positional information of the form


GetAllChildren

Function GetAllChildren (hParent As Long) As Integer

Returns the number of child windows of a specified parent.

hParent

Parent window


GetAllWindows

Function GetAllWindows (lpWindows() As WINDOWLINK) As Integer

Finds all windows and their associated parents. Returns the number of windows found.

lpWindows()

Array of window descriptors


GetATempFile

Function GetATempFile (lpPrefix As String) As String

Returns the next available windows .TMP file name.

lpPrefix

String to use as the prefix of the file name


GetDlgItem32

Function GetDlgItem32 (hDlg As Long, nIDDlgItem As Long) As Long

Wrapper for DlgItemValidate routine.

hDlg | Handle of the dialogue box
nIDDlgItem | Control ID to validate


GetIniSectionEntries

Function GetIniSectionEntries (lpIniFile As String, lpSection As String, lpEntries() As String) As Integer

Gets the entries in the named section of an .INI type file. Returns the number of entries in the section.

lpIniFile | .INI file to read
lpSection | Section within lpIniFile to read
lpEntries() | Array of .INI file entries


GetMenuText

Function GetMenuText (hWnd As Long, nID As Long) As String

Returns the text associated with a menu item from a window.

hWnd | Window handle
nID | Menu item control ID


GetPrivateProfileInteger

Function GetPrivateProfileInteger (lpSection As String, lpEntry As String, lpIniFile As String) As Integer

Wrapper for Windows GetPrivateProfileInt routine. Returns value of integer field from .INI file, 0 is set as the default.

lpSection | Section within lpIniFile to read
lpEntry | Field within lpSection to read
lpIniFile | Name of .INI file to read


GetPrivateProfileStr

Function GetPrivateProfileStr (lpSection As String, lpEntry As String, lpIniFile As String) As String

Wrapper for Windows GetPrivateProfileString routine. Returns value of string field from .INI file, an empty string is set as the default.

lpSection | Section within lpIniFile to read
lpEntry | Field within lpSection to read
lpIniFile | Name of .INI file to read


GetWindowCaption

Function GetWindowCaption (hWnd As Long) As String

Wrapper for Windows GetWindowText routine. Returns the caption of the specified window.

hWnd

Window handle


GetWindowLayout

Sub GetWindowLayout (hWnd As Long, lpWinRect As RECT)

Wrapper for Windows GetWindowRect routine. Gets the dimensions of the specified window.

hWnd | Window handle
lpWinRect | Window dimensions


IniEntry_Remove

Sub IniEntry_Remove (strSect As String, strEntry As String, strIniFile As String)

Removes an entry from an .INI file.

strSect | Section of strIniFile
strEntry | Entry in strSect to remove
strIniFile | Name of .INI file


IniMultiEntryStr

Function IniMultiEntryStr (strSect As String, strEntry As String, strIniFile As String, strSep As String, astrValue() As String) As Integer

Reads a multi-value .INI file entry. Returns the number of values read.

strSect | Section of strIniFile
strEntry | Entry in strSect to read
strIniFile | Name of .INI file
strSep | Character separating the values
astrValue() | Array of values read


IniSect_Remove

Sub IniSect_Remove (strSect As String, strIniFile As String)

Removes a section from an .INI file.

strSect | Section to remove
strIniFile | File containing strSect


LTrimWS

Function LtrimWS (strString As String) As String

Removes white space characters from the beginning of a string. Returns the tidied string.

strString

The string to be tidied


MidStr

Function MidStr (strString As String, n1stChar As Integer, nLstChar As Integer) As String

Similar to the VB function Mid, except the end position of the substring is use instead of its length. Returns the substring.

strString | Starting string
n1stChar | Position of the first character of the substring
nLstChar | Position of the last character of the substring


MnuDlg_Disp

Opens a dialogue box, by posting a WM_COMMAND message to the parent window. Returns the window handle of the dialogue box.

hParent | Window handle that receives the message
nID | Menu item ID
strCaption | Window caption of the dialogue box
nTimeout | Time in seconds to wait for dialogue to appear
bChild | Whether the dialogue is a child of the initial window


NthString

Function NthString (strConcat As String, nIndex As Integer, strSep As String) As String

Returns the nth substring from the input string.

strConcat | String to search
nIndex | Number of the substring to be returned
strSep | Character used to separate the substrings


PostMessage

Function PostMessage (hWnd As Long, wMsg As Long, wParam As Long, lParam As Long) As Long

Wrapper for Windows PostMessage routine.

hWnd | Handle of the window receiving the message
wMsg | The message to be posted
wParam | Additional information for specific messages
lParam | Additional information for specific messages


ProcessActive

Function ProcessActive(Process As String) As Long

Determines whether the specified process is currently active. Returns the window handle of the process if active.

Process

Process to search for


ProcsActive

Sub ProcsActive (lpzProcess() As String * 81, lpHWnd() As Integer)

Determines which functions from an input array are active.

lpzProcess() | Array of process names
lpHWnd() | Array of window handles, or 0 if a process is not active


ReadWindowLayout

Sub ReadWindowLayout (lpIniFile As String, lpSection As String, lpWinRect As RECT)

Reads a window layout from an .INI file.

lpIniFile | .INI file to read
lpSection | Section in lpIniFile containing window layout
lpWinRect | Structure for returning window layout


RTrimWS

Removes white space characters from the end of a string. Returns the tidied string.

strString

The string to be tidied


SendMessage

Function SendMessage (hWnd As Long, wMsg As Long, wParam As Long, lParam As Long) As Long

Wrapper for Windows SendMessage routine.

hWnd | Handle of the window receiving the message
wMsg | The message to be sent
wParam | Additional information for specific messages
lParam | Additional information for specific messages


SetWindowLayout

Sub SetWindowLayout (hWnd As Long, lpWinRect As RECT)

Sets the size and positioning of a window.

hWnd | Handle of the window to be positioned
lpWinRect | Size and positioning information for window


StringToArray

Function StringToArray (strString As String, strSep As String, astrString() As String) As Integer

Creates an array of strings from an input string. Returns the number of substrings found.

strString | Input string
strSep | Character used to separate the substrings
astrString() | Array of substrings found


StringToFloats

Function StringToFloats (strString As String, strSep As String, adfNum() As Double) As Integer

Creates an array of floats from an input string. Returns the number of floats found.

strString | Input string
strSep | Character used to separate the floats
adfNum() | Array of floats found


SZToVB

Function SZToVB (As String) As String

Converts a null terminated string to a standard VB string. Returns the VB string.

lpSzString

The string to convert


TrimWS

Function TrimWS (strString As String) As String

Removes white space characters from the beginning and end of a string. Returns the tidied string.

strString

The string to be tidied


WaitForChildWindow

Function WaitForChildWindow (hParent As Long, lpChildCaption As String, wTimeout As Integer) As Long

Waits for a defined time for a child window to appear, returns the child window handle.

hParent | Handle of parent window
lpChildCaption | Caption of child window
wTimeout | Time (seconds) to wait for child to appear


WaitForWindow

Function WaitForWindow (lpCaption As String, wTimeout As Integer) As Long

Waits for a defined time for a window to appear, returns the window handle.

lpCaption | Caption of window
wTimeout | Time (seconds) to wait for window to appear


WindowInfo_Dump

Sub WindowInfo_Dump (sWindowLink As WINDOWLINK)

Dumps window information to VB debug window.

sWindowLink

Window information structure


WindowInfo_Get

Sub WindowInfo_Get (hWnd As Long, sWindowLink As WINDOWLINK)

Gets the information about a window.

hWnd | Handle of window
sWindowLink | Window information structure


WritePrivateProfileInteger

Sub WritePrivateProfileInteger (lpSection As String, lpEntry As String, wInt As Long, lpIniFile As String)

Writes integer information to an .INI file.

lpSection | Section in lpIniFile to write to
lpEntry | Entry in lpSection to write
wInt | Value of integer to write
lpIniFile | .INI file to write to


WritePrivateProfileStr

Sub WritePrivateProfileStr (lpSection As String, lpEntry As String, lpString As String, lpIniFile As String)

Writes string information to an .INI file.

lpSection | Section in lpIniFile to write to
lpEntry | Entry in lpSection to write
lpString | String to write
lpIniFile | .INI file to write to


WriteWindowLayout

Sub WriteWindowLayout (lpIniFile As String, lpSection As String, lpWinRect As RECT)

Writes a window layout to an .INI file.

lpIniFile | .INI file to write
lpSection | Section in lpIniFile containing window layout
lpWinRect | Window structure to write


Dosutils.BAS

As the name suggests this module provides a number of subroutines and functions for interfacing to some of the common DOS commands such as DIR.

  • FileExists

  • FileSearch

  • GetDOSFileDrive

  • GetDOSFileExt

  • GetDOSFileName

  • GetDOSFilePath

  • LocalDirToNetDir


FileExists

Function FileExists (lpSearchPath As String) As Integer

Returns True if file/directory exists.

lpSearchPath

Path to test


FileSearch

Function FileSearch (FilePath As String, FileList() As String * 16) As Integer

Returns the number of files found within the specified path.

FilePath | Path to test
FileList() | Array of filenames found in the path


GetDOSFileDrive

Function GetDOSFileDrive (WholeFileName As String) As String

Returns the drive letter of a specified file.

WholeFileName

Full file path


GetDOSFileExt

Function GetDOSFileExt (WholeFileName As String) As String

Returns the extension of a specified file.

WholeFileName

Full file path


GetDOSFileName

Function GetDOSFileName (WholeFileName As String) As String

Returns the file name of a specified file.

WholeFileName

Full file path


GetDOSFilePath

Function GetDOSFilePath (WholeFileName As String) As String

Returns the directory of a specified file.

WholeFileName

Full file path


LocalDirToNetDir

Function LocalDirToNetDir (strLocalDir As String, strNetDrv As String, strNetDir As String) As Integer

Converts a local directory to a network directory. e.g. c:\masslynx\data on local PC is seen as d:\data on a network PC if c:\masslynx on local PC is seen as d: on network PC. LocalDirToNetDir must be running on the network PC. Returns True if successful.

strLocalDir | Full path of directory on local PC
strNetDrv | Drive letter of mapped drive on network PC
strNetDir | Returned network directory


Error.BAS

A series of error-handling functions.

  • Error_Disp

  • Error_Log

  • Error_LogDisp

  • ErrorLogState

  • ErrSub

  • LogMsg

  • ThrowError


Error_Disp

Sub Error_Disp (strModule As String, strFunc As String, strParams As String)

Displays an error in a message box.

strModule | The name of the module where the error occurred, e.g. FORM1.FRM
strFunc | The function in strModule where the error occurred
strParams | Any other information associated with the error


Error_Log

Sub Error_Log (strModule As String, strFunction As String, strMessage As String)

Writes an error message to the application log file. The most recent error state is used and recorded.

strModule | The name of the module where the error occurred, e.g. FORM1.FRM
strFunction | The function in strModule where the error occurred
strMessage | Any other information associated with the error


Error_LogDisp

Sub Error_LogDisp (strModule As String, strFunc As String, strParams As String)

Displays an error in a message box, then writes an error message to the application log file.

strModule | The name of the module where the error occurred, e.g. FORM1.FRM
strFunc | The function in strModule where the error occurred
strParams | Any other information associated with the error


ErrorLogState

Sub ErrorLogState (strModule As String, strFunction As String, strMessage As String)

Writes an error message to the application log file, only if the application .INI file has the following entry:

[Logging]
LogMode=1.

The most recent error state is used and recorded.

strModule | The name of the module where the error occurred, e.g. FORM1.FRM
strFunction | The function in strModule where the error occurred
strMessage | Any other information associated with the error


ErrSub

Sub ErrSub (lpModule As String, lpFunc As String, lpPars As String)

Checks and displays the last error. Returns False.

lpModule | The name of the module where the error occurred, e.g. FORM1.FRM
lpFunc | The function in strModule where the error occurred
lpPars | Any other information associated with the error


LogMsg

Sub LogMsg (strMessage As String)

Writes a message to the application log file.

strMessage

The message to write to the file


ThrowError

Sub ThrowError (nCode As Integer, strDesc As String)

Creates an error.

nCode | The error code to throw
strDesc | The user description of the error code to throw


Integrat.BAS

This module contains useful tools for interfacing to the MassLynx integration functions.

Data type declarations

IntegrateChro

IntegrateChromatogramProcess

IntegrateParsEdit


MassLynx Macro Programming Manual - Integrat.BAS - Data type declarations

Data type declarations

SMO_PARAMS Smoothing parameters

Type SMO_PARAMS

nMethod | As Long | Smoothing method
nSGPoly | As Long | Order of SG polynomial
nSGDeriv | As Long | Order of SG derivative
nWidth | As Long | Width of smoothing window
nIterates | As Long | No of iterations
bMedianConv | As Long | Median smooth to convergence?
bAllowMedian | As Long | Median smooth allowed?
fPeakWidth | As Single | Spectrum peak width
fFactor | As Single | Chromatogram smooth factor
bUsePeakWidth | As Long | Use peak width parameter

End Type

PKD_FULL_PEAK Full peak structure

Type PKD_FULL_PEAK

fStart | As Single | Baseline start X
fStartHt | As Single | Baseline start Y
nStartType | As Long | Baseline start type
fEnd | As Single | Baseline end X
fEndHt | As Single | Baseline end Y
nEndType | As Long | Baseline end type
fTop | As Single | Peak top X
fHeight | As Single | Peak top Y
fCent | As Single | Centroid X
fCentHt | As Single | Centroid Y
fArea | As Single | Peak area
nFlags | As Long | Flags
fPurityMean | As Single | Purity Index
fPuritySigma | As Single | Purity standard deviation
nInterferenceFlag | As Long | Can be PKD_NONE, PKD_POSITIVE or PKD_NEGATIVE
nPack1 | As Long | Structure packing variable, not used
dInterferencePercentage | As Double | Percentage difference between secondary traces.
sStats | As PKDSTATS | Peak statistics

End Type

PKD_THRESH Peak detection threshold parameters

Type PKD_THRESH

nPack1 | As Long | Structure packing variable – not used
wRespThreshold | As Integer | 4 bit mask describing which response thresholds selected: 1 – Absolute Height 2 – Relative Height 4 – Absolute Area 8 – Relative Area
fRespAreaRel | As Single | Relative area threshold
fRespAreaAbs | As Single | Absolute area threshold
fRespHeightRel | As Single | Relative height threshold
fRespHeightAbs | As Single | Absolute height threshold

End Type

PKD_PARAMS Peak detection parameters

Type PKD_PARAMS

nPack1 | As Long | Structure packing variable – not used
nMode | As Long | Standard centroid, fast centroid, QTOF centroid
nHalfWidth | As Long | Min peak width at half height
bShldrDetect | As Long | Detect shoulders (True/False)
nShldrWidth | As Long | Min shoulder width
fBalance | As Single | Min peak balance (percent) 100% = Not balanced
fShldrThresh | As Single | Shoulder flatness threshold
fSkim | As Single | Peak skim threshold (percent) 100% = All skimmed
fMinEdge | As Single | Edge threshold
fReduceTail | As Single | Peak tailing reduction
fMaxReduceHt | As Single | Baseline movement limit
nCntrMethod | As Long | Centre method
fCentTop | As Single | Topmost percentage of peak to use for centroid
bMakeSticks | As Long | Centre only – make sticks (True/False)
nSticks | As Long | Centre only – stick type
nWindow | As Long | Centre only – add/replace/new
fBaseWidth | As Single | Peak width at baseline (fast centroid only)
fBaseThresh | As Single | Baseline threshold (fast centroid only)
sWatParams | As PKD_WAT_PARAMS | Waters peak detection parameters
sQTOFParams | As PKD_QTOF_PARAMS | QTOF peak detection parameters
bEnableTOFCentroid | As Long | Allow TOF centroid mode
bEnableAccMassCentroid | As Long | Use centroiding with uncertainty estimation
bAccMassScan | As Long | OUTPUT: Accurate mass scan if true
wAccMassDiagnostic | As Integer | OUTPUT: Bits set on accurate mass failure
bDoAdaptiveSubtract | As Long | Do adaptive background subtract

End Type

INTEGRATE_CHRO_PARAMS Chromatogram integration parameters

Type INTEGRATE_CHRO_PARAMS

bSmooth | As Long | Smoothing on/off
sSmoParams | As SMO_PARAMS | Smooth parameters
sPKDParams | As PKD_PARAMS | Peak detect parameters
sThreshold | As PKD_THRESH | Threshold parameters
sChroStats | As CHRO_STATS | Chromatogram statistics

End Type

INTEGRATE_SPEC_PARAMS Spectrum integration parameters

Type INTEGRATE_SPEC_PARAMS

bSmooth | As Long | Smoothing on/off
sSmoParams | As SMO_PARAMS | Smooth parameters
sPKDParams | As PKD_PARAMS | Peak detect parameters
sThreshold | As PKD_THRESH | Threshold parameters
sSpecStats | As SPEC_STATS | Spectrum statistics

End Type


IntegrateChro

Function IntegrateChro () As Integer

Integrates the chromatogram, using current integration parameters. Returns number of peaks found.


IntegrateChromatogramProcess

Function IntegrateChromatogramProcess (lpWindowCaption As String, sRawFile As VGRAWFILE, wFunc As Integer, lpChroDesc As String, fStart As Single, fEnd As Single, wScans As Integer, lpResults() As PKD_FULL_PEAK, sIntParams As INTEGRATE_CHRO_PARAMS, bUseIni As Integer, hDm As Long, Optional nrTraceNumber As Long = 0) As Integer

Integrates the chromatogram over the requested range. Returns number of peaks found.

lpWindowCaption |  | Chromatogram window caption
sRawFile |  | File to integrate
wFunc |  | Function to integrate
lpChroDesc |  | Chromatogram description
fStart |  | Start time for integration
fEnd |  | End time for integration
wScans | True | Indicates start/end as scan numbers
 | False | Indicates start/end as times
lpResults() |  | Returned list of integrated peak details
sIntParams |  | Structure containing parameters to be used when bUseIni = False
bUseIni | True | Use parameters from .INI file
 | False | Use parameters specified in function call
hDm |  | Data manager handle of returned chromatogram window
nrTraceNumber |  | Which trace to integrate, optional (0 if not specified)


IntegrateParsEdit

Function IntegrateParsEdit (hWnd As Long, sIntegrateParams As INTEGRATE_CHRO_PARAMS) As Integer

Brings up the integrate editor and sets the parameters according to the INTEGRATE_CHRO_PARAMS structure. If any of the parameters are changed, this is reflected in the structure after the function call. Returns True if any of the integration parameters have changed.

hWnd | Handle of integrate window
sIntegrateParams | Integration parameters to be used and written to


Iso.BAS

This module contains one function for driving the MassLynx isotope routine.

  • Isotope


Isotope

Function Isotope (strFormula As String, nMode As Integer) As Integer

Runs the isotope routine from the spectrum window. Returns True if successful.

strFormula |  | Chemical formula for the compound
nMode | ADD | Adds the new trace to the current window
 | REPLACE | Replaces the currently active trace
 | NEW_WINDOW | Generates a new window for the new trace

The nMode setting is the same as checking the boxes in the Isotope Modelling window. It is advisable to reset the mode when you have finished.


Library.BAS

This module contains useful tools for interfacing to the MassLynx library functions.

  • GetLibraryResult

  • LipOpen

  • LibPrint


GetLibraryResult

Function GetLibraryResult (ResultFilter As Integer) As String

Returns a library setting from the MassLynx.ini file.

ResultFilter | LIB_FOR_RATING | Forward search rating score
 | LIB_REV_RATING | Reverse search rating score
 | LIB_HITS | Hit number
 | LIB_MOL_MASS | Molecular mass of the selected hit
 | LIB_CAS | Chemical Abstracts Sequence
 | LIB_COMPOUND_NAME | Compound name of the selected hit


LipOpen

Sub LibOpen ()

Opens the library utility.


LibPrint

Sub LibPrint ()

Prints all the active windows in the current library window.


MassLynx.BAS

This module provides a collection of general MassLynx functions.

Data Type Declarations

ActivateML

CBoxSelString

CheckMenuItem

Conv4SK

CpyBuffToStr

CpyStrToBuff

CurrentSampleListEntry

CurrentSPLFile

DataBrowserChroSpec

DataBrowserShow

DataFileExists

DataFunctionSelect

DataProcessSelect

Delay

DMCheckFunction

DMCheckRT

DMCheckScan

DMVerifyFunction

DMVerifyRT

DMVerifyScan

FileToRawFile

FirstSampleListEntry

GetMLFile

GetMLFileDir

GetMLFileEntry

GetMLFileExt

GetMLFileInfo

GetMLFileName

GetMLFileSize

GetMLIniFileInfo

GetRawProcessFiles

HiWord

LastRawProcess

LastSampleListEntry

LBoxSelString

LoWord

MakeLong

MassLynxhWnd

mbFile

mbFileExit

mbFileNew

mbFileOpen

MLAppActive

MLCustSysGlobals

MLFilesList

MLRawFileOpen

ProcDialog_OK

ProDirPath

SendMessageText

SetGlobalFileML

Spare1SampleListEntry

Spare2SampleListEntry

SPLFileName

SqrBrRem

StopProcess

Str2Sng

StrToArray

TextInCB

TextInLB

VGRawFileOpen

WaitForMLApp

WaitForMLPrint

WaitForProcessEnd

WaitForProcessStart

WaitForWindowClose


MassLynx Macro Programming Manual - MassLynx.BAS - Data Type Declarations

Data Type Declarations

ONEKBUFFER

Type ONEKBUFFER

Buffer

As String * 1024

End Type

SINTEGER

Type SINTEGER

w

As Integer

End Type

SLONG

Type SLONG

dw

As Long

End Type

SSINGLE

Type SSINGLE

f

As Single

End Type

SDOUBLE

Type SDOUBLE

lf

As Double

End Type

SCURRENCY

Type SCURRENCY

c

As Currency

End Type

SCHAR

Type SCHAR

Char

As String * 1

End Type

VGFILE File description

Type VGFILE

wType | As Integer | Reserved for MassLynx
szDirectory | As String * 260 | The directory where the file can be found
szName | As String * 256 | The name of the data file i.e. "V50"
szExtension | As String * 256 | The extension of the data file
dwEntry | As Long | This value holds the last scan number viewed in spectrum
dwSize | As Long | This holds the last scan number of the last file opened by MassLynx

End Type

VGRAWFILE Raw file description

Type VGRAWFILE

lpVGFile | As VGFILE | VGFILE data type
wFunc | As Integer | The Acquisition Function number
wProc | As Integer | The Processed data number

End Type

RAWHEADER Raw header file description

Type RAWHEADER

nVersionMajor | As Integer | Major version of file format.
nVersionMinor | As Integer | Minor version of file format.
szAcquName | As String * 260 | Acquired filename, no extn.
szAcquDate | As String * 12 | Acquired date: DD-MMM-YYYY.
szAcquTime | As String * 9 | Acquired time: HH:MM:SS (24 hr).
szJobCode | As String * 80 | Job
szTaskCode | As String * 80 | Task
szUserName | As String * 80 | User
szLabName | As String * 80 | Lab
szInstrument | As String * 80 | Instrument
szConditions | As String * 80 | Conditions
szSampleDesc | As String * 121 | Sample description.
szSubmitter | As String * 80 | Sample submitter
szSampleID | As String * 80 | Sample ID
szBottleNumber | As String * 20 | Bottle/Vial number
lfSolventDelay | As Double | Solvent delay in decimal minutes.
bResolved | As Long | TRUE if resolved data file.
szPepFileName | As String * 260 | Assoc pep/embl filename-inc. dir+ext.
szProcess | As String * 81 | Process descriptor
bEncypted | As Long | Encryption
nAutosamplerType | As Long | Autosampler type
szGasName | As String * 25 | Gas name
szInstrumentType | As String * 25 | Instrument type
szPlateDesc | As String * 121 | Plate descriptor
afAnalogOffset(1 To 4) | As Single | Analogue channel offset times
nMuxStream | As Long | MUX flag

End Type

DMRAWHEADER Extended header information

Type DMRAWHEADER

sRawHeader | As RAWHEADER
wFuncsInFile | As Integer
wAnalogsInFile | As Integer

End Type

MTOF MTOF support structure

Type MTOF

wLinearDetectorVoltage | As Integer
wLinearSensitivity | As Integer
wReflectronLensVoltage | As Integer
wReflectronDetectorVoltage | As Integer
wReflectronSensitivity | As Integer
wLaserRepetitionRate | As Integer
wCoarseLaserControl | As Integer
wFineLaserControl | As Integer
fLaserAimXPos | As Single
fLaserAimYPos | As Single
wNumShotsSummed | As Integer
wNumShotsPerformed | As Integer
wSegmentNumber | As Integer
wNeedle | As Integer
wCounterElectrodeVoltage | As Integer
wSamplingConeVoltage | As Integer
wSkimmerLens | As Integer
wSkimmer | As Integer
wProbeTemperature | As Integer
wSourceTemperature | As Integer
wRFVoltage | As Integer
wSourceAperture | As Integer
wSourceCode | As Integer
wLMResolution | As Integer
wHMResolution | As Integer
fCollisionEnergy | As Single
wIonEnergy | As Integer
wMultiplier1 | As Integer
wMultiplier2 | As Integer
wTransportDC | As Integer
wTOFAperture | As Integer
wAccVoltage | As Integer
wSteering | As Integer
wFocus | As Integer
wEntrance | As Integer
wGuard | As Integer
wTOF | As Integer
wReflection | As Integer
wCollisionRF | As Integer
wTransportRF | As Integer
fSetMass | As Single
bReference | As Byte
bytUseLockMassCorrection | As Byte
fLockMassCorrection | As single
bytUseTempCoreection | As single
fTempCorrection | As single
fTempCoefficient | As single
fFaimsCV | As single

EndType

RAWSCANSTATSEX

Type RAWSCANSTATSEX Extended scan statistics

sMTof | As MTOF
fTIC_A | As single
fTIC_B | As single
bAccurateMass | As Long
WAccurateMassFlg | As Integer

End Type

DMRAWSTATS Scan statistics

Type DMRAWSTATS

fLoMass | As Single | Scan start mass
fHiMass | As Single | Scan end mass
bMolecularMass | As Long | reserved for transforms
bCalibrated | As Long | Data is calibrated. = 1
fRT | As Single | Retention time in minutes
dwPeaksInScan | As Long | # Peaks found in the scan
fTIC | As Single | TIC of the Scan
fBPI | As Single | Base Peak Intensity
fBPM | As Single | Base Peak Mass
wOverload | As Integer | Reserved
bContinuum | As Long | Data is continuum = 1
nIonMode | As Long | Ion Mode (0 - 9)
nSegment | As Long | Scan segment ID number
bGotExtended | As Long | TRUE if extended information valid
sEx | As RAWSCANSTATSEX | Extended scan statistics

End Type

DMRAWIDSPEC Raw ID for spectra structure definition.

Type DMRAWIDSPEC

szFileName | As String * FILENAME_MAX_PLUS_ONE | Raw data file name
wTypeID | As Integer | Raw data type
wFuncNum | As Integer | Function Number
wProcNum | As Integer | Process Number
bCalibrated | As Long | Return calibrated data
lHideLMPeaks | As Long | Determines whether the handle that is returned accesses data with or without lock mass information
nIndex | As Long | Reserved for internal use to keep track of index assigned to file
nSpare1 | As Long | Unused at present
lSpare2 | As Long | Unused at present
bTime | As Long | Determines if actual scan number or time is to be used
fNearestTime | As Single | If times are being used, returns scan with closest RT to this value
dwScanNo | As Long | Scan number to read if not using times. If times are used, returns number of the scan nearest time
bFlags | As Long | True if peak Flags buffer is to be read/written
sStats | As DMRAWSTATS | Returns scan statistics

End Type

COMB_PARAM Combine parameters

Type COMB_PARAM

lStartA | As Long | Range A scan start
lNumberA | As Long | Number of scans in range A
lStartB | As Long | Range B scan start
lNumberB | As Long | Number of scans in range B
lStartC | As Long | Range C start scan
lNumberC | As Long | Number of scans in range C
fFactor | As Single | Range BC multiplication factor
fMassDefect | As Single | In Da per Da
fPeakWidth | As Single | Expected peak width in Da

End Type

RAWCALIBCOEFFS A set of calibration coefficients

Type RAWCALIBCOEFFS

nOrder | As Long
lfCoefficients(0 to 5) | As Double
nType | As Long
lfStdDev | As Double
IfCovariances (0 to 20) | As Double

End Type

RAWCALIBFUNC Function calibration description

Type RAWCALIBFUNC

nNumSegCals | As Long | Number of segment calibrations for this function
asSegCal (0 to 1) | As RAWCALIBCOEFFS | Modification calibration applied after segment calibration
bGotModification | As Long |
sModification | As RAWCALIBCOEFFS |

End Type

PKD_WAT_PARAMS Apex track peak detection parameters

Type PKD_WAT_PARAMS

fThreshold | As Single | Detection threshold
fWidth | As Single | Peak width
fUpThreshold | As Single | Baseline start percentage threshold
fDownThreshold | As Single | Baseline end threshold
nOperations | As Long | Operational flags

End Type

PKD_QTOF_PARAMS

Type PKD_QTOF_PARAMS

fRes | As Single | Resolution parameter
fLockMass | As Single | Lock (calibration) mass
fMassWindow | As Single | Lock (calibration) mass window
fMassRange | As Single | Acquisition mass range (TOF only)
fCycleTime | As Single | Scan time (TOF only)
sFuncCal | As RAWCALIBFUNC | QTOF function calibration
nPack1 | As Long | Structure packing variable – not used
lfLteff | As Double | QTOF mass/time calibration constants
lfVeff | As Double |
fNpMultiplier | As Single | Np Multiplier
lpsRefCalib | As Long | Returns reference calibration
lpsAppCalib | As Long | Apply this calibration instead of lock mass
nLocksprayAverage | As Long | No of scans to average first-order term over End Type
fTDCFrequency | As Single | TDC frequency in GHz
nPack2 | As Long | Structure packing variable – not used

End Type

MASS_MEASURE_PARAM Mass measure parameters

Type MASS_MEASURE_PARAM

nMassMeasMode | As Long |
nPkdHalfWidth | As Long | Peak detect half width
fPkdCentTop | As Single | Centroid top (%)
nPkdMethod | As Long | Top or centroid
bSmooth | As Long | True if smoothing required
fSmoothWidth | As Single | smoothing window width
nSmoothIterates | As Long | No of smooths
nSmoothMethod | As Long | SG or Mean
bSubtract | As Long | True if subtraction required
nSubPolyOrder | As Long | Subtract polynomial
fSubBelowCurve | As Single | Fraction below curve
bUseArrays | As Long | TRUE = float arrays FALSE = DM handles
bEnableQTOF | As Long | Enable QTOF mass correction features
nPack1 | As Long | Structure packing variable - not used
sPkdQTOFParams | As PKD_QTOF_PARAMS | QTOF Accurate Mass Params
bLockSpray | As Long | Lockspray data
bRealTime | As Long | Peak detect params will be based on the instrument resolution
bAutoTof | As Long | Use Automatic parameters i.e. resolution and np from extern.inf
bDeadTime | As Long | Do dead time correction
bLockMass | As Long | Do lock mass correction
bDoAdaptiveSubt | As Long | Do adaptive background subtract
nPack2 | As Integer | Structure packing variable - not used

End Type

TRACESTATS Collection of chromatogram and spectrum statistics

Type TRACESTATS

Num | As Integer
Min | As Single
Max | As Single
Ave | As Single
SD | As Single
NoiseMin | As Single
NoiseMax | As Single
NoiseAve | As Single
NoiseSD | As Single

End Type


ActivateML

Function ActivateML () As Integer

Routine to activate MassLynx. If not active, it is started. When active, focus is switched to it. Reruns the MassLynx window handle.


CBoxSelString

Function CBoxSelString (hWnd As Long, wID As Long, lpSelString As String) As Integer

Selects an item in a combo box. Returns True if successful.

hWnd | Window handle of the dialogue box
wID | Class ID of the combo box
lpSelString | String to search for


CheckMenuItem

Function CheckMenuItem (hWnd As Long, wID As Long, wCheck As Integer) As Integer

Checks or unchecks a menu item. Returns the checked state of the menu item.

hWnd |  | Window handle of the menu to be checked
wID |  | Specifies the menu item for which the state is checked
wCheck | True | Check the menu item
 | False | Uncheck the menu item


Conv4SK

Function Conv4SK (lpStringToCheck As String) As String

Returns a string converted into SendKeys format.

Lpstring

String to be converted


CpyBuffToStr

Sub CpyBuffToStr (lpStr As String, dwBuffStart As Long, dwBytes As Long)

Copy from memory to a string.

lpStr | Output, should be initialised to an empty string
dwBufferStart | Start address of record
dwBytes | Size of record


CpyStrToBuff

Sub CpyStrToBuff (lpStr As String, dwBuffStart As Long)

Copy from string to memory buffer. Buffer must be allocated and locked.

lpStr | Input string
dwBufferStart | Start address of record


CurrentSampleListEntry

Function CurrentSampleListEntry () As Integer

Returns the number of the current entry in the Sample List.


CurrentSPLFile

Function CurrentSPLFile () As String

Returns the full path and filename of the current Sample List file.


DataBrowserChroSpec

Function DataBrowserChroSpec (hBrowser As Long, nChroSpec As Integer) As Integer

Sets the Chromatogram and/or Spectrum check boxes in the Data Browser. Returns nChroSpec or GEN ERROR if there is an error.

hBrowser | Handle of the Data Browser dialogue box.
nChroSpec | 2 bit mask describing which boxes to check: SPEC_OPEN – Check the spectrum box CHRO_OPEN – Check the chromatogram box


DataBrowserShow

Function DataBrowserShow () As Long

Displays the MassLynx data browser dialogue box. Returns the window handle of the dialogue box, if it has been found.


DataFileExists

Function DataFileExists (sVGFile As VGFILE, nData As Integer, strDataStub As String, strDataExt As String) As Integer

Checks to see if a required function/process number actually exists. Returns the data file number or GEN_ERROR if the file does not exist.

sVGFile | VG file to check.
nData | Number of the required file.
StrDataStub | Prefix for the data file e.g. _PROC or _FUNC.
strDataExt | File extension for the required data file. e.g. DAT.


DataFunctionSelect

Function DataFunctionSelect (sVGRawFile As VGRAWFILE, hBrowser As Long) As Integer

Selects the function to open from the data browser. Returns the function number or GEN_ERROR if the file does not exist.

sVGRawFile | Holds the function that should be opened and the raw file to open if hBrowser is 0.
hBrowser | Handle of the Data Browser dialogue box. If it is zero then the function will use sVGRawFile as the raw file to be opened, otherwise it assumes the raw file has been set and Data Browser is already open.


DataProcessSelect

Function DataProcessSelect (sVGRawFile As VGRAWFILE, hBrowser As Long) As Integer

Selects the process to open from the data browser. Returns the process number or GEN_ERROR if the file does not exist.

sVGRawFile | Holds the function that should be opened and the raw file to open if hBrowser is 0.
hBrowser | Handle of the Data Browser dialogue box. If it is zero then the function will use sVGRawFile as the raw file to be opened, otherwise it assumes the raw file has been set and Data Browser is already open.


Delay

Sub Delay (wDelay As Integer)

Runs an idle loop.

wDelay

Number of seconds to delay.


DMCheckFunction

Function DMCheckFunction (wFunc As Integer, lpRawFile As VGRAWFILE) As Integer

Checks that the specified function is in the raw file, returns True if it is. The VGRAWFILE structure is assumed to be already populated.

wFunc | Function number
lpRawFile | VGRAWFILE to be checked


DMCheckRT

Function DMCheckRT(wFunc As Integer, fTime As Single, lpRawFile As VGRAWFILE) As Long

Checks that the specified retention time is in the required function of the raw file. Return value is the corresponding scan number. The VGRAWFILE structure is assumed to be already populated.

wFunc | Function number
fTime | Retention time
lpRawFile | VGRAWFILE to be checked


DMCheckScan

Function DMCheckScan (wFunc As Integer, dwScan As Long, lpRawFile As VGRAWFILE) As Long

Checks that the specified scan is in the required function of the raw file. Return value is the scan number if successful. The VGRAWFILE structure is assumed to be already populated.

wFunc | Function number
dwScan | Scan number
lpRawFile | VGRAWFILE to be checked


DMVerifyFunction

Function DMVerifyFunction (lpFile As String, wFunc As Integer, lpRawFile As VGRAWFILE) As Integer

Checks that the specified function is in the raw file, returns True if it is. The VGRAWFILE structure is populated with the most recent values and the supplied file name.

lpFile | File name to be checked, must be in current project
wFunc | Function number
lpRawFile | VGRAWFILE to be populated


DMVerifyRT

Function DMVerifyRT (lpFile As String, wFunc As Integer, fTime As Single, lpRawFile As VGRAWFILE) As Long

Checks that the specified retention time is in the required function of the raw file. Return value is the corresponding scan number. The VGRAWFILE structure is populated with the most recent values and the supplied file name.

lpFile | File name to be checked, must be in current project
wFunc | Function number
fTime | Retention time
lpRawFile | VGRAWFILE to be populated


DMVerifyScan

Function DMVerifyScan (lpFile As String, wFunc As Integer, dwScan As Long, lpRawFile As VGRAWFILE) As Long

Checks that the specified scan is in the required function of the raw file. Return value is the scan number if successful. The VGRAWFILE structure is populated with the most recent values and the supplied file name.

lpFile | File name to be checked, must be in current project
wFunc | Function number
dwScan | Scan number
lpRawFile | VGRAWFILE to be populated


FileToRawFile

Function FileToRawFile (lpFile As String, wFunc As Integer, lpRawFile As VGRAWFILE) As Integer

Fills a VGRAWFILE file structure. Returns True if successful.

lpFile | File name to be checked, must be in current project
wFunc | Valid function number for file
lpRawFile | VGRAWFILE to be populated


FirstSampleListEntry

Function FirstSampleListEntry () As Integer

Returns the number of the first entry in the Sample List.


GetMLFile

Function GetMLFile (lpFileType As String) As String

Returns the whole file descriptor for a MassLynx global file, i.e. path, name and extension.

lpFileType

File type i.e. RAW


GetMLFileDir

Function GetMLFileDir (FileType As String) As String

Returns the current directory that MassLynx is using for the specified file type.

lpFileType

File type i.e. RAW


GetMLFileEntry

Function GetMLFileEntry (FileType As String) As Long

Returns the current entry number that MassLynx is using for the specified file type.

lpFileType

File type i.e. RAW


GetMLFileExt

Function GetMLFileExt (FileType As String) As String

Returns the current extension that MassLynx is using for the specified file type.

lpFileType

File type i.e. RAW


GetMLFileInfo

Function GetMLFileInfo (FileType As String, MLFileInfo As VGFILE) As Integer

Gets MassLynx file information into VGFILE type. Returns True if successful.

lpFileType | File type i.e. RAW
MLFileInfo | VGFILE to be populated


GetMLFileName

Function GetMLFileName (FileType As String) As String

Returns the current file name that MassLynx is using for the specified file type.

FileType

File type i.e RAW


GetMLFileSize

Function GetMLFileSize (lpFileType As String) As Long

Returns the number of entries in the file that MassLynx is using for the specified file type.

FileType

File type i.e RAW


GetMLIniFileInfo

Function GetMLIniFileInfo (lpSection As String, lpEntry As String, lpFileInfo As VGFILE, lpMLIniFile As String) As Integer

Populates a VGFILE structure from entries held in an .INI file. Returns True if successful.

lpSection | .INI file section
lpEntry | .INI file entry
lpFileInfo | VGFILE to be populated
lpMLIniFile | .INI file name, usually MassLynx


GetRawProcessFiles

Function GetRawProcessFiles (lpRawFile As String, lpProcessFile() As String * 16, lpProcStub As String, lpProcExt As String) As Integer

Get the current process files for the specified MassLynx raw file. Returns the number of files found.

lpRawFile | Raw file to obtain processes for (must include directory but not extension)
lpProcessFile | Array of returned file names
lpProcStub | Prefix for the data file e.g. _PROC or _FUNC.
lpProcExt | File extension for the required data file. e.g. DAT.


HiWord

Function HiWord (dwLong As Long) As Integer

Returns the value of the high order word of a long integer.

dwLong

Integer to obtain high order word from


LastRawProcess

Function LastRawProcess (lpRawFile As String) As Integer

Returns the number of the last process file that was generated for the specified raw file, or zero if there are no processes.

lpRawFile

Raw file to obtain the process number for (must include directory but not extension)


LastSampleListEntry

Function LastSampleListEntry () As Integer

Returns the number of the last entry in the Sample List.


LBoxSelString

Function LBoxSelString (hWnd As Long, wID As Long, lpSelString As String) As Integer

Selects an item in a list box. Returns True if successful.

hWnd | Window handle of the dialogue box
wID | Class ID of the list box
lpSelString | String to search for


LoWord

Function LoWord (dwLong As Long) As Integer

Returns the value of the low order word of a long integer.

dwLong

Integer to obtain low order word from


MakeLong

Function MakeLong (wHiWord As Integer, wLoWord As Integer) As Long

Returns a long integer made by combining two integers.

wHiWord | Integer to obtain low order word from
wLoWord | Integer to obtain low order word from


MassLynxhWnd

Function MassLynxhWnd () As Long

Returns the window handle for MassLynx.


mbFile

Sub mbFile ()

Displays the File menu bar for the current application.

Note: this function uses SendKeys and will only work if Alt %F is valid


mbFileExit

Sub mbFileExit ()

Exit the current application.

Note: this function uses SendKeys. No file checking is carried out. mbFile and "X" must be valid for the application.


mbFileNew

Sub mbFileNew ()

Create a new file for the current application.

Note: this function uses SendKeys. No file checking is carried out. mbFile and "N" must be valid for the application.


mbFileOpen

Sub mbFileOpen (lpFileToOpen As String)

Opens an existing file for the current application.

lpFileToOpen

The file to be opened

Note: this function uses SendKeys. No file checking is carried out. mbFile and "O" must be valid for the application.


MLAppActive

Function MLAppActive(nMLApp As Integer) As Long

Returns the window handle of a MassLynx application.

nMLApp

The class ID of the MassLynx application


MLCustSysGlobals

Sub MLCustSysGlobals (bScan As Boolean, bUseAcquFile As Boolean, nAxis As Integer)

Set the global default display type, file access and axis labelling in the MassLynx options.

bScan | True | Use scan numbers to get scans in Spectrum.
 | False | Use retention times to get scans in Spectrum.
bUseAcquFile | True | Use the current acquired data file as default with Process Spectrum/Chromatogram.
 | False | Use the last used data file as default with Process Spectrum/Chromatogram.
nAxis | AXIS_D | Display Spectrum mass scale as Daltons/Fundamental Charge.
 | AXIS_M | Display Spectrum as Mass/Charge.
 | AXIS_U | Display Spectrum as the un-SI unit/Fundamental Charge

Note: This function uses SendKeys.


MLFilesList

Function MLFilesList (strFileType As String, astrMLFile() As String) As Integer

Gets a list of current MassLynx files, of the required type. Returns the number of files found.

StrFileType | Type of MassLynx file required e.g. TUNE_DB. (see MassLynx.ini for possible file types)
astrMLFile() | Array that will hold the list of files.


MLRawFileOpen

Sub MLRawFileOpen (lpRawFile As String, wProcesses As Integer)

Open a MassLynx raw data file. If MassLynx is not running then it is invoked.

lpRawFile | Name of file to be opened
wProcesses | 2 bit mask describing which process to start: SPEC_OPEN – Opens the spectrum window CHRO_OPEN – Opens the chromatogram window


ProcDialog_OK

Sub ProcDialog_OK (hParent As Long, nID As Long, strDlgCaption As String, strProcDlg As String)

Call up a dialogue box and then OK it, sometimes to activate a process.

HParent | Handle of the window that the dialogue box will be generated from.
nID | Command ID of the menu or tool bar item that will call up the dialogue box.
strDlgCaption | Caption of the dialogue box that will be activated when nID is sent to hParent.
strProcDlg | Caption of the processing type dialogue box. (This can be a Chr$(0) if no processing box is displayed)


ProDirPath

Function ProDirPath () As String

Returns the directory path of the current ".PRO" project directory.


SendMessageText

Function SendMessageText (hWnd As Long, lpMsg As String) As Long

Sends a text message to the relevant window handle. Returns True if successful.

hWnd | Handle of window that receives message
lpMsg | Message text


SetGlobalFileML

Function SetGlobalFileML (lpFileType As String, lpFileName As String) As Integer

Sets the default MassLynx file, for the given file type. The file is first assumed to exist in the current directory with the current extension. Therefore only the name is required. If the file does not exist in default form lpFileName is assumed to be the complete path descriptor for the file, i.e. directory and extension must be included. Returns True if successful.

lpFileType | MassLynx file type i.e. RAW
lpFileName | MassLynx file name


Spare1SampleListEntry

Function Spare1SampleListEntry () As String

Returns the current value of the entry "Spare1" in the Sample List.


Spare2SampleListEntry

Function Spare2SampleListEntry () As String

Returns the current value of the entry "Spare2" in the Sample List.


SPLFileName

Function SPLFileName () As String

Returns the filename of the current ".SPL" Sample List file.


SqrBrRem

Function SqrBrRem (StringToStrip As String) As String

Removes square brackets from around a string if they exist. Useful for dealing with entries from the sample list. Returns the processed string.

StringToStrip

String to remove square brackets from

Note: This function only checks to see if the first character is "[", if it is the last character is automatically assumed to be "]".


StopProcess

Function StopProcess (lpProcess As String) As Integer

Closes down the process with the specified window caption. Returns True if the process was active.

lpProcess

The caption of the process to stop


Str2Sng

Function Str2Sng (NumStr As String) As Single

Converts a string to single, returns the value of the single.

NumStr

The string to convert


StrToArray

Function StrToArray (lpString As String, lpArray() As String * 1) As Long

Converts a string to an array of characters. Returns the number of characters in the array.

lpString | The string to convert
lpArray | Array to hold the string's characters


TextInCB

Function TextInCB (hDlg As Long, wCBID As Integer, lpText As String) As Integer

Check to see if the text lpText is in any one of the entries of the specified combo box. Returns the first index containing lpText or -1 if lpText is not found. The text search is not case sensitive.

hDlg | The handle of the dialogue containing the combo box.
wCBID | The class ID of the combo box
lpText | The text to search for


TextInLB

Function TextInLB (hDlg As Long, wLBID As Integer, lpText As String)

Check to see if the text lpText is in any one of the entries of the specified list box. Returns the first index containing lpText or -1 if lpText is not found. The text search is not case sensitive.

hDlg | The handle of the dialogue containing the combo box.
wCBID | The class ID of the combo box
lpText | The text to search for


VGRawFileOpen

Function VGRawFileOpen (sVGRawFile As VGRAWFILE, nChroSpec As Integer) As Integer

Opens the required file, function and/or process. Compare with Sub MLRawFileOpen. Returns True if successful.

sVGRawFile | VG raw file to open.
nChroSpec | 2 bit mask describing whether to open the spectrum or chromatogram windows: SPEC_OPEN – Open the spectrum window CHRO_OPEN – Open the chromatogram window

Note: sVGRawFile.wFunc or sVGRawFile.wProc must be set and valid.


WaitForMLApp

Function WaitForMLApp (wMLApp As Integer, wTimeout As Integer) As Integer

Waits for a MassLynx application to start.

If the application is not started within the timeout period, then 0 is returned. If the application is active its window handle is returned.

wMLApp | MassLynx application code
wTimeout | The time (in seconds) to wait for the application to start


WaitForMLPrint

Sub WaitForMLPrint ()

Waits for MassLynx to finish printing.


WaitForProcessEnd

Sub WaitForProcessEnd (WindowCaption As String)

Waits for the process window with the specified caption to disappear.

WindowCaption

Caption of the window to wait for


WaitForProcessStart

Function WaitForProcessStart (Process As String, Timeout As Integer) As Long

Looks for the window with the specified caption. If the window has not been found within the timeout period then the function returns false. If the window is found, the return value is the window handle.

Process

Caption on the window to search for

Timeout

The time (in seconds) to wait for the window to appear


WaitForWindowClose

Sub WaitForWindowClose (hWnd As Long)

Waits for the process window with the specified handle to disappear.

hWnd

Handle of the window to wait for


Quan.BAS

This module contains useful tools for interfacing to the MassLynx quantification functions.

  • Data Type Declarations

  • FieldIndexList

  • QRTransFieldRange

  • QRTransFieldVal

  • QuanClose

  • QuanCurveCoefs

  • QuanCurveDBCurrent

  • QuanMethodDBCurrent

  • QuanMethodInternalStandard

  • QuanMethodQuanTrace

  • QuanReport

  • QuanReportCombineFields

  • QuanReportConcatFields

  • QuanReportParsRead

  • QuanReportTables

  • QuanReportTst

  • QuanTrans

  • ReportConcatCopy

  • ReportTableTidy

  • RTimeSex

  • Z_CompoundMoveTo

  • Z_ConcatItem

  • Z_CurveCoefsExtract

  • Z_DateFields

  • Z_HexStrMake

  • Z_IDExtract

  • Z_ReportPrefix

  • Z_TestFieldDate


MassLynx Macro Programming Manual - Quan.BAS - Data Type Declarations

Data Type Declarations

QuanReport

Type QuanReport

bTimeSex | As Integer | Switches between Sexagesimal and Decimal time formats.
strTimeFields | As String | Fields that will be formatted using bTimeSex setting.
strIniFile | As String |
strDateFormat | As String |
strDateFields | As String |

End Type

ConcatFields

Type ConcatFields

nNumFields | As Integer | The number of fields that are concatenated.
strFieldNums | As String | The list of field numbers in hexadecimal string format that need to be concatenated. The number of characters per integer is set by the constant QCF_NUM_CHARS. Field information is separated by an '&' character. The format for integers is &Hnnnn, if a field is a literal string such as 'n/a' it would be '&n/a'. The 'H' signifies a field number, so a 'H' cannot be used as the 1st character of a literal string. The base field must be the first item.
nNewPos | As Integer | Is the field number for the newly created concatenated field.

End Type

QRTrans

Type QRTrans

strField | As String | Field name where the translation applies.
strSrcValue | As String | The value of the field before translation.
strDstValue | As String | The value of the field after translation.
nStart | As Integer | If this QRTrans is in an array then nStart and nEnd are positions of the 1st and last values for the translation of strField.
nEnd | As Integer |

End Type


FieldIndexList

Function FieldIndexList (astrHeader() As String, astrField() As String) As String

Produces a sting of hexadecimal numbers that contains the indices of required fields.

astrHeader() | Array that will hold the table headers.
astrFields() | List of fields being sought.
Returns | A string containing the fields. See the Type ConcatFields for a description of how the fields are put together. The field order in astrtFields() determines the order of the hex numbers.


QRTransFieldRange

Function QRTransFieldRange (asQRTrans() As QRTrans, strField As String) As Integer

Checks an array of QRTrans to see if a field needs translating.

asQRTrans | An array that needs to be searched
strField | The field name being sought
Returns | The start position of the required fields translations, or GEN_ERROR if not found


QRTransFieldVal

Function QRTransFieldVal (asQRTrans() As QRTrans, strFieldVal As String, nTransField As Integer) As Integer

Checks an array of QRTrans to see if a field needs translating.

asQRTrans | An array that holds the translation information
strFieldVal | The value of the required position
nTransField | The position in the array of the start of the required fields translation block
Returns | The start position of the required fields translations, or GEN_ERROR if not found

Quan

Function Quan () As Integer

Start MassLynx quantify.

Returns

Quantify window handle.


QuanClose

Sub QuanClose ()

Close MassLynx quantify.

Returns

Void.


QuanCurveCoefs

Function QuanCurveCoefs (strCurveDB As String, strCompound As String, nCurve As Integer, afCoefs() As Single) As Integer

Gets the current quantitation curve coefficients for the required curve.

strCurveDB | Full path name for the required curve database.
strCompound | Name of the compound that the curve co-efficients will be retrieved for.
nCurve | Curve number that will be retrieved
afCoefs | Array of curve coefficients, that will be sized and filled. The index of the array corresponds to the power of the coefficient. e.g. afCoef(3) is the coefficient for X^3
Returns | The number of coefficients.


QuanCurveDBCurrent

Function QuanCurveDBCurrent () As String

Gets the current quantitation curve database name in full

Returns

Currently used MassLynx curve database or Chr$(0).


QuanMethodDBCurrent

Function QuanMethodDBCurrent () As String

Gets the current quantitation method database name in full

Returns

Currently used MassLynx method or Chr$(0).


QuanMethodInternalStandard

Function QuanMethodInternalStandard (strMethodDB As String, strCompound As String, nCompound As Integer) As String

Gets the current quantitation internal standard name for the required compound.

strMethodDB | Full path name for the required method database.
strCompound | The name of the compound for which the curve co-efficients will be retrieved.
nCompound | The compound number that will be retrieved, if strCompoundhas not been found or strCompound=Chrs(0).
Returns | The internal standard compound or Chr$(0) if one is not found/used.


QuanMethodQuanTrace

Function QuanMethodQuanTrace (strMethodDB As String, strCompound As String, nCompound As Integer) As String

Gets the current quantitation chromatogram trace for the required compound.

strMethodDB | Full path name for the required method database.
strCompound | Name of the compound for which the curve co-efficients will be retrieved.
nCompound | Compound number that will be retrieved, if strCompound has not been found or strCompound=Chrs(0).
Returns | The chromatogram trace or Chr$(0) if one is not found/used.


QuanReport

Function QuanReport (nType As Long, astrReport() As String) As Integer

Gets the MassLynx Quantify report summary.

nType | Type of report by compound (MRC_BYCOMPOUND) or by sample (MRC_BYSAMPLE).
astrReport() | VB string array, that has been dimensioned/sized. The line number range of the report that will be copied into the array is determined by the LBound and UBound values of astrReport().
Returns | The number of lines of the report copied to astrReport().

Hint: To get whole report into array make astrReport() as large as possible, with LBound=0, because the array will be re-dimensioned.


QuanReportCombineFields

Function QuanReportCombineFields (sQuanReport As QuanReport, astrFields() As String) As Integer

Reads the INI file to see which fields need to be combined.

sQuanreport | QuanReport data type that holds parameters.
astrFields() | Holds the combined fields.
Returns | The number of resultant combined fields.


QuanReportConcatFields

Function QuanReportConcatFields (astrHeader() As String, sQuanReport As QuanReport, asConcatFields() As ConcatFields) As Integer

Combines quantitation report table fields.

astrHeader() | The array that will hold the table headers. It is supplied filled and will be modified.
sQuanReport | Holds any required parameter information.
asConcatFields() | Will be filled with concatenated field information.
Returns | The number of fields made of concatenated fields


QuanReportParsRead

Sub QuanReportParsRead (sQuanReport As QuanReport)

Reads the QuanReport parameters from the application INI file.

sQuanReport | Parameters that will be filled.
strIniFile | INI type file that holds the parameters.
Returns | Void


QuanReportTables

Function QuanReportTables (nType As Long, astrID() As String, astrHeader() As String,astrTable() As String, sQuanReport As QuanReport) As Integer

Gets the MassLynx Quantify report summary and splits it up into useful string arrays. The contents of the arrays depend on the type of report required.

Ntype | Type of information required by compound (MRC_BYCOMPOUND) or by sample (MRC_BYSAMPLE).
astrID() | Array that holds all the identification of a table. This be a list of compounds (MRC_BYCOMMANDS) or a list of samples (MRC_BYSAMPLE).
astrHeader() | Array that will hold the table headers.
astrTables() | 3-D array that will hold all tables information. Where in astrTables(m, n, p) m is the table number, n is the row number in the table and p is the field required, the field name is the pth element in astrHeader().
Returns | The number of items in astrID().


QuanReportTst

Sub QuanReportTst()

Test driver for Quan.

Parameters | None
Returns | Void


QuanTrans

Function QuanTrans (bInput As Integer, asQRTrans() As QRTrans) As Integer

Translation between field types.

bInput | Used to set for input translation or output translation.
Returns | Number of fields for translation.


ReportConcatCopy

Private Function ReportConcatCopy(asConcatFields() As ConcatFields, astrTable() As String) As Integer

Copies fields that need concatenating.

asConcatFields() | The list of fields that need concatenating
astrTables() | a 3-D array that will hold all tables information. Where in astrTables(m, n, p) m is the table number, n is the row number in the table and p is the field required
Returns | Number of concatenated fields


ReportTableTidy

Function ReportTableTidy (astrHeader() As String, astrTable() As String, asConcatFields() As ConcatFields) As Integer

Removes any fields that are used in concatenated fields and are not base fields.

astrHeader() | Array that will hold the table headers
astrTables() | 3-D array that will hold all tables information. Where in astrTables(m, n, p) m is the table number, n is the row number in the table and p is the field required, the field name is the pth element in astrHeader()
asConcatFields() | Will be filled with concatenated field information
Returns . | The new number fields


RTimeSex

Function RTimeSex (fTime As Single) As String

Converts a decimal retention time to a sexagesimal

fTime | Decimal retention time.
Returns | Sexagesimal time.


Z_CompoundMoveTo

Private Function Z_CompoundMoveTo(tbl As Table, strCompound As String, nCompound As Integer, strField As String) As Integer

Moves to the record that has a field that contains the required compound name. If the compound is not found then the current record is set to the supplied number.

tbl | The database that will be searched
strCompound | The name of the compound that is to be sought
nCompound | The compound number that will be retrieved, if strCompound has not been found or strCompound=Chrs(0)
Returns | The record position of the compound or Zero if not found


Z_ConcatItem

Function Z_ConcatItem (strConcat As String, nIndex As Integer) As String

Gets the nth item from the supplied string with format; &jjjj&jj&nmhfh&H0034, where & separates items.

strConcat | The whole concatenated string.
nIndex | Required item number, starting at 1.
Returns | The string for the including & symbol.


Z_CurveCoefsExtract

Private Function Z_CurveCoefsExtract(afCoefs() As Single, strCoefs As String) As Integer

Gets the current quantitation curve coefficients for the required curve.

strCoefs | The string that holds all the coeffiecients
afCoefs | An array of curve coefficients, that will be sized and filled. The index of the array corresponds to the power of the coefficient. e.g. afCoef(3) is the coefficient for X^3.
Returns | The number of coefficients


Z_DateFields

Function Z_DateFields (astrDateFields() As String, sQuanReport As QuanReport) As Integer

Produces a list of fields that are date type fields for the report.

astrDateFields() | Array that will hold the date field names.
sQuanReport | Holds any required parameter information.
Returns | The number of date fields.


Z_HexStrMake

Private Function Z_HexStrMake(lLong As Long, nNumSize As Integer) As String

Makes a fixed sized string representing a hexadecimal number.

lLong | The number to convert
nNumSize | The minimum size of the number required. If the number converted is smaller in character length then there is padding with zeros.
Returns | The hexadecimal number with pre-padding of zeros


Z_IDExtract

Private Function Z_IDExtract(nType As Integer, nID As Integer, strIDLine As String) As String

Extracts the ID from the ID line of Quan summary report.

nType | The type of information required by compound (MRC_BYCOMPOUND) or by sample (MRC_BYSAMPLE)
nID | The number of the required identifier
strIDLine | The line of text that holds the required ID
Returns | The required ID or Chr$(0) if nothing was found


Z_ReportPrefix

Private Function Z_ReportPrefix(nType As Integer, nID As Integer) As String

Returns the string to search for in the summary report to test to see if the summary report is a table identification start line.

nType | The type of information required by compound (MRC_BYCOMPOUND) or by sample (MRC_BYSAMPLE)
nID | The number of the required identifier
Returns | The required prefix


Z_TestFieldDate

Function Z_TestFieldDate (astrDateField() As String, strField As String) As Integer

Produces a list of fields that are date type fields for the report.

astrDateFields | The array that will hold the date field names
strField | The name of the field to test
Returns | TRUE if it is a date field.


Report.BAS

The functions in report.bas provide a simple report generation and printing system. Reports can contain mixtures of graphical and alphanumeric information.

The general format of the report is described below:

________________________

Header Lines
...
________________________
Blank Line
________________________
Graph (Optional)
________________________
Column Headers
________________________
Table
...
________________________
Blank Line
________________________
Page number
________________________

  • Data type declarations

  • ColStyleFormat

  • FieldOffSet

  • FooterPrint

  • GraphAnnotate

  • GraphBaselineDraw

  • GraphDraw

  • GraphReportPrint

  • GraphScaleDraw

  • GraphScaleSet

  • PagesCount

  • ReportHeaderPrint

  • ReportPrint

  • ReportPrintGraph

  • SetPaperOrientation

  • SummaryBlockPrint

  • SummaryReportHeaderPrint

  • SummaryReportPrint

  • SummaryTableHeaderPrint

  • TableBlockPrint

  • TableColMaxWidth

  • Sub TableHeaderPrint ()


MassLynx Macro Programming Manual - Report.BAS - Data type declarations

Data type declarations

ColStyle Describes the layout of a column

Type ColStyle

strName | As String | Column header for table
fWidth | As Single | Column width or COL_WIDTH_XXX
fLInset | As Single | Gap on left of column, adds space between columns
fRInset | As Single | Gap on right of column, adds space between columns
nAlign | As Integer | COL_ALIGN_XXX

End Type

Graph Describes the graph that is going to be used on the first page of the report

Type Graph

fXOrig | As Single | X-axis origin value.
fYOrig | As Single | Y-axis origin value.
fXLim | As Single | X-axis value at axis end.
fYLim | As Single | Y-axis value at axis end.
nHeight | As Integer | Height of graph, as lines of text.
bCon | As Integer | True if the graph is continuum type graph.

End Type

Gpoint Defines a point on a graph

Type GPoint

fX | As Single | X position
fY | As Single | Y position

End Type

PageScale Describes information about the page sizing

Type PageScale

fLeft | As Single | Defines the left edge of the page
fTop | As Single | Defines the top edge of the page
fWidth | As Single | Defines the width of the page
fHeight | As Single | Defines the height of the page

End Type

AnnoPoint Use to position an annotation for the graph

Type AnnoPoint

fX | As Single | X position of annotation
fY | As Single | Y position of annotation
strAnno | As String | The piece of annotation required at fX, fY

End Type


ColStyleFormat

Private Sub ColStyleFormat(asColStyle() As ColStyle, astrTableField() As String)

asColStyle | An array that describes how each column should be laid out
astrTableField | a 2-D array of the fields that should be printed
Returns | Void


FieldOffSet

Private Function FieldOffSet(sColStyle As ColStyle, strField As String) As Single

Sets the position of the text that will be printed in a field, within that field.

sColStyle | Describes how the field should be displayed
strField | The text that will be printed in the field
Returns | The offset from the edge of the field where printing is to start


FooterPrint

Private Sub FooterPrint()

Prints the footer at the bottom of the page.

Parameters | None
Returns | None


GraphAnnotate

Sub GraphAnnotate (sGraph As Graph, asGPoint() As GPoint, asAnno() As AnnoPoint)

Annotate the selected peaks.

sGraph | Describes how the graph is going to be put onto the page.
asGPoint() | Array of X-Y co-ordinates.
asAnno() | Array of points to annotate.
Returns | Void.


GraphBaselineDraw

Sub GraphBaselineDraw(asPKDFullPeak() As PKD_FULL_PEAK, asChroPt() As CHROMATOGRAM, sVGRawFile As VGRAWFILE, fAlignTime As Single)

Draws the graph on the page.

asPKDFullPeak() | Describes peaks
asChroPt() | Chro trace
sVGRawFile | Rawfile desc
Returns | Void


GraphDraw

Sub GraphDraw (sGraph As Graph, asGPoint() As GPoint, asAnno() As AnnoPoint)

Draws the graph on the page.

sGraph | Describes how the graph is going to be put onto the page.
asGPoint() | Array of X-Y co-ordinates.
asAnno() | Array of points to annotate.
Returns | Void.


GraphReportPrint

Function GraphReportPrint (sGraph As Graph, asGPoint() As GPoint, asAnno() As AnnoPoint, astrHeader() As String, asColStyle() As ColStyle, astrTableField() As String) As Integer

Main call to print out a report with a graph on the first page.

sGraph | Describes how the graph is going to be put onto the page.
asGPoint() | Array of point that will be used for plotting.
asAnno() | Array of points to annotate.
astrHeader() | Array of lines for the report header.
asColStyle() | Array that describes how each column should be laid out.
AstrTableField (column, row) | is a 2-D array of the fields that should be printed.
Returns | True if successful.


GraphScaleDraw

Sub GraphScaleDraw (sGraph As Graph)

Draws the Scale on the page for drawing a graph.

sGraph | Describes how the graph is going to be put onto the page.
Returns | Void.


GraphScaleSet

Function GraphScaleSet (sGraph As Graph, sOrigPageScale As PageScale, astrHeader() As String) As Single

Sets the Scale on the page for drawing a graph.

sGraph | Describes how the graph is going to be put onto the page.
sOrigPageScale | Original page scale that will be saved.
astrHeader() | Array of lines for the report header.
Returns | Total number of lines on a page.


PagesCount

Private Function PagesCount() As Integer

Calculates the number of pages to generate the report and also sets the number of rows per page.

Parameters | None
Returns | Void


ReportHeaderPrint

Private Sub ReportHeaderPrint(astrHeader() As String)

Prints a header on to a page.

astrHeader() | An array of lines for the report header
Returns | Void


ReportPrint

Function ReportPrint (astrHeader() As String, asColStyle() As ColStyle, astrTableField() As String) As Integer

Main call to print out a simple report.

astrHeader() | Array of lines for the report header.
asColStyle() | Array that describes how each column should be laid out.
AstrTableField(column, row) | 2-D array of the fields that should be printed.
Returns | True if successful.


ReportPrintGraph

Function ReportPrintGraph(asPKDFullPeak() As PKD_FULL_PEAK, asChroPt() As CHROMATOGRAM, sVGRawFile As VGRAWFILE, sGraph As Graph, asGPoint() As GPoint, asAnno() As AnnoPoint, astrHeader() As String, asColStyle() As ColStyle, astrTableField() As String, fAlignTime As Single) As Integer

Main call to print out a simple report with graph.

astrHeader() | An array of lines for the report header
asColStyle() | An array that describes how each column should be laid out
astrTableField(column, row) | a 2-D array of the fields that should be printed
Returns | TRUE if successful


SetPaperOrientation

Sub SetPaperOrientation(nOrientation As Integer)


SummaryBlockPrint

Private Function SummaryBlockPrint(nLineCount As Integer, astrTableField() As String) As Integer

Prints a block from the main table.

nTableBlockStart | The index to start printing from
astrTableField(column, row) | A 2-D array of the fields that should be printed
Returns | Last row index printed


SummaryReportHeaderPrint

Sub SummaryReportHeaderPrint(nLineCount As Integer, astrHeader() As String)

Prints a header on to a page.

astrHeader() | An array of lines for the report header
Returns | Void


SummaryReportPrint

Function SummaryReportPrint(bSetCols As Integer, nLineCount As Integer, astrHeader() As String, asColStyle() As ColStyle, astrTableField() As String) As Integer

Main call to print out a summary report

astrHeader() | An array of lines for the report header
asColStyle() | An array that describes how each column should be laid out
astrTableField(column, row) | A 2-D array of the fields that should be printed
Returns | TRUE if successful


SummaryTableHeaderPrint

Private Sub SummaryTableHeaderPrint(nLineCount As Integer)

Prints a table header on to a page.

Parameters | Line number to start printing
Returns | Void


TableBlockPrint

Private Function TableBlockPrint(nTableBlockStart As Integer, astrTableField() As String) As Integer

Prints a block from the main table.

nTableBlockStart | The index to start printing from
astrTableField(column, row) | a 2-D array of the fields that should be printed
Returns | Last row index printed


TableColMaxWidth

Private Function TableColMaxWidth(nCol As Integer, astrTableField() As String) As Single

Gets the maximum width of text for a particular column in the table.

nCol | The column to check in the table
Returns | The maximum width of the text


Sub TableHeaderPrint ()

Prints a table header on to a page.

Parameters | None
Returns | Void


Spec.BAS

This module contains useful tools for interfacing to the MassLynx spectrum functions.

  • Data type declarations

  • SpecAnnotate

  • SpecAnnoThresh

  • SpecArray

  • SpecArrayFull

  • SpecArrayMaxInt

  • SpecCaption

  • SpecCentroid

  • SpecClose

  • SpecComponentEdit

  • SpecCopyToClip

  • SpecDataGet

  • SpecDefault

  • SpecDisplay

  • SpecDisplayDefault

  • SpecDisplayFrom

  • SpecDisplayRange

  • SpecDisplayTo

  • SpecExit

  • SpecFileOpen

  • SpecGraphs

  • SpechActive

  • SpecHiMassIndex

  • SpechMDI

  • SpechTool

  • SpechWnd

  • SpecLib

  • SPECLIST

  • SpecListBP

  • SpecListField

  • SpecListSpectrum

  • SpecLoMassIndex

  • SpecMassPlaces

  • SpecMaxEntES

  • SpecMenuPrint

  • SpecMoveFirst

  • SpecMoveLast

  • SpecNewTrace

  • SpecPrint

  • SpecPrintMenu

  • SpecReadData

  • SpecReadProcess

  • SpecReadSpectrum

  • SpecRefine

  • SpecRemove

  • SpecReport

  • SpecSave

  • SpecScan

  • SpecSmooth

  • SpecSpectrumSort

  • SpecStats

  • SpecSubtract

  • SPECT

  • SpecText

  • SpecThreshold

  • SpecToClip

  • SpecTransform


MassLynx Macro Programming Manual - Spec.BAS - Data type declarations

Data type declarations

SPECLIST Single spectrum data point

Type SPECLIST

Mass | As Single | Mass
Intensity | As Single | Intensity

End Type

SpecStats Spectrum statistics

Type SpecStats

Num | As Integer | Number of entries
Min | As Single | Minimum intensity
Max | As Single | Maximum intensity
Ave | As Single | Average intensity
SD | As Single | Intensity SD
NoiseMin | As Single | Minimum noise intensity
NoiseMax | As Single | Maximum noise intensity
NoiseAve | As Single | Average noise intensity
NoiseSD | As Single | Noise intensity SD

End Type

SPEC_STATS Spectrum integration parameters

Type SPEC_STATS

fNoiseLevel

As Single

Peak-to-peak amplitude

End Type


SpecAnnotate

Function SpecAnnotate () As Integer

Displays the spectrum annotation dialogue box. Returns the window handle.


SpecAnnoThresh

Sub SpecAnnoThresh (bPercent As Integer, fThreshold As Single)

Sets the thresholding in the peak annotation box as specified by the input parameters.

bPercent | True | Set percentage threshold
 | False | Set absolute threshold
fThreshold |  | Thresholding level (% or Abs depending on bPercent)


SpecArray

Function SpecArray(SPECTRUM() As SPECLIST) As Integer

Fills a SpecList type array with masses and intensities from the currently displayed spectrum. Returns the number of entries written to the array.

SPECTRUM

Array of mass intensity pairs


SpecArrayFull

Function SpecArrayFull (lpRawFile As VGRAWFILE, dwScan As Long, lpSpectrum() As SPECLIST) As Long

Fills a SpecList type array with masses and intensities from the specified raw file spectrum. Returns the number of entries written to the array.

lpRawFile | Filename and function number information for processing
lpSpectrum | Array of individual mass/intensity pairs


SpecArrayMaxInt

Function SpecArrayMaxInt (List() As SPECLIST, MaxInt As SPECLIST) As Integer

Finds the maximum intensity peak in a SpecList array. Returns the entry number of the maximum intensity peak.

List | List of mass/intensity pairs for the spectrum
MaxInt | Information about the maximum intensity in the spectrum


SpecCaption

Function SpecCaption (wFull As Integer) As String

Returns the current caption for the Spectrum window.

wFull | True | Returns process name and current raw file
 | False | Returns process name only (i.e. "Spectrum")


SpecCentroid

S SpecCentroid

ub SpecCentroid (bCreate As Long)

Performs a centroid function on the currently active spectrum using parameters already in the dialogue box.

bCreate | ADD | Adds the new trace to the current window
 | REPLACE | Replaces the currently active trace
 | NEW_WINDOW | Generates a new window for the new trace

The bCreate setting is the same as checking the boxes in the Spectrum Center window. It is advisable to reset the mode when you have finished.


SpecClose

Sub SpecClose ()

Closes the Spectrum Window.


SpecComponentEdit

Sub SpecComponentEdit (lpMass() As Single)

Process to edit the transform component table.

lpMass

List of masses to place into the component table


SpecCopyToClip

Sub SpecCopyToClip ()

Copies a bitmap of the current spectrum to the clipboard.


SpecDataGet

Function SpecDataGet (sVGRawFile As VGRAWFILE, lScan As Long, asPeak() As SPECLIST, sDmRawStats As DMRAWSTATS) As Long

Reads in a whole scans worth of data to a SPECLIST structure. Returns the number of mass-intensity pairs in the scan.

sVGRawFile | Holds the file, function and process to access. If sVGRawFile.wProc > 0 then the process is accessed instead of the scan associated with sVGRawFile.wFunc
lScan | The scan number to get
asPeak() | An array that will get filled with Mass-Intensity pairs
sDMRawStats | Gets filled with useful information about the scan


SpecDefault

Sub SpecDefault ()

Restores the default view for the current spectrum.


SpecDisplay

Function SpecDisplay () As Long

Opens the Spectrum display/view dialogue box. Returns the handle of the dialogue box.


SpecDisplayDefault

Sub SpecDisplayDefault (wData As Integer, wCurrent As Integer, wAutoRange As Long)

Displays the current spectrum over the desired default mass range.

wData | TRUE | Displays the spectrum over the data range (Data may not have been acquired for the whole scan range)
 | FALSE | Displays the data over the acquisition range
wCurrent | TRUE | Apply wData parameter to the current window
 | FALSE | Apply wData parameter to all windows
wAutoRange | TRUE | Automatically default when a new spectrum is added
 | FALSE | Keep current range when new spectrum is added


SpecDisplayFrom

Sub SpecDisplayFrom (wLoMass As Integer)

Sets the lower mass of the display range for the current spectrum.

wLoMass

Low mass limit of spectrum draw


SpecDisplayRange

Sub SpecDisplayRange (wLoMass As Integer, wHiMass As Integer)

Sets the display range for the current spectrum.

wLoMass | Low mass limit of spectrum draw
wHiMass | High mass limit of spectrum draw


SpecDisplayTo

Sub SpecDisplayTo (wHiMass As Integer)

Sets the upper mass of the display range for the current spectrum.

wHiMass

High mass limit of spectrum draw


SpecExit

Function SpecExit () As Integer

Closes the spectrum window. Returns True if the window was open.


SpecFileOpen

Function SpecFileOpen (FileName As String, Mode As Integer) As Integer

Opens a raw file from the spectrum window. Returns True if successful.

FileName |  | Name of the file to open
strv |  | Name of the file to open
nrMode | ADD | Adds the new trace to the current window
 | REPLACE | Replaces the currently active trace
 | NEW_WINDOW | Generates a new window for the new trace

The Mode setting is the same as checking the boxes in the Spectrum Data Browser window. It is advisable to reset the mode when you have finished.


SpecGraphs

Function SpecGraphs () As Integer

Returns the number of graphs open in the current spectrum window, or –1 if there was an error.


SpechActive

Function SpechActive () As Integer

Returns the handle of the active window within the spectrum MDI.


SpecHiMassIndex

Function SpecHiMassIndex (lpSpec() As SPECLIST, fHiMass As Single) As Integer

Returns the index position of the highest mass in the array, that is less than or equal to the specified mass. If this cannot be found the last index of the array is returned.

lpSpec | Array of mass-intensity pairs
fHiMass | Target mass for search


SpechMDI

Function SpechMDI () As Long

Returns the window handle for the MDI parent window of the spectrum display.


SpechTool

Function SpechTool () As Long

Returns the window handle for the ToolBar of the spectrum display.


SpechWnd

Function SpechWnd () As Long

Returns the handle of the spectrum window.


SpecLib

Sub SpecLib ()

Performs a library search on the current spectrum. This uses refine parameters set up previously.


SPECLIST

Function SPECLIST (SpecListFile As String) As Long

Writes out the current spectrum to a file. Return value is the number of entries in the spectrum.

SpecListFile

The file name to write the spectrum to


SpecListBP

Function SpecListBP (slFileNum As Integer) As Long

Returns the index of the spectrum's base peak from a file.

slFileNum

Number of file to search


SpecListField

Function SpecListField (slFileNum As Integer, slRecNum As Long, slField As Integer) As Single

Returns the mass or intensity from a specified record in a file.

slFileNum |  | Number of file to search
slRecNum |  | Number of record to retrieve
slField | SL_MASS | Return mass value of record
 | SL_INTENSITY | Return intensity value of record


SpecListSpectrum

Sub SpecListSpectrum (bList As Integer)

Toggles between the spectrum and peak list displays.

bList | TRUE | Displays the peak list for the current spectrum
 | FALSE | Displays the current spectrum


SpecLoMassIndex

Function SpecLoMassIndex (lpSpec() As SPECLIST, fLoMass As Single) As Integer

Returns the index position of the lowest mass in the array, that is greater than or equal to the specified mass. If this cannot be found the first index of the array is returned.

lpSpec | Array of mass-intensity pairs
fLoMass | Target mass for search


SpecMassPlaces

Sub SpecMassPlaces (wPlaces As Integer)

Sets the number of decimal places for the spectrum peak annotation.

wPlaces

Number of decimal places required, must between 0 and 4


SpecMaxEntES

Function SpecMaxEntES (wNumIterations As Integer) As Integer

Performs MaxEnt on the currently active spectrum. Returns the number of iterations performed.

wNumIterations

Maximum number of iterations to perform


SpecMenuPrint

Sub SpecMenuPrint ()

Prints the currently active spectrum window.


SpecMoveFirst

Sub SpecMoveFirst()

Moves the current spectrum to the bottom/first.


SpecMoveLast

Sub SpecMoveLast()

Moves the current spectrum to the top/last.


SpecNewTrace

Sub SpecNewTrace (nMode As Integer)

Routine to determine how spectra will be opened.

bCreate | ADD | Adds the next trace to the current window
 | REPLACE | The next trace replaces the currently active trace
 | NEW_WINDOW | Generates a new window for the next trace

This is the same as selecting the buttons on the spectrum toolbar. It is advisable to reset the mode when you have finished.


SpecPrint

Sub SpecPrint (bLandScape As Integer)

Prints the current spectrum.

bLandScape | TRUE | Prints the spectrum in landscape orientation
 | FALSE | Prints the spectrum in portrait orientation


SpecPrintMenu

Sub SpecPrintMenu (bAll As Integer)

Prints the current spectrum window(s)

bAll | TRUE | Prints all open spectrum windows
 | FALSE | Prints the currently active window


SpecReadData

Function SpecReadData (strFile As String, lpData() As SPECLIST, wStartScan As Integer, wEndScan As Integer, wLoMass As Integer, wHiMass As Integer, wMaxScan As Integer, wMaxSpecPeak As Integer) As Integer

Reads the specified data file and writes, to an array, the full spectrum of each scan in the specified range. Returns True.

strFile | File name to read
lpData | 2-D array of spectral information. First dimension is scan number, second is peak number within the scan (starting at -32768). Each element of the array contains one mass/intensity pair.
wStartScan | First scan to return information for
wEndScan | Last scan to return information for
wLoMass | Lowest mass in lpData array
wHiMass | Highest mass in lpData array
wMaxScan | Maximum scan number (i.e. upper bound of first dimension of lpData array)
wMaxSpecPeak | Maximum peak number (i.e. upper bound of second dimension of lpData array)


SpecReadProcess

Function SpecReadProcess (lpFile As String, wProcess As Integer, lpSpectrum() As SPECLIST) As Long

Fills a SPECLIST type array with masses and intensities, for a processed file. Returns the number of entries written to the array, zero indicates the specified process has not been found.

lpFile | File name to read
wProcess | Process number to read
lpSpectrum | Returned array of mass/intensity pairs


SpecReadSpectrum

Function SpecReadSpectrum (lpFile As String, wFunc As Integer, dwScan As Long, fSMass As Single, fEMass As Single, lpSpec() As SPECLIST) As Long

Fills a SPECLIST type array with masses and intensities. Returns the number of entries read from the file.

lpFile | File name to read
wFunc | Required function number
dwScan | Required scan number
fSMass | Start mass for reading
fEMass | End mass for reading
lpSpec | Returned list of mass/intensity pairs


SpecRefine

Sub SpecRefine ()

Refines a spectrum using the current parameters in the MassLynx dialogue box.


SpecRemove

Sub SpecRemove (nGraph As Integer)

Removes a selected spectrum from the currently active window.

nGraph

Number of the spectrum to be removed


SpecReport

Sub SpecReport ()

Performs the Spectrum Print Report using the parameters already set in the dialogue.


SpecSave

Sub SpecSave ()

Save the last processed spectrum.


SpecScan

Sub SpecScan (wScanNumber As Integer, wHowToDisplay As Integer)

Displays the selected scan number for the current spectrum.

wScanNumber |  | Number of scan to display
wHwToDisplay | ADD | Adds the new trace to the current window
 | REPLACE | Replaces the currently active trace
 | NEW_WINDOW | Generates a new window for the new trace


SpecSmooth

Sub SpecSmooth ()

Performs a smooth on the currently active spectrum using the parameters already present in the dialogue box.


SpecSpectrumSort

Function SpecSpectrumSort (asSpectrum() As SPECLIST, asSpectrumSorted() As SPECLIST) As Integer

Function to sort a spectrum by descending intensity order. Returns zero if there is no error.

asSpectrum | Input spectrum in mass order
asSpectrumSorted | Sorted spectrum in descending intensity order


SpecStats

Sub SpecStats (lpSpec() As SPECLIST, lpSpecStats As SPEC_STATS)

Routine to produce statistics on the current spectrum.

lpSpect() | List of spectrum mass/intensity pairs
lpSpecStats | Returned statistics including mean, ave, SD etc.


SpecSubtract

Sub SpecSubtract ()

Performs a background subtract on the current spectrum using the existing MassLynx dialogue parameters.


SPECT

Sub SPECT ()

Starts the spectrum utility from MassLynx. MassLynx should be running before this procedure is called.


SpecText

Sub SpecText (lpText As String, fX As Single, fY As Single)

Allows you to annotate the current spectrum.

lpText | Text to be added to the spectrum
fX | X position in the spectrum window
fY | Y position in the spectrum window

Note: Text will only be placed if the X and Y positions signify an allowed text placement position (i.e. not in the header section of the spectrum). The X and Y positions describe the centre of the text box.


SpecThreshold

Sub SpecThreshold (bPercent As Integer, fThreshold As Single)

Sets the view threshold for the current spectrum.

bPercent | TRUE | Apply threshold as % of Base Peak
 | FALSE | Apply threshold as absolute intensity
fThreshold |  | Threshold level as either % or ABS


SpecToClip

Sub SpecToClip ()

Copies the current spectrum's 1st 64 kByte of displayed data to the clipboard.


SpecTransform

Sub SpecTransform ()

Performs a transform on the current spectrum using the current MassLynx dialogue parameters.


MassLynx Modules

MassLynx Macro Programs communicate with MassLynx using procedures which are found in MassLynx Modules. MassLynx Modules are libraries of procedures and functions, which you can use to get your Macro Program to acquire data, access files, display spectra and chromatograms, process information and Produce reports.

The MassLynx Modules supplied with your distribution of MassLynx can be found in the Macro subdirectory of your MassLynx installation. Each Module has a .BAS extension, such as SPEC.BAS and QUAN.BAS.

The procedures and functions contained in the MassLynx Modules are documented in the MassLynx API Reference. API stands for Application Programmers Interface and is essentially a set of functions in one application that are available to an application programmer.


MassLynx Module Descriptions

Module | Description
About.bas | Gives a structure to add an About... window to complex Modules with user input/output
Acquire.bas | More complex subroutines for setting the instrument status and setting up and performing acquisitions
Chro.bas | Basic functions to manipulate chromatograms
Declares.bas | Declarations of Windows and Visual Basic defined functions. The functions in here are called from within the main user functions and must therefore be included
Dosutils.bas | DOS based functions, constants and type definitions. Used to link VB to MassLynx.
Error.bas | A series of error-handling functions
Globals.bas | Declaration of global constants.
Integrat.bas | More complex integration functions, includes functions used for custom modules and OpenLynx
Iso.bas | Provides functionality to access MassLynx isotope modelling.
Library.bas | Basic functions for using Library Search
MassLynx.bas | Declarations and constants for general interfacing into MassLynx.
Quan.bas | More complex quantification functions, includes functions used for custom modules and OpenLynx
Report.bas | Simple report generator
Spec.bas | Basic functions to manipulate spectra


Using MassLynx Modules

A Visual Basic program contains several program elements (modules). Each of these is stored under a different filename during program design, but they are all combined in the executable file. Once you have opened your project, you will see the project window appear which contains the filenames of the individual modules of the program. The example programs have these elements in them:

PROJECT (*.MAK / *.VBP FILENAME)

This file contains information on which modules are part of the program. It is displayed as the PROJECT WINDOW.

FORM (*.FRM FILENAME)

The form is the part of the program which becomes the Window when you run your application. The size, colour, caption and many other parameters are set in the PROPERTIES window. For the SPECTRUM and PRINT Modules, the VISIBLE property is set to FALSE. This means that when you run one of these Modules, no extra window appears. The sample program PROCESS has a window associated with it which contains the controls for your use.

On the form itself, the programmer draws controls and text boxes as required and writes code which describes the action associated with the control. To view the form, highlight the *.FRM file in the project window and click on VIEW FORM. The Properties Window will also appear, which contains information about the form. Double Click on any control to see the code associated with it. This code will include both Visual Basic syntax and calls to user defined functions or sub-routines. The code for these functions and sub-routines is stored in the Basic Modules.

BASIC MODULE (*.BAS FILENAME)

This module may or may not be present, depending on the application. Where it exists in the example programs, it contains all the custom sub-routines that are called by commands on the form. There is no properties window associated with the Basic Module. This module may also contain GLOBAL INFORMATION including declarations of USER-DEFINED TYPES, definitions of GLOBAL VARIABLES, definitions of GLOBAL CONSTANTS and declarations of functions located in DYNAMIC LINK LIBRARIES (DLLs).

  • Loading the MassLynx module (.BAS) files


Loading the MassLynx Module (.BAS) files

Before you can write a MassLynx macro using the MassLynx modules you must load the BAS files provided into the visual basic environment.

When first using these modules it is advised that all the modules are loaded, even if you do not intend to use the functionality of them all.

The following is a list of the minimum required modules that should be loaded for most projects:

  • Acquire.bas

  • Chro.bas

  • Declares.bas

  • Dosutils.bas

  • Error.bas

  • Globals.bas

  • Integrat.bas

  • MassLynx.bas

  • Spec.bas

Each BAS file can be added to a Visual Basic project from the main Visual Basic menu. Select Project->Add Module, select the "existing" tab and then use the browser to select the BAS file to be added.


Example Macros

  • LoopProc

  • ChroProc

  • ExtractMLData


ChroProc

The ChroProc macro takes a chromatogram (the type of which is defined in the ChroProc.ini file, the default is TIC) and performs an integration. The parameters that are used in the integration are obtained from the MassLynx.ini file. Once the integration has been performed and the peaks identified in the chromatogram, the ChroProc macro will print off the spectra for each of the peak tops combined with the scan either side of those peak tops. For example, if a chromatographic peak is identified by the integration process as being from scan 10 – 20 with the most intense scan in that range being scan 16 then the Chroproc macro will print spectrum that represents the combination of scans 15 – 17 inclusive.

This macro demonstrates integration of a chromatogram and combination of spectra.

Locating the ChroProc macro

Configuring the ChroProc macro

Program Structure


Locating the ChroProc Macro

The ChroProc macro is installed by default with MassLynx and can be found in the MassLynx\macro\ChroProc directory

For example, C:\MASSLYNX\MACRO\CHROPROC


Configuring the ChroProc Macro

The MassLynx directory contains an ini file called CHROPROC.INI. The chromatogram type for integration can be stored in this file.

Open the CHROPROC.INI file in notepad.

The file will contain the lines:

[Combine]

ChroDesc=TIC

The CHROmatogram DESCription variable indicates which type of chromatogram will be integrated. The default is TIC but other types of chromatogram, including BPI, analog and mass chromatograms, can be specified.


MassLynx Macro Programming Manual - ChroProc - Program Structure

Program Structure

The ChroProc module contains several procedures

Declaration

All functions, variables and user defined data types are declared for use in the macro.

Main()

This is the entry point of the program. It reads the Chroproc.ini file and sets up the Chro Process window. It also calls the ChroCombine function.

ChroCombine()

This function determines the last MassLynx data file to be processed, takes the chromatogram data and performs an integration on that data. The scans that correspond to the tops of the various peaks identified by the integration step are passed to CombineTop and then printed out. The key function called here is IntegrateChromatogramProcess, which is detailed in the MassLynx API Reference.

CombineTop()

This function performs a combine of one scan either side of a given [image] peak top scan.


LoopProc

Here is an example of the macro LoopProc.

Overview

Locating the LoopProc macro

Configuring the LoopProc macro

Program Structure


Overview

The LoopProc macro is designed to process sample loop injection experiments, where no chromatography is employed and where each peak produced injection will have a known retention time in the chromatogram.

The processing produces a hardcopy of the spectrum from the chromatogram at a given retention time.

LoopProc demonstrates the checking required, in any post run macro, to make it reliable.

The macro checks the file acquired over the given retention time, so that the macro does not try to find spectra from a retention time outside the acquired time range.

The file type is checked, as MCA files will have no chromatogram to process and continuum data will require extra processing.

LoopProc can be used as the base for any Macro by changing the ProcessDataFile function to provide the data processing required in your program.


Locating the LoopProc macro

The LoopProc macro is installed by default with MassLynx and can be found in the MassLynx\macro\LoopProc directory

For example, C:\MASSLYNX\MACRO\LOOPPROC


Configuring the LoopProc macro

The MassLynx directory contains an ini file called LOOPPROC.INI. The retention time window for the expected loop injection peak can be stored in this file.

Open the LOOPPROC.INI file in notepad.

The file will contain the lines:

[SpectrumCombine]

RetWins=5.8,6,5.7,5.75,6.1,6.2

The RETentionWINdows variable indicates where the macro will combine chromatogram scans to produce a spectrum for printing.

The above retention time window means a combine from 5.8 to 6.0 minutes, followed by subtractions of the regions 5.7 to 5.75 and 6.1 to 6.2.


MassLynx Macro Programming Manual - LoopProc - Program Structure

Program Structure

The LoopProc module contains several procedures

Declarations

All functions, variables and user defined data types are declared for use in the macro.

Main()

The Main loop section checks that the INI file contains valid information on the layout of the LoopProc form. It determines the last MassLynx data file to be processed and then calls the ProcessDataFile procedure.

ProcessDataFile()

Any data file passed to this procedure is examined for its type (Centroid Acquisitions require spectrum combine only, Continuum data require smoothing and subtracting before spectrum combine can be run, MCA data cannot be processed as no chromatogram is produced). The retention time windows are read via RetTimesRead and checked. The relevant processing is then carried out and the resultant spectrum is printed.

RetTimesRead()

This utility function reads the INI file and returns the spectrum combine retention windows.


ExtractMLData

The ExtractMLData macro demonstrates the fundamental methods for extracting chromatographic and spectral data from a MassLynx data file. The macro creates two new files in the same directory as the MassLynx raw data file that is being processed. These new files are called <RawDataFileName>.txt and <RawDataFileName>pkdet.txt.

<RawDataFileName>.txt is filled with the mass and intensity pairs for every peak in every scan in every function of the data file being processed. <RawDataFileName>pkdet.txt shows the data for a chromatogram i.e. scan number, retention time and intensity, it then goes on to show the data for that chromatogram after an integration has been performed on it i.e. peak number, peak top (retention time), peak height and peak area.

Locating the ExtractMLData macro

Program Structure


Locating the ExtractMLData macro

The ExtractMLData macro is installed by default with MassLynx and can be found in the MassLynx\macro\ExtMLData directory

For example, C:\MASSLYNX\MACRO\EXTMLDATA


MassLynx Macro Programming Manual - ExtractMLData - Program Structure

Program Structure

The ExtractMLData module contains several procedures

Declaration

All functions, variables and user defined data types are declared for use in the macro.

Main()

This is the entry point of the program. It reads the MLCurSmp.txt file to get the information for the current file being processed by the sample list. It also calls the WriteMIPairsToTextFile function and the WriteChroAndIntegData function.

WriteMIPairsToTextFile()

This function determines the number of functions in the data file and the number of scans in those functions. It then loops through all the scans in all the functions reading the masses and intensities for each peak in each scan and outputting the data to the text file. This demonstrates how to extract the raw data for a spectrum. The key function called in this function is DmRawReadSpectrumVB, see the MassLynx Direct Calls section for further information.

WriteChroAndIntegData()

This function reads the information for three different types of chromatogram of the same data (that is the TIC chromatogram, the BPI chromatogram and single mass chromatogram). It outputs that information in the form of the scan number, the retention time and the intensity of the chromatogram at that scan. The function then performs an integration on the three sets of data and outputs the results. For each of the peaks identified by the integration process the peak number is shown with retention time of the peak top, the peak height and the area of the peak. This function demonstrates how to extract the raw data for a chromatogram and also how to perform an integration on that data. The key functions called in this function are DmRawReadChromatogramVB and IntegrateChromatogramRange, see the MassLynx Direct Calls section for further information.


FAQ

Here a some of the most frequently asked questions about the Macro software.

How Do I Read a Spectrum

How Do I Read a Chromatogram

How Do I Integrate a Chromatogram


How Do I Read a Spectrum

An array of mass and intensity pairs pertaining to the peaks in a spectrum can be retrieved from MassLynx data files with the DmRawReadSpectrumVB() function. This is demonstrated in the WriteMIPairsToTextFile() function of the ExtMLData project.


How Do I Read a Chromatogram

Time and intensity data for a chromatogram can be retrieved from a MassLynx data file with the DmRawReadChromatogramVB() function. This is demonstrated for three different types of chromatogram in the WriteChroAndIntegData() function of the ExtMLData project from lines 125 - 155.


How Do I Integrate a Chromatogram

An integration process can be applied to a chromatogram with the function IntegrateChromatogramRange(). The peak top, peak height and peak area of the peaks identified in the integration process can be retrieved as demonstrated in the WriteChroAndIntegData() function of the ExtMLData project from lines 157 – 188.


Copyright Notice

Micromass UK Ltd believes that the information in this publication is accurate. However the information is subject to change without notice and should not be construed as a contractual undertaking by Micromass UK Ltd. Despite the care which has been given to the preparation of this publication, Micromass UK Ltd accepts no responsibility for any loss or any other matter which may arise from any error or inaccuracy which may inadvertently have been included.

Copyright © 2002 Micromass UK Ltd. All Rights Reserved.

No part of this publication may be copied without the express written permission of Micromass UK Ltd .


Disclaimer

The information provided in this document is provided "as is" without warranty of any kind. Micromass disclaims all warranties either expressed or implied, including the warranties of merchantability or fitness for a particular purpose. In no event shall Micromass or its supplies be liable for damages whatsoever including direct, indirect, incidental, consequential, loss of business profits, or special damages, even if Micromass or its suppliers have been advised of the possibility of such damages.


Help Contents

Contents

MassLynx Macro Programming Manual
Notices
System Requirements
Installing Microsoft Visual Basic V6.0
Writing Macro Programs to Work with MassLynx
MassLynx Datafile Access Component
MassLynx Modules
MassLynx Module Descriptions
Using MassLynx Modules
Working with MassLynx data files
Example Macros
MassLynx API Reference
MassLynx Direct Calls
FAQ


Notices

The software described in this document is furnished under a licence agreement and may be used only in accordance with the terms of that agreement.

  • Pre-requisite

  • Copyright Notice

  • Disclaimer

  • Trademarks


Pre-requisite

Successful use of this manual to write MassLynx macro programs relies on the user having a good understanding of the basic principles of software programming using the Visual Basic language. It is highly recommended that you read the first part of the Microsoft Visual Basic Programmer's Guide before you start to use this manual.


Trademarks

MassLynx is a registered trademarks of Micromass UK Ltd.

Windows is a trademark of Microsoft Corporation. Other product names mentioned in this manual may be trademarks or registered trademarks of their respective companies and are hereby acknowledged.


MACMANuntitled

API
Application Programmers Interface:- is essentially a set of functions in one application that are available to an application programmer


MACMANuntitled00000396

DAC
Datafile Access Component ) is an ActiveX .DLL which allows easy access to MassLynx data files.