Sign in to follow this  
Followers 0
Mitt

Launch Windows XP shutdown dialog

5 posts in this topic

#1 ·  Posted (edited)

I am trying to write a script that prompts the user with a message box warning them about saving their files to a removable disk before shutting down the computer and need a way to launch the shutdown dialog (the standard shutdown screen from the shutdown button on the start menu) after the user presses ok to the message box. Is there a way to call that shutdown dialog from within and AutoIt script? The one thing I found was a way to launch the dialog from VBscript or VB.net

vb script:
<script language="VBScript">
    function fnShellShutdownWindowsVB()
        dim objShell
        
        set objShell = CreateObject("Shell.Application")
        objShell.ShutdownWindows

        set objShell = nothing
    end function
 </script>

Visual Basic:

Private Sub fnShellShutdownWindowsVB()
    Dim objShell As Shell
    
    Set objShell = New Shell
    objShell.ShutdownWindows

    Set objShell = Nothing
End Sub
Edited by Mitt

Share this post


Link to post
Share on other sites



Func fnShellShutdownWindowsVB()
    Local $objShell = ObjCreate("Shell.Application")
    $objShell.ShutdownWindows
EndFunc

Did you ever think of that?

Share this post


Link to post
Share on other sites

Func fnShellShutdownWindowsVB()
    Local $objShell = ObjCreate("Shell.Application")
    $objShell.ShutdownWindows
EndFunc

Did you ever think of that?

Or you could use the inbuilt function ShutDown.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Richard, no I didn't think of that. I am very new to AutoIt and don't know all the ins and outs, hence the reason I asked in the forums. Thank you for your reply, although a little it seemed to be a little rude. You don't have to be a prick when answering questions that might be simple to you.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Martin, Shutdown() doesn't invoke the shutdown dialog. That was what the user asked for. :)

Mitt, sorry for the way I answered earlier. I'm usually a nice guy. It's nothing against you.

Edited by Richard Robertson

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  
Followers 0