-
- Posts: 6
- Joined: Fri Oct 12, 2012 1:58 pm
Advertisement
OpenLab macros
Discussions about chromatography data systems, LIMS, controllers, computer issues and related topics.
8 posts
Page 1 of 1
When using the show command to bring up the dialogbox showing all the domains with variables, macros, functions etc., it lists over 3000 macros. I know most macros are stored in the Core directory and that some macros can be nested inside other macro files. Where are the rest of the macros stored that are listed in the show dialog? Thanks
-
- Posts: 584
- Joined: Mon Sep 13, 2004 8:22 pm
The macros themselves are stored in macro files. These have the extension .mac or .mcx. A macro file can contain many macros. Macro files with the .mac extension can be opened and read with NotePad. The macro files with the .mcx extension are in a binary format and cannot be read. If you type the word 'macro' into the command line instead of 'show', you will get a list of macro files that are available. If you then open a file up, you will then see the macros in that file.
When you type in 'show', you are seeing the results of loading macro files into ChemStation. For example: If you had a macro file named 'mymacros.mac' in the core directory and this contained three macros named 'test1', 'test2' and 'test3', you would not see these macros in the list when you type in 'show'. If you type into the command line the command 'macro mymacros.mac', that file would be loaded into ChemStation. Now if you type in 'show', you would see your macros 'test1', 'test2' and 'test3' in the list of macros.
I thik that it will take a bit of detective work for you to find what you want..............
Gasman
When you type in 'show', you are seeing the results of loading macro files into ChemStation. For example: If you had a macro file named 'mymacros.mac' in the core directory and this contained three macros named 'test1', 'test2' and 'test3', you would not see these macros in the list when you type in 'show'. If you type into the command line the command 'macro mymacros.mac', that file would be loaded into ChemStation. Now if you type in 'show', you would see your macros 'test1', 'test2' and 'test3' in the list of macros.
I thik that it will take a bit of detective work for you to find what you want..............
Gasman
-
- Posts: 6
- Joined: Fri Oct 12, 2012 1:58 pm
Thanks Gasman. I knew about the .mac files but didn't know about the .mcx files -thanks good advice. I'm using macropad to write macros instead of notepad. It works much better than notepad and will allow you to run and test the macro from macropad itself. Will check and see if I can decipher those .mcx files.
Thanks
Thanks
-
- Posts: 584
- Joined: Mon Sep 13, 2004 8:22 pm
Although it is not possible to read .mcx files, it is possible for you to convert your .mac files to the .mcx format. This prevents other people reading your work or going in your macro and changing things.
Gasman
Gasman
-
- Posts: 32
- Joined: Tue Oct 24, 2017 1:30 pm
May I check is there any way to write macros that can automate the following :
1) for each peak, print the overlaid uv spectrum of the match with that of the compound in a library ? Save the overlaid spectrum as a pdf file in a folder of choice .
I remembered seeing .mcx file in the open lab chemstation but I am unsure how to write macros. Can we write macros in a notepad and save as .mcx file and run on the system?
Is it true that currently the open lab chemstation uses DDE (dynamic data exchange) instead of COM Objects and if I need to run the macros, I need to activate through excel VBA?
I look forward to the replies!
Thank you very much!
1) for each peak, print the overlaid uv spectrum of the match with that of the compound in a library ? Save the overlaid spectrum as a pdf file in a folder of choice .
I remembered seeing .mcx file in the open lab chemstation but I am unsure how to write macros. Can we write macros in a notepad and save as .mcx file and run on the system?
Is it true that currently the open lab chemstation uses DDE (dynamic data exchange) instead of COM Objects and if I need to run the macros, I need to activate through excel VBA?
I look forward to the replies!

Thank you very much!
-
- Posts: 373
- Joined: Mon Sep 13, 2010 8:28 am
.mac - are text files, .mcx - binary, only HP/Agilent adepts know how to build it.
Your task somewhat resolved in UCL (user contributed library) which is shipped on every Chemstation CD.
Here is example of macro that exports base peak parameters to Excel.
Just create text file mymacro.mac, containing the following:
name exp_dde
local npeaks,cpk,t1,a1,ct$,ca$,tv$,av$
npeaks = TabHdrVal(ChromRes[1], "Peak", "NumberOfRows")
If (npeaks <= 0) then
return
EndIf
chan = DDEInitiate("Excel","Sheet1")
for cpk=1 to npeaks
t1 = TabVal(ChromRes[1], "Peak", cpk, "MeasRetTime")
a1 = TabVal(ChromRes[1], "Peak", cpk, "Area")
ct$ = printf$("R%dC%d",cpk,1);
ca$ = printf$("R%dC%d",cpk,2);
tv$ = printf$("%.3f",t1)
av$ = printf$("%g",a1)
DDEPoke chan,ct$,tv$
DDEPoke chan,ca$,av$
next cpk
DDETerminate chan
endMacro
load the file from the famous commandline and type
exp_dde
Your task somewhat resolved in UCL (user contributed library) which is shipped on every Chemstation CD.
Here is example of macro that exports base peak parameters to Excel.
Just create text file mymacro.mac, containing the following:
name exp_dde
local npeaks,cpk,t1,a1,ct$,ca$,tv$,av$
npeaks = TabHdrVal(ChromRes[1], "Peak", "NumberOfRows")
If (npeaks <= 0) then
return
EndIf
chan = DDEInitiate("Excel","Sheet1")
for cpk=1 to npeaks
t1 = TabVal(ChromRes[1], "Peak", cpk, "MeasRetTime")
a1 = TabVal(ChromRes[1], "Peak", cpk, "Area")
ct$ = printf$("R%dC%d",cpk,1);
ca$ = printf$("R%dC%d",cpk,2);
tv$ = printf$("%.3f",t1)
av$ = printf$("%g",a1)
DDEPoke chan,ct$,tv$
DDEPoke chan,ca$,av$
next cpk
DDETerminate chan
endMacro
load the file from the famous commandline and type
exp_dde
-
- Posts: 32
- Joined: Tue Oct 24, 2017 1:30 pm
@antonk, thank you for the reply. I read in the chemstation macro programming guide that there is a window 28 which "Print spectra from peak purity and library search plot macros (Report)". Does this window 28 refer to macro or just the window number?
I am relatively new to macros.... do you have a snapshot as to where I could enter my macro in the command line in the OpenLAB CDS
ChemStation Edition Offline Data Analysis? Thank you so much for the help.
I am relatively new to macros.... do you have a snapshot as to where I could enter my macro in the command line in the OpenLAB CDS
ChemStation Edition Offline Data Analysis? Thank you so much for the help.

-
- Posts: 373
- Joined: Mon Sep 13, 2010 8:28 am
window number@antonk, thank you for the reply. I read in the chemstation macro programming guide that there is a window 28 which "Print spectra from peak purity and library search plot macros (Report)". Does this window 28 refer to macro or just the window number?
As far I remember you have to enable "Extended menus" in Chemstation, only in that case your commandline would be visibleI am relatively new to macros.... do you have a snapshot as to where I could enter my macro in the command line in the OpenLAB CDS
ChemStation Edition Offline Data Analysis? Thank you so much for the help.![]()
8 posts
Page 1 of 1
Who is online
In total there are 3 users online :: 1 registered, 0 hidden and 2 guests (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: Google [Bot] and 2 guests
Most users ever online was 4374 on Fri Oct 03, 2025 12:41 am
Users browsing this forum: Google [Bot] and 2 guests
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.
- Follow us on Twitter: @Sep_Science
- Follow us on Linkedin: Separation Science