BeforeExperimentSaveHook "weird" behavior?

Hi!

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


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 don't know why the globals are created (and never subsequently removed). I see the same thing in some of my cases. The outcome is harmless and I mostly leave them alone.

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
Thanks for the reply.

I was hoping that maybe also someone from Wavemetrics could comment on this? Thanks!

Gregor
The BeforeExperimentHook is being restored during experiment loading using a command like:
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:
SetIgorHook returns information in the following variables:
S_info: Semicolon-separated list of all current hook functions associated with hookType, listed in the order in which they are called. As of Igor 6.13 the S_info includes the full independent module paths (e.g.,"ProcGlobal#MyMenuHook;MyIM#MyModule#MyMenuHook;").


--Jim Prouty
Software Engineer, WaveMetrics, Inc.
Thanks Jim for the explanation! I was just curious to know what is actually going on ...

Cheers,
Gregor