ibw files import

Dear all, 

I have converted my recordings into ibw files to be able to pool them together. I have more than 100 ibw files produced. If I try to import them one by one, I run into the problem that they all had an initial name that is similar (although I have renamed them during saving). Is there a work around that I import them all with the renamed version? 

Thank you very much in advance!

 

 

This happens because inside the IBW files the data has it's own wave name, which has nothing to do with the file name. The internal wave name might as well be always the same. A simple solution to load all files smoothly is to replace the wave name with the file name, which has to be different. Below script achieves this automatically after the file is loaded per drag and drop into the Igor window:

static Function AfterFileOpenHook(Variable refNum, String file, String pathName, String type, String creator, Variable kind)
    if(kind == 4)
        SVAR name = S_waveNames
        if (strlen(name) > 0)
            Wave work = $StringFromList(0, name)
            Duplicate/O work, $RemoveEnding(file, ".ibw")
            Killwaves/Z work
            KillPath/Z $pathName    // get rid of symbolic path from hook
        endif
    endif
    return 0
End

 

Paste the function into the built in procedure window (type <Control>M to open OR open from windows>procedure windows menu) & recompile the procedure.  Then drag & drop your file onto Igor.

Dear chozo and jtigor, 

You are amazing and saved my time!! Thank you very much and enjoy the rest of the day :)