Optional loading of procedures
chozo
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?
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
August 8, 2010 at 07:08 pm - Permalink
August 9, 2010 at 10:40 am - Permalink
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
August 9, 2010 at 11:52 am - Permalink
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:
"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:
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.
August 10, 2010 at 12:44 pm - Permalink
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.
August 11, 2010 at 03:41 am - Permalink