Batch function to load multiples IGOR Unpacked Experiment File (.uxp) files and run function within them

Hello,
I use Igor to record and analyse big set of Data. For each experiment, I have an (.uxp) IGOR Unpacked Experiment File. to run it, I only need to double click on it. Then when all the code is run and the waves are loaded, I can run small script to analyse my data in the Command Window and generate graphs. Unfortunately, if I want to analyse multiples experiment, I have to do it manually every time (open experiment, wait that all the waves are loaded, run my specific script, close it, run another experiment, run my script, close it, ...)

This is why I want to have a function that can do it automatically for me. With that I can run it before going to lunch and then analyse the graphs that have been generated. I was thinking about something like

path:"D:Coding:001_150410A03:"
run"GenerateGraphVariance()"
close waves
path:"D:Coding:001_150410A04:"
run"GenerateGraphVariance()"
close waves
...

But I have the error " A non-existent data folder was referenced while accessing a child data folder"
My experiment is withing the folder 001_15410A03 and is named 001_15410MMP16A03.uxp I also try to add the name but I have the same mistake.
It seems you confuse symbolic paths and file system paths a little...
Anyway.
What about an OS batch file opening the experiment files and an automated execution of your macro (I did not try this!)?
Details can be found in the manual: Chapter IV-7 — Programming Techniques --> Experiment Initialization Procedures p1095 (IV-183) and references there.
The Igor command line might also help p1154 (IV-242). (see http://www.igorexchange.com/node/3695#comment-6322)
The AfterFileOpenHook function might also lead to your goal p1171(IV-259) in combination with a batch file.

I'm not sure, if you can sequentially open experiment files. At least there is no "OpenExperiment" command and "SaveExperiment" has no "See Also" reference...
HJ
Quote:
But I have the error " A non-existent data folder was referenced while accessing a child data folder"


I don't really understand what you are doing that leads to this but you might find the DataFolderRefStatus operation of use to detect if a data folder exists. But you should first read the "Data Folders" help section to get the background on data folders.

Quote:
I'm not sure, if you can sequentially open experiment files. At least there is no "OpenExperiment" command and "SaveExperiment" has no "See Also" reference...


You can open an experiment using the Execute/P operation. See the discussion of LOADFILE in the help section "Operation Queue".

It is possible to sequentially open experiment file. It requires at least intermediate-level Igor programming experience. Choose File->Example Experiments->Programming->Multi-Experiment Process.
Hello,
Thank you for the reply
The best solution in such case is to use:

SetDataFolder CDF
string Firstfolder = CN_DoOpenFileDialog()

Execute/P "NEWEXPERIMENT "
Execute/P "LOADFILE " + Firstfolder

Execute/P "GenerateGraphVariance()"
//
//
string Secondfolder = CN_DoOpenFileDialog()

Execute/P "NEWEXPERIMENT "
Execute/P "LOADFILE " + Secondfolder

Execute/P "GenerateGraphVariance()"

The first and second folder will be keep in memory and igor will automatically wait until the end of the loading before running the experience. The function CN_DoOpenFileDialog() will allow me to get the full path and the name of the folder.
My next problem is to close the experience automatically because Igor asks me if I want to save the experiment before opening the next one, if somebody have an idea let me know.

Best
Quote:
My next problem is to close the experience automatically because Igor asks me if I want to save the experiment before opening the next one, is somebody have an idea let me know.


According to the help, "NEWEXPERIMENT closes the current experiment without saving".

If that does not work, you can use the SaveExperiment operation to save the experiment or you can use the ExperimentModified operation to mark current the experiment as unmodified.
With "SaveExperiment" before "LOAD ...myexperiment.uxp" I have the following message that appears in-between these two commands:

Do you want to save changes to experiment "Untitled"?

So it looks like indeed SaveExperiment close my current experiment without saving but then it opens a new experiment and because of that, when I want to open multiple experiments I have always this question... Any idea how to solve it? I tried with Execute/P "EXPERIMENTMODIFIED 0" before LOADFILE but it has no effect.

With MERGEEXPERIMENT, it is ok but then my root is located in another folder and I don't know how I can change it to have a start my function in the correct point. I try with
setdatafolder root:myexperiment:
but it doesn't work.
Please create a simplified version of what you are doing, something that I can run, and attach it as a procedure file. Please include any necessary instructions for running it.
hrodstein][quote wrote:

It is possible to sequentially open experiment file. It requires at least intermediate-level Igor programming experience. Choose File->Example Experiments->Programming->Multi-Experiment Process.


Thanks a lot for this advice. I manage to make a nice code using this example. Everything works well when I follow the tutorial but when I want to implement my own function I have a problem. It comes from a Hook function in my experiement:

static Function IgorStartOrNewHook(igorApplicationNameStr)
String igorApplicationNameStr

...

End

If I use this function, igor will ask before every new experiment:
Do you want to save change to experiment "Untitled"?

somebody have any idea why? Thanks again

Chris
Sorry for this late suggestion to take a slightly different tack.

With unpacked experiment files, can't you simply load your data files rather than opening the entire experiment? It would seem that you could run code in one experiment to open the relevant files from an experiment, analyze them, save the results and then move to the next experiment's data.
jtigor wrote:
Sorry for this late suggestion to take a slightly different tack.

With unpacked experiment files, can't you simply load your data files rather than opening the entire experiment? It would seem that you could run code in one experiment to open the relevant files from an experiment, analyze them, save the results and then move to the next experiment's data.



Hello, Thanks a lot for all the nice response. I have a code that is almost good thanks to the code coming from the multiple experiment folder. My last problem comes from a callback function but I did another post about that. http://www.igorexchange.com/node/6661#comment-11950

@jtigor, your comment is right and we also do it for some analysis, but but we wanted a basic function that can be used with all the usual function without any modification (mimic what we do by hand). This is why we need to open the whole package that will organize the waves and also run a few function to already process some basic calculation. We can then run another function to plot graphs or keep processing the data.
Hello,
I have solved my problem by adding
"ExperimentModified 0"
at the end of the hook function that was responsible of my problem! Thanks a lot for your reply, best

Christophe