Generic header skip

Hi,

I am working on some general procedures for loading & graphing XY data based on those found in the IgorPro manual. This works well when the data file just consists of two columns however, it does not when there is a header. Using the Load general text dialogue you can "skip block" repeatedly until you get to the data, is it possible to include this operation in a procedure and tell the loader to skip block until two waves are found? Or would I have to go down the Open and FReadLine route?

I could write a series procedures specific to each type of data I have where I explicitly code how to read headers and columns which I have done for when I want to perform analysis etc but it would be nice to have a general load&graph that I can use to have a quick look at any data type.

Any suggests would be most welcome.

Tom
This is one solution that I have found. I am sure it is not the most elegant and there are certain problems listed at the bottom.

Function LoadAndGraphXY(fileName, pathName) // loading with one set of XY data
    String fileName // Name of file to load or "" to get dialog
    String pathName // Name of path or "" to get dialog
    Variable index=0

    // Load the waves and set the globals
    LoadWave/G/A/D/O/P=$pathName fileName
    if (V_flag==0) // No waves loaded. Perhaps user canceled.
        return -1
    elseif (V_flag>2) // loaded more than two columns of data
        Do
            if ( strlen(StringFromList(index, S_waveNames))==0 ) // No more waves
                break
            endif
           
            wave TestWave=$(StringFromList(index, S_waveNames))
            waveStats/Q TestWave
            if (V_npnts<10) // Fewer than 10 pnts - likely header info
                Killwaves TestWave
            endif
            index+=1
        While(1)
    endif
   
    String sx, sy
   
    if (V_flag > 2)
        sx = StringFromList(index-2, S_waveNames) // S_waveNames stays same after waves killed
        sy = StringFromList(index-1, S_waveNames)
    elseif (V_flag == 2)
        sx = StringFromList(0, S_waveNames) // index from
        sy = StringFromList(1, S_waveNames)
    endif
   
    Wave Wx = $sx // Create wave references.
    Wave Wy = $sy

    String desiredName = ParseFilePath(3, S_fileName, "\\", 0, 0)   // Get prefix for wave names by removing extension from S_fileName
    rename Wx $(desiredName+"_x")
    rename Wy $(desiredName+"_y")

    display Wy vs Wx
   
    // Annotate graph
    Textbox/A=LT "Waves loaded from " + S_fileName
   
    return 0 // Signifies success.
End


So far I have tested this on a number of data formats w/ different headers and it works as the LoadWave/G loads all info from the file including the data but stores the header info as waves too. I therefore check the number of pnts in each wave and have arbitrarily defined that if there are fewer than 10 pnts it must be a header. Obviously this runs into problem if you have header info with > 10 pnts or data with < 10 pnts.

Any suggestions?