Debug a chemstation macro help

Discussions about chromatography data systems, LIMS, controllers, computer issues and related topics.

10 posts Page 1 of 1
Hi. I’m wondering if someone could comment/help on some macro code. First off this is not my code and I don’t know who wrote it. Overall it is a fairly complex set of macros that create a CSV file of the raw data for a GC run (time and detector response). Our lab has used this code for many years and it works fine as long as it is used in an online session of Chemstation. Unfortunately it has NEVER worked in an offline/reprocessing session but we would like it to. We get an error right from the start. The error shown is “parameter 2, table doesn’t exist”. I’m only including the code from the start to shortly after where the error occurs (note I've added a comment where the error occurs). I have found other code online for creating a CSV file of the raw time/detector data and it does work in offline mode BUT it takes forever (minutes) for the CSV file to be created whereas this macro does it almost instantly. I'm not well versed in using the _Config[] registers and especially the not well documented _config[6] register that contains the control tables. Also I'm confused by the, DaInChrom parameter in the TABVal command(s). What is that parameter or system variable/


!***********************************!
name DAIN_Chrom !*
!***********************************!
local Result,i,j,NOfSignals,NOfCol,TitleBar$,\
DAIN_SelSignal$,DAIN_AllSignals$,DAIN_SelDest$,\
DAIN_AllDests$, DAIN_TimeAxis, DAIN_YAxis, \
DAIN_PeakNumber, DAIN_RetTime

NOfSignals=RegSize(chromreg)
if NOfSignals <= 0
generate error ,"Do a ""Load Signal..."" before data interchange"
endif

Here is where it fails when trying to execute the next line(s) but only when running in an offline/reprocessing session.

DAIN_TimeAxis = TabVal(_config[6],DaInChrom, 1,ColHidden)
DAIN_YAxis = TabVal(_config[6],DaInChrom, 1,ColHidden)

if DAIN_TimeAxis = 1;DAIN_TimeAxis = 0;else;DAIN_TimeAxis = 1;endif
if DAIN_YAxis = 1;DAIN_YAxis = 0;else;DAIN_YAxis = 1;endif

for i=1 to NOfSignals
if ObjHdrType(chromreg[i],"SignalDesc")=99
if ObjHdrType(chromreg[i],"Title")=0
DAIN_AllSignals$ = DAIN_AllSignals$+"|"+val$(i)+": "+ObjHdrText$(chromreg[i],"Title")
else
DAIN_AllSignals$ = DAIN_AllSignals$+"|"+val$(i)+": chromreg["+val$(i)+"] has no title"
endif
else
DAIN_AllSignals$ = DAIN_AllSignals$+"|"+val$(i)+": "+ObjHdrText$(chromreg[i],"SignalDesc")
endif
next i

DAIN_AllSignals$ = DAIN_AllSignals$[2:len(DAIN_AllSignals$)]
if NOfSignals = 1
DAIN_SelSignal$ = DAIN_AllSignals$
else
DAIN_SelSignal$ = DAIN_AllSignals$[1:instr(DAIN_AllSignals$,"|")-1]
endif



Thanks for any help/suggestions.
I have worked with the macros in chemstation but not quite that deeply into calling the registers. So from your description that is fails when running offline/reprocessing I am wondering if the register it is trying to call is that which is currently active, and it does so before it closes out and moves to the next sample, and that is why it works online during a run.

If you search online, there is an Agilent Macro programming guide in .pdf form. I had it a long time ago but not sure where I found it, but it is very helpful when working with macros and I believe it has definitions for thingslike those _config tables.

The person who wrote most of these macros for Agilent is Paul Fjeldsted who now works for Perkin Elmer for their Labworks LIMS section(last I knew). I have spoken with him before and he knows those macros inside and out, if you could get in touch with him maybe he could help. I know if you look at most of the macros in Chemstation you will see his name in there as the creator. I met him once at a Labworks Users Dinner at Pittcon and told him I was having problems with a macro to transfer results from Chemstation to Labworks and he wrote the solution down for me on a napkin :)

EDIT: On second thought though, that was the MSD Chemstation I was using, not sure if the macro language is exactly the same if using the regular GC/LC Chemstation.
The past is there to guide us into the future, not to dwell in.
Thanks for your reply and a possible contact. Your theory is a good one. I have tried running the macro in the offline session without the online session open and it still doesn't work. Don't know if that means anything. Another theory is there is a flag for offline vs. online that we need to monitor and set or define some variable to deal with offline vs. online. I know when starting offline it reads in system settings from a different config file stored in the /Core directory. I do have the macro programming guide PDF. Several hundred pages. Unfortunately it does not detail the _config[6] object very well compared to the other objects in the _config register. It appears to almost be a "for Agilent use only" type of object. The PDF says there are no details available for it and it can't be listed like the other objects in the _config register. I will keep the forum folks updated when/if I found out more info.

