#1 2012-09-14 18:19

Andrew
Senior Member
Registered: 2008-05-22
Posts: 542

Run tasks before logoff, restart, shutdown etc.

Don't know if this has been requested before, but is it possible to add this feature to Shutter? As of now I couldn't find any way of adding the above as the triggering event.

Last edited by Andrew (2012-09-14 18:20)

Offline

#2 2012-09-17 21:17

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,370

Re: Run tasks before logoff, restart, shutdown etc.

This is kind of problematic. When Windows is shutting down or rebooting, it send a message to every running application to be able to react, i.e. save work and close gracefully. But, applications are given a limited amount of time and if Windows doesn't receive a response in that short time frame it will either forcefully shutdown that application or offer user a choice of canceling the shutdown procedure.

It is possible to detect the shutdown procedure and cancel it, then execute all of the necessary actions and re-issue a shutdown request, but this has the potential to result in unexpected behavior and other issues.

Alternatively, I will suggest making a preset in Shutter to shutdown but first execute whatever action you need. Use the preset instead of the usual shutdown button.

Offline

#3 2012-09-18 02:55

Andrew
Senior Member
Registered: 2008-05-22
Posts: 542

Re: Run tasks before logoff, restart, shutdown etc.

den4b wrote:

But, applications are given a limited amount of time and if Windows doesn't receive a response in that short time frame it will either forcefully shutdown that application or offer user a choice of canceling the shutdown procedure.

I actually found that this is true for restart and shutdown, but not so for logoff. While Windows seems to continue with restart and shutdown by forcibly closing apps, it seems logoff behaves differently and can be stuck indefinitely. For example, I had Notepad open with unsaved text, and on attempting to logoff it naturally popped up the "Do you want to save?" dialog. But even though I did nothing, logoff wasn't forced by Windows 7.

Also, Windows forcing restart/shutdown has been introduced only after XP (Vista onwards), so XP can be prevented indefinitely from being restarted/shutdown by apps. Finally, there does seem to be at least one way to prevent restart/shutdown of Vista+, but you know what, I don't think the use case for which I requested this qualifies as being important enough to abuse this feature. Never mind Denis, you can ignore this request and lock this thread. smile

Offline

Board footer

Powered by FluxBB