automated data loading

I've searched a lot of the existing posts, but still have not been able to find my answer. I'm trying to load a general text file that has 7 columns. I would like to append the file name to the column title. I know I need to use

LoadWave /D/G/W

which brings up the dialog box with all the column names in their proper place. But now how to I add the file name (minus .txt) and save?

Thanks!
It might be better to use the file name to create a new data folder and load the waves with their simple names into the data folder. This will eventually give you a bunch of data folders containing runs consisting of same-named waves. This is easier to work with programmatically. For information on data folders, execute:
DisplayHelpTopic "Data Folders"


Assuming that you don't want to use data folders and want to stick with your original idea . . .

This post shows how to get the file name before you call LoadWave and how to name a loaded wave using the file name.

If you know the names of the columns in the file in advance, you can extend this by extending the columnInfo variable:
    String columnInfo=""
    String item
    sprintf item, "N='Column0_%s';", wName
    columnInfo += item
    sprintf item, "N='Column1_%s';", wName
    columnInfo += item


If you don't know the column names in advance it gets more complicated. You have to write code to determine the column names from the file.

See the documentation for the LoadWave /B flag which allows you to programmatically specify wave names.
Loadwave will store the filename in the string S_Filename. You can then use removeending to remove the ".txt" file extension. The string list s_wavenames contains the names of the waves loaded from the file.

string string0
wave wave0 = $(stringfromlist(0, s_wavenames))   //first wave loaded from the file
duplicate/o wave0 , $(removeending(s_filename, ".txt"))

killwaves wave0


The above "should" rename the first wave loaded as the name of the file, assuming I didn't make mistakes. You can modify it from here to deal with the other 6 waves.
The problem with renaming the wave after loading comes if there is already a wave with that name. If there is no likelihood of that, the rename approach is fine.

The LoadWave /B approach permits overwriting existing waves which may or may not be desirable.
Thanks--it works now!

Now that I have an automated loader for one file, I need to make a loop to load all files in a specified folder. If anyone has a link to a topic at their fingertips that already explains this, I would much appreciate it.
debarry wrote:
Now that I have an automated loader for one file, I need to make a loop to load all files in a specified folder. If anyone has a link to a topic at their fingertips that already explains this, I would much appreciate it.


Execute:
DisplayHelpTopic "Loading Waves Using Igor Procedures"


and read through the section entitled "Loading All of the Files in a Folder".
debarry wrote:
Now that I have an automated loader for one file, I need to make a loop to load all files in a specified folder. If anyone has a link to a topic at their fingertips that already explains this, I would much appreciate it.


This might be of some help:
http://www.igorexchange.com/node/1720