Page 1 of 1

MSDCHEM load data file

Posted: Wed Mar 26, 2014 6:51 pm
by pault
Hi!
I would like to create shortcut or macro, that automatically loads specific datafile.

Now my chemstaion D.03.00.611 is launched by shortcut:
C:\msdchem\MSexe\msda.exe 1 ,envorphinit , envinit.mac

I would like to launch specific datafile in some way like this:
C:\msdchem\MSexe\msda.exe 1 , "C:\Data\10624-002.D"

Could you help me with this issue?

Tomas

Re: MSDCHEM load data file

Posted: Thu Mar 27, 2014 8:12 am
by chemstation
C:\msdchem\1\files.val , is a text file that will load the last opened data file, when Chemstation is activated.

But I'm guessing you want to do is batch processing, so use the TOOLS >> DO LIST
function in the menu bar, to select the files you want to batch process.

p.s. setup a PDF printer and set it to pause, as most macros will want to print something out.

Alex

Re: MSDCHEM load data file

Posted: Thu Mar 27, 2014 9:39 am
by pault
C:\msdchem\1\files.val , is a text file that will load the last opened data file, when Chemstation is activated.

But I'm guessing you want to do is batch processing, so use the TOOLS >> DO LIST
function in the menu bar, to select the files you want to batch process.

p.s. setup a PDF printer and set it to pause, as most macros will want to print something out.

Alex
Thank you Alex for your post.
I found the file C:\msdchem\1\files.val. So I need to change it before launch MSDChem. My effort is to make a link to chromatograms. I have these chromatograms generated in MS Excel. If the user click on the chromatogram, the specific data file will be opened in MSD Chemstation. I have idea to load data file with some command or macro.

Tomas

Re: MSDCHEM load data file

Posted: Thu Mar 27, 2014 3:02 pm
by chemstation
If you open up the command line and paste the following command then it will load the file:

ldnewfile "C:\Data\10624-002.D",,0

An Idea: If they click on the chromatogram , clear the clipboard and copy the command to the clipboard,
then when they click on the Data Analysis command line and press Cntrl-V, and then Enter, it will load the data file.


If you want to automate it, then you're looking at using DDE, and a world of bugs.

Alex

Re: MSDCHEM load data file

Posted: Fri Mar 28, 2014 2:46 pm
by pault
If you open up the command line and paste the following command then it will load the file:

ldnewfile "C:\Data\10624-002.D",,0

An Idea: If they click on the chromatogram , clear the clipboard and copy the command to the clipboard,
then when they click on the Data Analysis command line and press Cntrl-V, and then Enter, it will load the data file.


If you want to automate it, then you're looking at using DDE, and a world of bugs.

Alex
Alex, thank you very much for your approach.
I have done some progress. I had to study MSD Chemstation macros little bit. I've created my own macro "C:\msdchem\MSexe\EditCompound.mac"...

Code: Select all

NAME LoadFile
LDNEWFILE "C:\Data\10523-006.D"
QEDIT
CO 6
After that I modify the macro "C:\msdchem\MSexe\envinit.mac". At the end of „envorphinit“ procedure I pasted this line of code:

Code: Select all

MACRO _exepath$+"EditCompound.mac",go
I create the macro "C:\msdchem\MSexe\EditCompound.mac" in VBA Excel just before I launch the chemstation:

Code: Select all

Function Write_Macro(ByVal FilePath As String, ByVal Param As String) As Boolean
On Error GoTo ErrorHandler

Open MACRO_FILE_PATH For Output As #1
    Print #1, "NAME LoadFile"
    Print #1, "LDNEWFILE "; Chr(34) & FilePath & Chr(34)
    Print #1, "QEDIT"
    Print #1, "CO " & Param
Close #1

Write_Macro = True
Exit Function

ErrorHandler:
Write_Macro = False
End Function
The chemstation I launch in VBA with this code:

Code: Select all

myValue = Shell("C:\msdchem\MSexe\msda.exe 1 ,envorphinit , envinit.mac")
That is it.
Tomas

Re: MSDCHEM load data file

Posted: Fri Mar 28, 2014 5:25 pm
by chemstation
If you're using QEdit, you may want to verify the correct method name is loaded too.

Also I suggest to not edit the "C:\msdchem\MSexe\envinit.mac", as that invalidates the
software validation.

If you create a file named "C:\msdchem\MSmacros\addon.mac", this macro will automatically be run
when you start up Data Analysis (DA). and within that place the command :
MACRO _exepath$+"EditCompound.mac",go

As you appear to be versed in VBA, then DDE should be easy for you, and will make it fast for any students
and keep their interest.
The DDENAME changes each time you start up the DA, so e.g. export the name to an .ini file using the addon.mac,
the name is in the variable _DDENAME$. So in the DA command line , print _DDENAME$ , will display the current DDENAME of that startup.

Alex

Re: MSDCHEM load data file

Posted: Fri Mar 28, 2014 6:55 pm
by pault
If you're using QEdit, you may want to verify the correct method name is loaded too.

Also I suggest to not edit the "C:\msdchem\MSexe\envinit.mac", as that invalidates the
software validation.

If you create a file named "C:\msdchem\MSmacros\addon.mac", this macro will automatically be run
when you start up Data Analysis (DA). and within that place the command :
MACRO _exepath$+"EditCompound.mac",go

As you appear to be versed in VBA, then DDE should be easy for you, and will make it fast for any students
and keep their interest.
The DDENAME changes each time you start up the DA, so e.g. export the name to an .ini file using the addon.mac,
the name is in the variable _DDENAME$. So in the DA command line , print _DDENAME$ , will display the current DDENAME of that startup.

Alex
You are the real Chemstation guru!
I know that modification of "envinit.mac" macro is not the best way. I will use your suggestion "addon.mac". Cool.

I will be thinking about the DDE variables.

Thank you again.
Tomas