by
TheMac » Mon Jul 27, 2015 7:56 pm
Thanks much Alex! I would not have figured that out myself, I don't think. I'll try messing with the Database Export sometime this week hopefully. It sounds like it could be a time-saver. And yes, it is just to apply new quant method to the datafiles.
I did figure out some nuances (with help from the first suggestion of Alex's from the Tool>DoList, using the QT command), and updated the macro as such:
Code: Select all
Name exporter
!REQUIRES:
! XLSQResNoInteract.mac to be placed in the Addon folder (in MSExe). This is a modified version of XLSQRes.mac.
!need to do while found = 1, when found = 0, there is no next file
found = 1 !found = 0 when Next.mac doesn't have a next file
While found = 1
QT 1,0,`X' !Calculate the report
! 1 = do calculations (create new results file) and generate report
! 0 = screen (default)
!"X" = Excel; report to the file <methodname>.xls which is in the format used by Custom Reports.
TB2INTEGRATE !Integrate the current
!AO_XLSReps `XLSQres.mac'!Turn the data into a spreadsheet, quantitatively
! The original XLSQres.mac shows to screen, the excel file, so I commented out the check if the session was interactive
AO_XLSReps `XLSQresNoInteract.mac'!Turn the data into a spreadsheet, quantitatively
Next.mac !Go to the next file in the folder, also NextFile.mac could be used
endWhile
EndMacro
I don't really know all of the functions available in ChemStation (simply I needed to run samples on GCMS and didn't want to generate everything manually), but I pieced the above portion together. I'm also not sure if any of called files I used were built for us (my team/ supervisor), as I'm not a full-time user for the instrument, but it's doing what I want it to do, now.
If anyone uses the above code, you'll need to make a copy of "XLSQres.mac", and rename the copy of it to "XLSQresNoInteract.mac", then change the code below:
Code: Select all
if check("variable","xlsinteractive")=0 ! don't quit if it is interactive usage.
DdeExecute AO_hChan2, "[Quit]"
endif
to
Code: Select all
!if check("variable","xlsinteractive")=0 ! don't quit if it is interactive usage.
DdeExecute AO_hChan2, "[Quit]"
!endif
, which is just commenting out the check to see if it's interactive, and always closing the Excel file once files are exported.
The reasoning for commenting out the check was so that it always exits excel once excel file is generated. This is because running the macro that I wrote would always show the window, and quanting lots of files, you get lots of windows open, and lots of instances of Excel.
Also if anyone is confused with some of the language, the XLM Macro language is being used for (at least some portion of) the ChemStation macros.
If anyone wants me to attach the excel macros (or just code) that I wrote for once the data was all quanted, let me know.
Thanks!