Forum Discussion

SarahEdwards's avatar
SarahEdwards
Contributor
8 years ago
Solved

Calling a script from an Event Handler

So, I just learned about Event Handlers. What amazing things!   However, I'd like to send an email from the OnLogError event. My handler script is as follows:   function GeneralEvents_OnLogError...
  • tristaanogre's avatar
    8 years ago

    PackResults I'm assuming is in a different script unit than your event handler.  So... this is a two-step thingie

    1) Add at the top of the unit for the event handler the following

     

    //USEUNIT MyScriptUnit

    where "MyScriptUnit" is the code unit containing PackResults

     

    2) Change your code to:

    function GeneralEvents_OnLogError(Sender, LogParams)
    {
    Log.Picture(Sys.Desktop.Picture(), "Image of the whole screen", "", pmHigher);
    MyScriptUnit.PackResults(); //This is the name of my email function.
    }