Jump to content

Shutdown window with progress bar and cancel?


Chetwood
 Share

Recommended Posts

I'd like to use the shutdown function in my script and offer the user a chance to interrupt the process in case he's changed his mind. I've tried to use the Progressbar function which would suit me fine but there's no way to cancel it. I just wanted to make sure there's no function I've overlooked before fiddling around and creating my own window that shows a thin progress bar and counts down from 60 seconds offering a cancel button. Thanks.

MultiMakeMKV: batch processing for MakeMKV (Win)MultiShrink: batch processing for DVD ShrinkOffizieller Übersetzer von DVD Shrink deutsch
Link to comment
Share on other sites

On XP, execute the following command line:

<{POST_SNAPBACK}>

Yes, I'd thought about using that too but I won't force ppl to use XP to run my script, they should be able to use 98/W2K as well. So I'm looking for another way to do it. Currently I'm trying to do a simple countdown window without a progress bar but it does not work properly. Edited by Chetwood
MultiMakeMKV: batch processing for MakeMKV (Win)MultiShrink: batch processing for DVD ShrinkOffizieller Übersetzer von DVD Shrink deutsch
Link to comment
Share on other sites

It's not that hard, progressbar, cancel-button, etc., the new GUI-functions are great.

Inspirate yourself by CyberSlug's old code if you're not that good in AutoIt yet.

Here you can find different windows-shutdown-methods or google for a small freeware shutdown-utility and use it.

Good Luck :)

Link to comment
Share on other sites

I'd like to use the shutdown function in my script and offer the user a chance to interrupt the process in case he's changed his mind. I've tried to use the Progressbar function which would suit me fine but there's no way to cancel it. I just wanted to make sure there's no function I've overlooked before fiddling around and creating my own window that shows a thin progress bar and counts down from 60 seconds offering a cancel button. Thanks.

<{POST_SNAPBACK}>

here follow a AutoIt script which can do what you need I hope :)

#include <Constants.au3>

#include <GuiConstants.au3>

$code = $SD_SHUTDOWN

$Elapse= 60000 ; 60 seconds

GUICreate ("shutdown",220,100)

$progress=GUICtrlCreateProgress (10, 10, 200,20)

$cancel=GUICtrlCreateButton ("Cancel",50,50, 100)

$state=GUICtrlCreateLabel ("Windows is shutting down...",50,50, 150)

GuiCtrlSetState (-1, $GUI_HIDE)

GuiSetState()

$start=TimerStart()

Do

  $msg=GuiGetMsg()

  $diff=TimerDiff($start)

  if  $diff>=$elapse then

      Shutdown($code)

      GuiCtrlSetState($cancel, $GUI_HIDE)

      GuiCtrlSetState($state, $GUI_SHOW)

;      exit

  EndIf

  Sleep (100)

  GuiCtrlSetData($progress, $diff*100/$elapse)

 

Until $msg=$GUI_EVENT_CLOSE OR $msg= $cancel

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...