Help with auto naming of report

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

3 posts Page 1 of 1
Good day.

I am a relative newcomer to HPLC. I am using an Agilent 1100 system, autosampler, degasser, thermostatted column and DAD. Software is the standard Chemstation (3??) Revision B.

The current analysis work is identifying Carminic acid in samples from museum collections. Gradient elution using water and ACN each with .1% formic acid. Specimen preparation protocol is leaching/digestion with BF3 in methanol.

Having read through the macro programming guide and Chemstation manuals (standard Agilent) I have not found (perhaps not understood?) if it is possible to create a macro or addition to the report template so that when the sample run report is generated and saved to file, that it uses the sample name as the report title/name.

Is this in fact possible? If so, could someone kindly point me to a resource I can understand which would help or perhaps share the "code"?

More than a bit perplexed over this in Santa Fe.

Best
I don't know Chemstation macro language that well but I think you can access the data file name with the _datafile$ variable.
So you can probably modify the report macro to fit your need.
I wrote this on many years ago, but it should still work.


name copy_txt

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! Retrieve destination directory if passed on command line !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

parameter copy_dir$ default "C:\LABWKS\HPDATA"

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! Declare variables local to this macro !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

local file_name$ ! Current .TXT file name in data file subdirectory
local new_file$ ! New file name for .TXT file
local retvar ! Generic function return variable

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! If destination directory and REPORT.TXT file found - copy!!
!! REPORT.TXT to destination directory as <Data File>.TXT - !!
!! else write error message to current LOGBOOK !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

If FILESTAT(MODE,copy_dir$) > 0 then !! Destination Directory Found
file_name$ = DADataPath$ + DADataFile$ + "\REPORT.TXT"
If FileStat(MODE,file_name$) > 0 Then !! REPORT.TXT File Found
new_file$ = copy_dir$ + "\" + DADataFile$[1:Len(DADataFile$)-1] + "TXT"
copy file_name$,new_file$,DONTASK
Print "Copied File '" + file_name$ + "' to '" + new_file$+"'"
WriteToLogbook "COPY_TXT: Copy Successful"
Else !! REPORT.TXT File NOT Found
WriteToLogbook "COPY_TXT: REPORT.TXT Not Found"
EndIf
Else !! Destination Directory Not Found
WriteToLogbook "COPY_TXT: Destination Path Not Found"
EndIf

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! Return control to system !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

return

endmacro

!-----------------------------------------------------------------


name COPY_TXT_HOOK

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! Check for current view = DA (Data Analysis). If so, add !!
!! 'User Macros' menu choices to Data Analysis view !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

If TabHdrText$(_Config,"Window","CurrentView") = "DA" Then
MenuAdd "User Macros","Copy TXT File","COPY_TXT",,\
"Copy TXT File To Other Destination"
Print "Custom Rpts menu added"
EndIf

EndMacro


!----------------------------------------------------------------------

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! INSTALLATION macro to create and/or append commands to load !!
!! macro COPY_TXT.MAC in USER.MAC file. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

name Install_COPY_TXT

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! Append Macro commands to file USER.MAC to !!
!! add automatic loading of macro COPY_TXT !!
!! during Chemstation initialization !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Open _EXEPATH$ + "USER.MAC" for append as #101
Print #101, ""
Print #101, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
Print #101, "!! Section Added By COPY_TXT.MAC !!"
Print #101, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
Print #101, "Macro "+Chr$(34)+"COPY_TXT.MAC"+Chr$(34)
Print #101, "SETHOOK "+Chr$(34)+"PostDA"+Chr$(34)+","\
+Chr$(34)+"COPY_TXT"+Chr$(34)
Print #101, "SETHOOK "+Chr$(34)+"PreViewMenu"+Chr$(34)+","\
+Chr$(34)+"COPY_TXT_HOOK"+Chr$(34)
Print #101, "Remove Install_COPY_TXT"
Print #101, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
Close #101

Print "COPY_TXT.MAC commands added to USER.MAC"

EndMacro
3 posts Page 1 of 1

Who is online

In total there are 2 users online :: 1 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: Google [Bot] 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