Macro for Batch Export of CSV in OpenLab ChemStation C.01.10 to a unique archive.

Hello,

Would anyone have a macro for OpenLab ChemStation C.01.10 that could export all “DAD1 A” signals to .CSV in the following format:

In a single spreadsheet showing the time (x-axis) in the first column and in the subsequent columns (B, C, D….) the Y-axis (“DAD1 A” signals) from each sample of that batch.

Something like this:

Is it possible to get a macro like this using a post-run Command / Macro?

Thanks,

Lucas

  • Hi Lucas

    Something like this is possible with a suitable macro but you would probably need to write this yourself or find someone who has macro experience.

    On Disk 2 of the installation media, there are example macro files in the UCL folder, but none of them do exactly what you are looking for.

    /Andy

  • Realize this was a while ago but I just came across it; wrote something similar a while back that processes the data in a given sequence folder - could easily be adapted to run as post-run and post-sequence or also with a specified folder.  Hopefully this can help you out as a starting point;

    name extractDADData
    parameter signalIndex default 1, singleTime default 0, useAverageSingleTime default 0, outputFile$ default "DADData.txt"

    local numberOfDataPoints, numberOfFiles, regName$, tabName$, dataFolder$, line$, a, b, c

    regName$ = "userReg"
    tabName$ = "userData"
    dataFolder$ = DADATAPATH$
    outputFile$ = dataFolder$ + outputFile$

    numberOfFiles = TabHdrVal(_SEQUENCE[1], "SeqTable1", "NumberOfRows")
    If (RegSize(regName$) > 0) Then
      DelReg(regName$)
    EndIf
    NewObj regName$, 1, 0, 0
    NewTab regName$, tabName$
    line$ = ""

    For a = 1 to numberOfFiles
      NewColVal regName$, tabName$, "Time" + Val$(a)
      NewColVal regName$, tabName$, "Absorbance" + Val$(a)
      If (singleTime = 1) Then
        If (a = 1) Then
          line$ = line$ + "Time"
        EndIf
        line$ = line$ + chr$(09) + TabText$(_SEQUENCE[1], "SeqTable1", a, "DataFileName") + ".D"
      Else
        line$ = line$ + "Time =>" + chr$(09) + TabText$(_SEQUENCE[1], "SeqTable1", a, "DataFileName") + ".D"
        If (a < numberOfFiles) Then
          line$ = line$ + chr$(09)
        EndIf
      EndIf

      LoadFile (dataFolder$ + TabText$(_SEQUENCE[1], "SeqTable1", a, "DataFileName") + ".D")
      numberOfDataPoints = DataCols(ChromReg[signalIndex])
      on error print "" !empty trap to avoid different data array sizes; could correct to expand
      For b = 1 to numberOfDataPoints
        If (a = 1) Then
          InsTabRow regName$, tabName$
        EndIf
          SetTabVal regName$, tabName$, b, "Time" + Val$(a), Data(ChromReg[signalIndex], 0, b)
        SetTabVal regName$, tabName$, b, "Absorbance" + Val$(a), Data(ChromReg[signalIndex], 1, b)    
      Next b
    Next a

    OPEN outputFile$ for OUTPUT as #33
    print #33, line$
    line$ = ""
    on error
    For a = 1 to TabHdrVal(regName$, tabName$, "NumberOfRows")
      For b = 1 to TabHdrVal(regName$, tabName$, "NumberOfCol")
        If (singleTime = 0) Then !export all individual signal timepoints
          If (MOD(b, 2) > 0) Then !odd column so time
            If (b = 1) Then
              line$ = Val$(TabVal(regName$, tabName$, a, "Time" + Val$(b - ((b - 1)/2))))
            Else
              line$ = line$ + chr$(09) + Val$(TabVal(regName$, tabName$, a, "Time" + Val$(b - ((b - 1)/2))))
            EndIf
          Else !even so absorbance
            line$ = line$ + chr$(09) + Val$(TabVal(regName$, tabName$, a, "Absorbance" + Val$(b - (b/2))))
          EndIf
        Else !singleTime = 1
          If (b = 1) Then
            If (useAverageSingleTime = 0) Then
              line$ = Val$(TabVal(regName$, tabName$, a, "Time" + Val$(1))) !first timepoint column (fist sample/file)
            Else !compute the average
              averageTimePoint = 0
              For c = 1 to TabHdrVal(regName$, tabName$, "NumberOfCol")
                If (Mod(c, 2) > 0) Then !odd column is time
                  averageTimePoint = averageTimePoint + TabVal(regName$, tabName$, a, "Time" + Val$(c - ((c - 1)/2)))
                EndIf
              Next c
              averageTimePoint = averageTimePoint/((TabHdrVal(regName$, tabName$, "NumberOfCol"))/2)
              line$ = Val$(averageTimePoint)
            EndIf
          Else
            If (MOD(b, 2) = 0) Then !even column for absorbance
              line$ = line$ + chr$(09) + Val$(TabVal(regName$, tabName$, a, "Absorbance" + Val$(b - (b/2))))
            EndIf
          EndIf
        EndIf
      Next b
      print #33, line$
    Next a

    close #33

    endMacro

Was this helpful?