Jump to content
Sign in to follow this  
Chetwood

Shutdown window with progress bar and cancel?

Recommended Posts

Chetwood

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

Share this post


Link to post
Share on other sites
this-is-me

On XP, execute the following command line:

shutdown -s -t 60

and cancel with

shutdown -a

otherwise, you will have to go with guicreate.


Who else would I be?

Share this post


Link to post
Share on other sites
Chetwood

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

Share this post


Link to post
Share on other sites
sPeziFisH

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 :)

Share this post


Link to post
Share on other sites
jpm

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

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.