If I do that I would make it hard to continue measuring after saving, currently you can also save during data acquisition and this External cache Thanks both for your I'm no expert on Hook Functions, but couldn't you simply run your cleanup function every time before an experiment is saved Otherwise, return 1 to indicate that your function is taking over what Igor normally does. In this case, return 0 from the hook functions and, if I am not mistaken, Igor will also prompt the user whether to save an "Untitled" experiment or not. Finally, you could invert the the cmpstr(.) portion of your test and only do the unbidden save if a user had already saved the experiment with a real name. have a CleanUpNeeded() function that returns 0 or 1) and then ask the user for permission. "Do you want to save this cleaned-up experiment?"Īlternatively, I might think that you could check whether cleanup is needed (e.g. ) segment support a DoPrompt call with the Yes/No request? In other wordsĭoPrompt. With some clever programming, you could even sense whether the user had stored a favorite template set that should be restored in place of the default. The downsides are that you move the overhead (time) now taken by the DoCleanup() function to a set of functions akin to WriteToCache() and ReadFromCache() and that you have to decide where the cache file is going to be stored for your package.Īs for saving the experiment without the informed consent of the user. The one added benefit is that you can store a default cache file that can always be restored regardless of how the experiment "went down" (again in a manner of speaking). Have you considered the benefits to have the cache files stored outside of the experiment? The intent is to avoid any need to have to clean up the experiment (e.g. I assume the DoCleanup() is the function to dump the trash in a manner of speaking. Now that experiment resaving takes a lot of time and is potentially dangerous as I'm doing it without the users informed consent. to not make it even more difficult to understand. I'm skipping over BeforeExperimentSaveHook and IgorStartOrNewHook/etc. Which does the cleanup and resaves the experiment again if required in IgorBeforeNewHook but only removes and stops stuff in IgorQuitHook. ![]() Static Function IgorQuitHook (igorApplicationNameStr ) If ( !modifiedBefore & modifiedAfter & cmpstr ( "Untitled", IgorInfo ( 1 ) ) ) Static Function IgorBeforeNewHook (igorApplicationNameStr ) / Revert Experiment, or Open Experiment menu items in the File menu. / Called before a new experiment is opened, in response to the New Experiment, Wide-Angle Neutron Spin Echo Spectroscopy.The remaining text is the structure-based skeleton code for a slider control. Here we’ve added only the value set code which re-computes a single-tone audio wave whose frequency is controlled by the slider value as a percentage of the 44100 Hz sampling frequency. Add your custom code in this dialog or afterwards in the procedure window. Set up the control's size and other properties using the dialog:Ĭlick on the New (Procedure) button to add code which will execute when the slider is set to a new value:Ī skeleton procedure is created for you. Select the graph or panel you want to add the control to, and choose "Add Control" from the Graph or Panel menu: ![]() The Add/Modify Control dialog makes this relatively simple. You can add many kinds of controls to Igor’s control panels or graphs and implement their behavior by writing “control procedures” for them.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |