Advertisement

MSD chemstation macro report help PLEASE!!!

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

26 posts Page 1 of 2
Hope anyone can help as my whole organization of 80 or so people is counting on me.

I'm trying to get two chromatograms to print out on 1 page with all their peaks and header info.

Basically I want the blank to run, then it saves into a variable R0, then the sample runs and chromatogram saves into variable R5 (These variables are defined in the deuser.mac file for each method). After the sample runs, I want the blank chromatogram and sample chromatogram to print on the same page with both their sample header info and peaks integrated.

I've gotten it basically to work, but it only works in the data analysis program (offline) when running the method and not when I actually run the methods through online.

Is it even possible to save a chromatogram into a variable such as R0 then recall it later to print with another chromatogram R5 during an actual run?

Basically want the blank TIC to print with every sample TIC that runs after it. The method for the blank is exactly the same as the method for the samples, I just had to rename the method (and modify its deuser.mac) so the blank can be saved into variable R0 and the samples can be saved in R5.

Is there also a way to save a custom header for the blank and then recall it to print with the samples? I know Agilent has a built in header but how can I modify it?
The headers are in the quant reporting macros, I believe it is in the file cquant.mac.

As for bringing the blank chromatogram into the sample report, I am not sure but I think it resets the stack with each method load, so unless it is the same method it will be reset. It could also be that the quant macro is reinitializing the stack with each sample. Data Analysis allows you to manually overlay or stack chromatograms in the open window, which can then be reported in a single report, but I think all of those reset each time a new sample or method is loaded. Of course I know just enough about the macro language to be dangerous and sometimes debug a problem, so those are my best guesses.
The past is there to guide us into the future, not to dwell in.
The stack will get cleared every time Chemstation is opened.

You need to write your own macro, and call that macro from Deuser.mac

A strategy to do what you want is:

1) If sample is a blank, then store datafile name in an .ini file
2) If sample is a Sample, then start the macro to create a
page to print.
3) put the information were you want eg:
strprint " Sample ID : " + _dataname$, 2,0
strprint " Data File : " + _dataFile$,2,1
strprint " Vial: " + val$(_ALSBOTTLE),62,1
strprint " Data Path : " + _dataPath$,2,2
strprint " Date : " + _dateacquired$, 2,3
strprint " Method : " + _METHFILE$, 36,3
winprint 3,wx[item_num],wy[item_num],width[item_num],length[item_num],labels
4) now load the blank data file (using the .ini file information) , and repeat ( obviously put information in different spots on the page)
5) and print the page.

You may also want to include code that will make both TICs to be the same scale by comparing the Ymax values.

symboldump will help you identify where the variables are stored.
Thanks so much but could you explain how to save to the Ini file and recall it in the deuser macro. The printing I can figure out. Would appreciate so much. I don't know macros that well as I just started learning but I can figure it out with some help.
1) I strongly suggest not to write your macro in the Deuser.mac, only use deuser.mac to execute your macro, it is easier to debug, call from a menu etc... eg:
macro _MACROPATH$+"bagee.mac" ,GO

2) the help file gives advice how to use the ini function:
string$ = GETINISTRING$("filename", "application name", "keyname")
value = SETINISTRING ("filename", "application name", "keyname", "string")

you may need to create the ini file first using:
OPEN "filename" FOR OUTPUT etc...

3) I suggest downloading and installing Notepad++, as it is helpful in writing macros, as will as using the 'find in files' function where you can search through macros in directories and subdirectories to find examples of how Agilent uses functions of interest.

4) the ini file you should save the two variable _datapath$ and _datafile$ of the blank, then you can see the blanks TIC using eg:
ldnewfile _datapath$+_datafile$
I'll look at the help file thanks but could you steer me clearer as I'm still new to this. I still don't get how I'd use the ini file. How do I store the blank data into the ini file then call it with the sample report?

Sorry to push you, I've just been working on this for ages. Really frustrating.
I'll look at the help file thanks but could you steer me clearer as I'm still new to this. I still don't get how I'd use the ini file. How do I store the blank data into the ini file then call it with the sample report?

Sorry to push you, I've just been working on this for ages. Really frustrating.
From what I am reading in the above post you use the commands;

string$ = GETINISTRING$("filename", "application name", "keyname")
value = SETINISTRING ("filename", "application name", "keyname", "string")

to put data into the strings, notice the INI inside the command name.

Then from this;

4) the ini file you should save the two variable _datapath$ and _datafile$ of the blank, then you can see the blanks TIC using eg:
ldnewfile _datapath$+_datafile$

It looks like you use the INI commands to put the path to the blk data file into the INI file then use that path to pull the blk chromatogram into the report for the current sample directly from the blk data file.
The past is there to guide us into the future, not to dwell in.
exactly as James has written.

The following code hasn't been tested but will point you in the right direction.

Code: Select all

name Add_Blank_Sample_Info
local inifile$,inisect$,i
inifile$=_METHPATH$+_METHFILE$+"\method.ini"
inisect$="SequenceBlank"
i=setinistring(inifile$,inisect$,"DataPath",_datapath$)
i=setinistring(inifile$,inisect$,"DataFile",_datafile$)
GETSCALARS POINT,,R0
i=setinistring(inifile$,inisect$,"YMax",Yhigh)
return
Which will put the information in the Method.ini file in the method.