The other code that does work but takes a long time is the simple for/if code Gasman has supplied in other posts.
Agilent supplies a macro file named 'mactools.mac'. This macro will allow you to read all of the registers and see their contents. You will find it in the User Contributed Library (UCL) on the ChemStation disks. In the latest version of ChemStation, you will find on disk2, UCL\LC_UCL and then look in folder 5. Having this macro is a MUST if you want to do any work with the registers.

Gasman
I found your macro on my system, it was part of the original UCL for Gas Chromatography. I noticed this difference, which is after your comment "here is where it fails".

DAIN_TimeAxis = TabVal(_config[6],DaInChrom, 1,ColHidden)
DAIN_YAxis = TabVal(_config[6],DaInChrom, 2,ColHidden)

There is a difference between what you list and the above. Whether this will solve your problem, I do not know.

Gasman
Gasman,

Thanks for digging further. Not sure why our statements are that way. My understanding is this code was given to us from someone/someplace like this. I did find the UCL folder/macro library. What a nice set of tools (especially folder 5 in the LCL macro folder which is where the mactools.mac is at). However I think the issue has fixed itself but I don't know why/how. My timeline is a little fuzzy at the moment but we had to turn all equipment off for planned electrical outage for last weekend. Today, when I went to work on the system with this new set of macros everything worked fine in the offline session. Maybe a complete shutdown of computer fixed some glitch that was not corrected by just closing all the chemstation instruments. Also it turns out that in the same folder is a set of routines in DAINTools.MAC (removed in the more updated versions of the UCL) that are the same routines we are using in our in-house macro.

I am just getting back into Chemstation from a long long hiatus. I have found that the CSV export capability is already available via the File/Export menu. I am going to investigate simplifying our in-house macro to use this instead. I suspect that is why DAINTools.mac was removed from newer versions of UCL/LCL/5 folder. see the revision history in the readme.txt file in that same 5 folder.

Thanks for all your help and pointing me to the UCL folder. That will be a valuable resource.

Greg
Another file that you will find useful if you are getting back into macro programming, is the Commands.chm ( or HPCMD.HLP depending in your ChemStation version) which you will find in C:\Chem32\Core\helpenu. This file contains descriptions and some examples of all of the commands used in the macro language.

Gasman
Thanks for the additional info. To step back to an earlier response where you noted a difference in my vs. yours in the DAIN_YAxis = TabVal(_config[6],DaInChrom, 2,ColHidden) statement. That was an error on my part. I was experimenting and had changed the "2" to a "1". Forgot to change it back before posting here.

Greg

P.S. All these macros now seem to be in the UCL/LC folder. There is very little in the GC folder.
James_Ball wrote:
I have worked with the macros in chemstation but not quite that deeply into calling the registers. So from your description that is fails when running offline/reprocessing I am wondering if the register it is trying to call is that which is currently active, and it does so before it closes out and moves to the next sample, and that is why it works online during a run.

If you search online, there is an Agilent Macro programming guide in .pdf form. I had it a long time ago but not sure where I found it, but it is very helpful when working with macros and I believe it has definitions for thingslike those _config tables. mapquest driving directions

The person who wrote most of these macros for Agilent is Paul Fjeldsted who now works for Perkin Elmer for their Labworks LIMS section(last I knew). I have spoken with him before and he knows those macros inside and out, if you could get in touch with him maybe he could help. I know if you look at most of the macros in Chemstation you will see his name in there as the creator. I met him once at a Labworks Users Dinner at Pittcon and told him I was having problems with a macro to transfer results from Chemstation to Labworks and he wrote the solution down for me on a napkin :)

EDIT: On second thought though, that was the MSD Chemstation I was using, not sure if the macro language is exactly the same if using the regular GC/LC Chemstation.


I'm not sure if the macro language is exactly the same if using the regular GC/LC Chemstation. I've been using the MSD Chemstation for a while now and it's been great, but I'm starting to notice some differences.
There are definitely a lot of differences between the two (MSD vs Chemstation).
10 posts Page 1 of 1

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 1117 on Mon Jan 31, 2022 2:50 pm

Users browsing this forum: No registered users and 1 guest

Latest Blog Posts from Separation Science

Separation Science offers free learning from the experts covering methods, applications, webinars, eSeminars, videos, tutorials for users of liquid chromatography, gas chromatography, mass spectrometry, sample preparation and related analytical techniques.

Subscribe to our eNewsletter with daily, weekly or monthly updates: Food & Beverage, Environmental, (Bio)Pharmaceutical, Bioclinical, Liquid Chromatography, Gas Chromatography and Mass Spectrometry.

Liquid Chromatography

Gas Chromatography

Mass Spectrometry