BeforeExperimentSaveHook "weird" behavior?
gregorK
I am using an Igor hook to print some information when a user saves an experiment. Here is a minimum working example:
Function ExperimentSaveHook(rN,fileName,path,type,creator,kind)
Variable rN,kind
String fileName,path,type,creator
print "yes"
End
Variable rN,kind
String fileName,path,type,creator
print "yes"
End
I start the hook with
SetIgorHook BeforeExperimentSaveHook=ExperimentSaveHook
within another function, therefore no global string is created at this point (S_info). Now when one saves the experiment "yes" is printed in the history as you would expect. What I do not understand is, that the next time one loads the same experiment one global variable (V_flag) and one global string (S_info) appear. V_flag equals 0, whereas S_info is the list of IgorHook Functions (in this case "ProcGlobal#ExperimentSaveHook;").Why are these globals appearing and what should I do to stop them from reappearing each time one opens the experiment file? I am running IgorPro 6.32A on WindowsXP.
Thanks for any clarification and help!
Cheers,
Gregor
I think your ExperimentSaveHook function needs a return 0 or return 1 at the end to be proper.
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
November 14, 2013 at 08:22 am - Permalink
I was hoping that maybe also someone from Wavemetrics could comment on this? Thanks!
Gregor
November 15, 2013 at 05:31 am - Permalink
Execute/Q/Z SelectString(NumberByKey("IGORVERS",IgorInfo(0)) >= 5, "", "SetIgorHook BeforeExperimentHook=ProcGlobal#ExperimentSaveHook")
The Execute operation leaves behind a V_Flag in the root data folder.
The SetIgorHook operation always sets S_Info to the list of hook functions for the specified hook type (BeforeExperimentHook, in this case), as per the help file:
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
November 15, 2013 at 04:19 pm - Permalink
Cheers,
Gregor
November 16, 2013 at 12:54 am - Permalink