System.OnEndSession not working for some reason???

If you have a question or need help, this is the place to be.
Post Reply
max
Posts: 8
Joined: Mon Nov 09, 2009 9:20 am

System.OnEndSession not working for some reason???

Post by max » Mon Nov 09, 2009 9:46 am

I'm using 0.3.7.r1194 on Vista SP2. I'm trying to execute a macro when I shutdown the computer. (the one called shutdown in the picture). When I execute the macro manually, it works fine, but it doesn't get executed on shutdown. Can anybody tell me why, and how to fix it??
image002.jpg
Screenshot
Best Regards

stottle
Plugin Developer
Posts: 636
Joined: Sun Apr 26, 2009 10:59 pm

Re: System.OnEndSession not working for some reason???

Post by stottle » Mon Nov 09, 2009 1:14 pm

Maybe try adding a wait (for a second or two) in the macro?

It looks like the code will send the event, then wait for the event to finish before closing things down. I think that the USB-UIRT plugin is threaded, so it is possible it starts to send the signal but then returns before the signal is sent. If that is the case, the "closing things down" may be happening before/during the USB-UIRT transmit.

Can't say for sure that will work, but it's worth a shot.

Brett

max
Posts: 8
Joined: Mon Nov 09, 2009 9:20 am

Re: System.OnEndSession not working for some reason???

Post by max » Tue Nov 10, 2009 7:30 am

I tried putting a 2 sec delay in the end of the macro, but it has no effect at all. It seems like the macro is not even being triggered by the event "System.OnEndSession", but I can't figure out why. Any suggestions any one?????
Best Regards

Max

stottle
Plugin Developer
Posts: 636
Joined: Sun Apr 26, 2009 10:59 pm

Re: System.OnEndSession not working for some reason???

Post by stottle » Tue Nov 10, 2009 10:32 am

Are you sure the event is firing in the first place? Does it appear in the log?

That event is tied to the wx event EVT_END_SESSION, and checking this page, that event should be triggered when you log out of windows. Are you looking for an event that runs when EG is closing?

Brett

max
Posts: 8
Joined: Mon Nov 09, 2009 9:20 am

Re: System.OnEndSession not working for some reason???

Post by max » Fri Nov 13, 2009 2:15 am

Well I can't see it because the computer is shutting down, and the log gets cleared, so I don't know. But Yes I'm looking for some event, that can trigger when the I shutdown the computer or secondary when the application is closed, but I'd prefer the shutdown event, since I could otherwise trigger the macro If i restarted the application.

But anything will do at the moment:-)

The System.OnEndSession was described in an other post here, so I tried it, but as noted it doesn't seem to work for some reason I that I can't figure out.

Any suggestions anyone??????
Best Regards

Max

max
Posts: 8
Joined: Mon Nov 09, 2009 9:20 am

Re: System.OnEndSession not working for some reason???

Post by max » Mon Nov 16, 2009 5:38 pm

Perhaps I should reformulate the question.

I'm looking for an event, that I can use to trigger a macro (that can turn off some stuff) when I turn off my computer. The event should occur when EventGhost exits or preferably when the computer shuts down.

I've tried using System.OnEndSession without success.

Is this possible???????????
Best Regards

Max

stottle
Plugin Developer
Posts: 636
Joined: Sun Apr 26, 2009 10:59 pm

Re: System.OnEndSession not working for some reason???

Post by stottle » Mon Nov 16, 2009 7:51 pm

You could try running EG with the -debug switch. That will write out the log (plus some extra messages) to a file. Then, even if you can't see the messages in the EG screen, you can see what events occur from the log text file.

Brett

max
Posts: 8
Joined: Mon Nov 09, 2009 9:20 am

Re: System.OnEndSession not working for some reason???

Post by max » Sat Nov 21, 2009 5:21 pm

Thank you very much for the advice Stottle (though I probably should have thought of that as the first thing :) ). After playing a bit Around with the events in the debug log I found that:

Main.OnClose - will fire when the app is closed. and

Main.OnEndSession - will fire when Vista shuts down.

Hopes this helps someone else :D
Best Regards

Max

blaher
Experienced User
Posts: 485
Joined: Thu Nov 17, 2011 1:27 am

Re: System.OnEndSession not working for some reason???

Post by blaher » Wed Jul 25, 2012 4:07 am

Main.OnEndSession - will fire when Vista shuts down.

Hopes this helps someone else :D
Thank you, it did with Windows 7 as well.

Post Reply