Optional loading of procedures

Is there a way to make Igor optionally load and compile procedures when starting (without messing with the procedures folder)?
I have my data acquisition procedures loaded all the time, but since the main procedure is generating content via IgorStartOrNewHook this renders Igor into a mess for normal work (e.g. in another instance). Additionally I want to provide a fall-back option (i.e. loading an older version).

I tried to achieve this with a shortcut and the OpenProc command and also with an unpacked experiment file. The shortcut option loads the procedure somehow but doesn't compile? The experiment template + afterfileloadhook works, but is cluttered because there are so many additional infos included (packed template is even worse, because I can't change anything without Igor, e.g. changing the path with notepad). Is there a trick where I can get this done with just a single file where a best just the procedure info is written?
chozo wrote:
Is there a way to make Igor optionally load and compile procedures when starting (without messing with the procedures folder)? ...


I am still not quite sure what you are trying to do. In particular, I am not sure what order you want to be loading (including) and off-loading procedures.

Can you give a basic example? It may be similar to what I set out to accomplish with this package and what I am eventually going to fold together with this package. Alternatively, it may be as simple as using the #include statements properly in the procedure window of any given experiment.

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
I want the same behavior as if I would put the particular procedure in the Igor procedures folder (procedure loading and executing hidden, getting some hook function done) but without doing so. Because putting a procedure in the folder dont give me the option to omit loading or to load another version of the procedure.
chozo wrote:
I want the same behavior as if I would put the particular procedure in the Igor procedures folder (procedure loading and executing hidden, getting some hook function done) but without doing so. Because putting a procedure in the folder dont give me the option to omit loading or to load another version of the procedure.


You probably want to put your procedures in the User Procedures folder and use the syntax #include "MyProcedure", version>=xx. Should you have two procedures that have the same name but differ in version numbers, you will have to open the desired version of the procedure file manually. Automatically loading/unloading/reloading of a procedure file based on version information is otherwise something you would have to program yourself. Using hook functions to run/re-run events during this process adds yet another layer of complication.

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
Quote:
Is there a way to make Igor optionally load and compile procedures when starting?


You can create a package that you manually load using a menu item. This is how Igor packages work.

To do this, you must first create an Igor procedure file, e.g., "My Package Loader.ipf", containing the definition of your menu item. For example:

Menu "Macros"
    "Load My Package", /Q, Execute/P/Q/Z "INSERTINCLUDE \"My Package\"";Execute/P/Q/Z "COMPILEPROCEDURES "
End


This file must be placed in the Igor Procedures folder so that it always loads - otherwise your menu item would never appear.

Now put a procedure file, e.g., "My Package.ipf", in the User Procedures folder so that it will be found by the INSERTINCLUDE statement above.

I have attached sample "My Package Loader.ipf" and "My Package.ipf" files.

For WaveMetrics packages, the menu items are defined in WMMenus.ipf. Since this file is an independent module, to see it you must execute:
SetIgorOption IndependentModuleDev=1


NOTE: You might be able to devise a complex scheme to dynamically load code beyond the technique described above. Chances are it will not quite work but even if it does, you will be skating on thin ice. You would be using "features" that we did not envision which means that they could be inadvertently broken by changes we make. For these reasons, I would avoid devising complex and fragile schemes and stick with conventionl methods.
My Package Loader.ipf (348 bytes) My Package.ipf (532 bytes)
Thanks! I will look into it. I knew this would be difficult. Since these techniques are risky I may step back from using it in the end, but its always a good thing to learn more about new igor programming techniques.
I thought the may be a simple way like defining a simple shortcut such as ".../igor.exe -proc:loadthisthing.ipf" or so. I try to stay away from clumsy workarounds.