mbouchard Posted June 13, 2005 Share Posted June 13, 2005 I am currently working on installing an App via GPO scripting and wanted to have a progress bar so people would know that something was being installed and would have an indicator that something was going on so that they would not turn off/reboot their pc's which has happened. I came up with the following code and was wondering if someone might have a better way of doing this and if it is possible to display Minutes:Seconds instead of just minutes. Thanks. ;Hide the Tool Tray icon (will still display for 750 milliseconds) AutoItSetOption("TrayIconHide", 1);1 = Hide Icon ;Turn on progress display. ProgressOn("Installing Everdream", "This is a one time process that will take about 5 minutes.") For $m = 5 to 0 step -1 For $i = 100 to 0 step -1 ProgressSet( $i, $m & " minutes until install is completed." & @LF & @LF & "Please be patient and do not reboot your PC") sleep(592);close to making 100 to 0 = 60 seconds when counting down. Next Next ProgressSet(0 , "Done", "Finished Install") sleep(2000) ProgressOff() Link to comment Share on other sites More sharing options...
philo Posted June 13, 2005 Share Posted June 13, 2005 This one works for me Auto It Ruels Link to comment Share on other sites More sharing options...
Valuater Posted June 13, 2005 Share Posted June 13, 2005 Normally on installs i see... "Less than 1 Minute remaining..." you could ad this very easily Link to comment Share on other sites More sharing options...
mbouchard Posted June 13, 2005 Author Share Posted June 13, 2005 (edited) Thanks, I just wanted to check and see if there was a better/cleaner way of doing it. Will see about adding less than 1 min in. BTW, is there any way to expand the Progress window? I.e. to allow for more text above the progress indicator? Or to change from bold to normal text? Thanks again. Edited June 13, 2005 by mbouchard Link to comment Share on other sites More sharing options...
Valuater Posted June 13, 2005 Share Posted June 13, 2005 (edited) i do not believe you can change that text... but your upper text does not fit into the box... its too long and.. as an idea... because 5 minutes is a long time to wait I would consider putting the window in the upper left corner/area so the user can see the install (everything is always in the middle of the screen) and if the user does not see any of the install... you may wish to put up screens every-so-often that promotes the product-uses-???? just an idea... Hope it helps 8) Edited June 13, 2005 by Valuater Link to comment Share on other sites More sharing options...
AutoChris Posted June 13, 2005 Share Posted June 13, 2005 I made a similar script which automatically shuts down computers at 11pm every night. It counts down in minutes and shows the seconds as well. Be sure to comment out the "Shutdown" function before running it, or else kill the process before it finishes its timeout.Dim $i, $n, $x, $min, $sec, $timeCheck()Func Check(); While 1; If @Hour = 23 And @Min <= 9 Then Turnoff(); Sleep(180000); WEnd Turnoff() ;added this line so you do not have to wait until 11pm to test itEndFuncFunc Turnoff() SplashTextOn("Shutting Down", "The Computer is Shutting Down", -1, 40, -1, -1, 1, "arial", 24, 500) For $n = 1 to 3 For $i = 1 to 3 Run(@ComSpec & " /c echo " & Chr(7), "", @SW_HIDE) Sleep(250) Next Sleep(500) Next SplashOff() HotKeySet("{Esc}", "Cancel") ProgressOn("Shutdown", "Shutting Down - Press Esc to cancel", "Shutting Down") For $i = 1 to 300 step 1 Sleep(1000) ;>>> Define variables for min, sec $x= 300-$i $x= $x/60 $min= StringLeft($x, 1) $sec= StringTrimLeft($x, 1) $sec= $sec*60 $sec= Round($sec);>>> Set the progress meter to move 1/3 normal speed <to reach 300% = 300 seconds> ProgressSet( $i/3, $min & " Minutes and " & $sec & " Seconds to Shutdown", "Shutting Down - Press Esc to cancel") If StringRight($sec, 1) = 0 OR StringRight($sec, 1) = 5 Then Run(@ComSpec & " /c echo " & Chr(7), "", @SW_HIDE) Next ProgressSet(0 , "Shutting Down", "Shutting Down...") Sleep(1000) ProgressOff() HotKeySet("{Esc}") Shutdown(13) Check()EndFuncFunc Cancel() HotKeySet("{Esc}") ProgressOff() Msgbox(0, "Canceled", "Shutdown Canceled", 3) Sleep(600000) Check()EndFuncFunc Nap() Sleep(600000) Check()EndFunc Link to comment Share on other sites More sharing options...
mbouchard Posted June 13, 2005 Author Share Posted June 13, 2005 Valuater, the script that is calling the progress bar is running as a machine startup script. If the user did what they were supposed to do, i.e. reboot when they leave for the day, I would not have to worry about showing a progress. But since the script is running at startup, they don't even see the crtl/Alt/del screen. SerialKiller, Thanks, I will take a look at that, looks like what I am wanting to do. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now