Jump to content
Sign in to follow this  

Run on Shutdown

Recommended Posts


I have a working code except for the fact that when the shutdown is intercepted, the shutdown is aborted, but the run function won't work. The whole script exits before it can be called. Is the computer shutting down the script before the abort function is called?


GUIRegisterMsg($WM_QUERYENDSESSION, "Intercept_Shutdown")



Global $b_ShutdownInitiated = False

While 1

If $b_ShutdownInitiated = True Then

RunWait('"' & @ComSpec & '" \c shutdown -a', '', @SW_HIDE)

Run("C:\Documents and Settings\All Users\Shutdown\Run On Shutdown.exe")




Func Intercept_Shutdown()

$b_ShutdownInitiated = True

Return False

EndFunc ;==>Intercept_Shutdown

Edited by dantay9

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post

Link to post
Share on other sites

I think it works only if the shutdown process is scheduled, like shutdown -t 60, so shutdown -a just aborts it.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this