Opening multiple files

Hello everyone. I'm new so please be gentle ;^)
I am also new to Igor and have zero programming experience, so I'm finding it all a bit challenging.
I run experiments that give me loads of .itx files which I then want to view on a graph, overlaying the traces so I can compare them.
At the moment, my inferior knowledge means that I have to open each one individually, rename it and then make a table and append it to a graph.
I gather that there are ways around this but I am totally out of my depth when I've read previous threads on this - I have NO IDEA how to modify a procedure file to match my input strings or whatever, so I'm throwing myself on the kindness of strangers i.e. you lovely folks.
Thanks.

Do you have the itx-files on disc? Are they named differently? If yes you can (at least in Igor 7 and on Mac) drag and drop the files onto the command line. You might need to click a few times ok to load them.

Note that you don't need a table first to display a graph. Make sure you use the Data Browser. You can also drag waves from there onto existing graphs to append the trace.
Welcome to the forum. Most of us started as beginner so do not worry.

Please read the chapters about programming in the Igor manual. I know it's many pages but it really pays off.

I assume you are using "Menu Igor", e.g., loading a file is done by clicking on 'Data -> Load Waves'. While you work like this, keep a sharp eye on the history area ('Windows -> Command Window'). Repeat your work a couple of times and see what is printed there. One you recognize a pattern, you can try to operate Igor from that window. Then you are almost programming. Once you are familiar with this, copy one of these repeating sections into a procedure file ('Windows -> Procedure Windows -> Procedure Window'). It should somehow look like this.
function LoadAndDisplay()
    Make Loaded=(p/42)^2 // Dummy for the loading part
    Rename Loaded Stored
    Wave Stored
    Appendtograph Stored
End


You can run it from the command window via LoadAndDisplay().

As you might experience, this code will not work directly. It needs an already present (empty) graph. You can create this one by running  display in the command window. Delete potentially created waves called "Loaded" or "Stored" using the data browser after this test.
Further, the code will only work once, since the wave "Stored" is already in existence after a successful execution. At this point you will need to name your waves in a unique way. I would recommend that you try to get to this point for now, since I would have to cite the manual a lot from here on. You may read the manual concerning the $ operator. It basically converts a text into a variable name and is the key to the next steps.

We will help answering further questions later on (and certainly also questions along the way).

HJ
Thank you very much for your excellent help both! I think for the moment, I might stick with the 'drag and drop' option as I really have tried reading the manual, and I had a go with the procedure you posted, but I'm too much of a novice to get very far :^). If you can imagine trying to teach your cat to do this, that's about the level that I'm at.
Although - with the 'drag and drop' option, is there any way to tell Igor to keep the file names rather than it wanting to name each one 'w_ABR' and then me having to rename it. Sorry to be a pain!
Silver Girl wrote:
Thank you very much for your excellent help both! I think for the moment, I might stick with the 'drag and drop' option as I really have tried reading the manual, and I had a go with the procedure you posted, but I'm too much of a novice to get very far :^). If you can imagine trying to teach your cat to do this, that's about the level that I'm at.
Although - with the 'drag and drop' option, is there any way to tell Igor to keep the file names rather than it wanting to name each one 'w_ABR' and then me having to rename it. Sorry to be a pain!


If I've understood correctly, you're loading multiple igor text files (type itx), each of which produces a single wave that's named w_ABR.

A typical approach for loading multiple text files in a procedure would be to give the user a dialog to select the files (open), loop though the filenames (do… while), loading each one (loadwave) and assigning a wave name based on the file name. There’s probably a code snippet somewhere around here that does something like that.

itx files are a special case, because the name of the loaded wave is set within the itx file. In that case, you can load the wave and then rename it before loading the next.

If you load an itx file by selecting Data – load waves – load waves… and then use the data browser to look for waves and strings you should see the wave you have loaded. You can also find the name of the loaded wave in S_waveNames and the file name in S_fileName.

You can clean up the file name a bit like this:

S_fileName = parsefilepath(3, S_fileName, ":", 0,0)

Then get the name of the loaded wave without the semicolon at the end:

S_wave= StringFromList(0,s_wavenames)

and rename

Wave w=$S_wave
Rename w $S_fileName


I've attached a generic file loader that I quickly adapted to load itx files. Maybe it will do what you need.
GTFloader_itx.ipf
Ahhh...that 5.21kb of code has just saved my life...you guys cannot believe exactly how grateful I am for your help. In fact, I did have a tiny cry when I realised that it did EXACTLY what I needed and that I was no longer looking at loading and individually renaming 8993 files.
And you'll all be so proud - I managed to work out that the code needed to go into a procedure window and that I needed to save it as a global procedure file. And it still works! yeah!
If any of you find yourselves in Sheffield in the UK, the beers are on me.
Many, many thanks.