[SequenceBlank]
DataPath=C:\msdchem\1\data\
DataFile=bagee_blank.d
Ymax=8.7654+006
So the info saved to the ini file like in your macro. Problem is when I go to load the blank when printing the sample with ldnewsample command it still prints the sample twice. The datafile is not switching back the original blank.

Also, at times it is saying the window does not exist.

I am printing the sample TIC first, so it is roughly

startprint

winprint...

ldnewsample _datapath$+_datafile$
winprint ....

endprint

although in the current report that we use there is also a FILE command that has _datapath$+_datafile$. Is this the issue? So after the startprint there is this command for the sample to be loaded.
two easy commands for debugging are the PRINT or ALERT commands.

_datapath$ and _datafile$ are locked Global variables and store the value of
the currently opened datafile.

so if you were executing

Code: Select all

 ldnewsample _datapath$+_datafile$
, it would be reloading the sample file that was already open.

if you executed

Code: Select all

ldnewsample "C:\msdchem\1\data\"+"bagee_blank.d"
,
then that file would open.
I get that but then how would I load blank file if multiple users will be running their blanks in a sequence with different names? I wanted it to load the blank file based on whether they used a method called say bageeblank.m. Or even if somehow if I kept the method the same name as the samples it could be based on whether the data file name contained the name 'blank' or 'blk'. All the users name their blank data path files and also sample file names as their initials and then the word blank so ie. BHblank or KSblk.

The way I think you're going is I'd have to name my blank always as bagee_blank to get the correct path?
That is correct if you hard code the name of the data file.

But did we not save the name to an .ini file to implement a dynamic system in order to stop that event?

Code: Select all

local inifile$,inisect$,I,Backgnd_File$,Backgnd_Path$,ScaleY
inifile$=_METHPATH$+_METHFILE$+"\method.ini"
inisect$="SequenceBlank"

Backgnd_File$ = GETINISTRING$(inifile$,inisect$,"DataFile")
Backgnd_Path$ = GETINISTRING$(inifile$,inisect$,"DataPath")
ScaleY= GETINISTRING$(inifile$,inisect$,"YMax")

ldnewsample Backgnd_Path$+Backgnd_File$
I just want to make this clear so I don't bug you guys anymore.

The code below will be put into a macro that is called from the deuser.mac file in the method for the blank ("bageeblank.m") right?

local inifile$,inisect$,I,Backgnd_File$,Backgnd_Path$,ScaleY
inifile$=_METHPATH$+_METHFILE$+"\method.ini"
inisect$="SequenceBlank"

Backgnd_File$ = GETINISTRING$(inifile$,inisect$,"DataFile")
Backgnd_Path$ = GETINISTRING$(inifile$,inisect$,"DataPath")
ScaleY= GETINISTRING$(inifile$,inisect$,"YMax")


The line below will be put into the macro for the sample report that will be called from the deuser.mac file in the method for the sample (bagee.m) right as you described some posts above?

ldnewsample Backgnd_Path$+Backgnd_File$

So everytime the bageeblank.m method is run, the method.ini file will be overwritten with whatever datafile is written and should update the blank file accordingly?

Just as an aside, instead of using deuser.mac file in the methods to store a blank and then recall it, is it possible to use the sample type that is in the sequence table? Where it says sample, blank, etc.?
The only code in the deuser.mac should be

Code: Select all

macro _MACROPATH$+"bagee.mac" ,GO
All other codes should be written in the bagee.mac

I think ?, _runtype is a variable that records if in the sequence if it was a blank or sample.
This is still not clear to me.

The code below is called from deuser.mac using bagee.mac, which saves the blank file to the ini.

name Add_Blank_Sample_Info
local inifile$,inisect$,i
inifile$=_METHPATH$+_METHFILE$+"\method.ini"
inisect$="SequenceBlank"
i=setinistring(inifile$,inisect$,"DataPath",_datapath$)
i=setinistring(inifile$,inisect$,"DataFile",_datafile$)
GETSCALARS POINT,,R0
i=setinistring(inifile$,inisect$,"YMax",Yhigh)
return

Then this code will load the blank file (which is to be put into a macro called by deuser.mac for the sample method???)

local inifile$,inisect$,I,Backgnd_File$,Backgnd_Path$,ScaleY
inifile$=_METHPATH$+_METHFILE$+"\method.ini"
inisect$="SequenceBlank"

Backgnd_File$ = GETINISTRING$(inifile$,inisect$,"DataFile")
Backgnd_Path$ = GETINISTRING$(inifile$,inisect$,"DataPath")
ScaleY= GETINISTRING$(inifile$,inisect$,"YMax")

ldnewsample Backgnd_Path$+Backgnd_File$

Also, there is no command for ldnewsample. I'm guessing you mean ldnewfile?
26 posts Page 1 of 2

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 4374 on Fri Oct 03, 2025 12:41 am

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