fmen Posted August 30, 2006 Share Posted August 30, 2006 OK, from bits and pieces I found on this board, I put together a really simple shutdown timer. It can easily be modified to perform whatever task you want prior to shutting down---or not. What I like about it is it's sheer simplicity. All you need are two mouse clicks--one to choose the shutdown time and one to start the countdown. You can also use the keyboard if you like. Press <ESC> to abort. I hope some of you will try it. Any feedback to make it better would be appreciated. expandcollapse popup#include <GUIConstants.au3> #include <_IsPressed.au3> Opt("WinTitleMatchMode", 4) Global $slider1, $min, $n, $last, $sec HotKeySet("{ESC}", "Stop") If @error = 1 Then Stop() EndIf $Slider = GUICreate("Slide Bar To Choose Time ", 225, 100) ; Slider to start at 0 GUISetBkColor (123) GuiSetState() $slider1 = GuiCtrlCreateSlider (10,10,200,20) GUICtrlSetLimit($slider1,360,0) $button = GUICtrlCreateButton ("Start Timer",75,70,70,20) GUISetState() GUICtrlSetData($slider1,0); Slider to start at 0. ;.................................................................. While 1 Sleep(10) If _IsPressed('0D') = 1 Then Call ("CR") ;1B=enter $min = GuiCtrlRead($slider1) If $last = $min Then Else WinSetTitle ( "handle=" & $Slider , "", $min & " Min Or " & Round($min/60, 2) &" Hr To Go" ) $last = $min EndIf $n = GUIGetMsg () If $n = $button Then GuiDelete () Call ("Progress") EndIf Wend ;................................................................. Func Progress() $hr = $min/60 $sec = $min * 60 $step = 100 / $sec ProgressOn("Progress Meter", "ShutDown Time Requested: " & Round($min/60, 1) & " Hours", "0 Mins Gone So Far") For $i = 0 To 100 Step $step $sec = $sec - 1 $min = round($min - 1/60, 2) Sleep(1000) If $min > 2 Then ProgressSet($i, $min & " minutes left before shutdown." & @CRLF & @CRLF & "Escape to abort © by Konspirator") Else ProgressSet($i, $sec & " seconds left before shutdown." & @CRLF & @CRLF & "Escape to abort © by Konspirator") EndIf Next Shutdown(9) Exit EndFunc;==>Progress Func Stop() Exit 0 EndFunc ;==>Stop Func CR() sleep (100) send ("{tab}{left}{tab 2}{enter}") EndFunc ;==>CR Link to comment Share on other sites More sharing options...
spyrorocks Posted August 30, 2006 Share Posted August 30, 2006 hmm looks good. (Why did you try to put javascript in your sub-title?) [center] My Projects: Online AutoIt Compiler - AutoForum - AutoGuestbook - AutoIt Web-based Auto Installer - Pure AutoIt Zipping Functions - ConfuseGen - MindReader - P2PChat[/center] Link to comment Share on other sites More sharing options...
fmen Posted August 30, 2006 Author Share Posted August 30, 2006 hmm looks good.(Why did you try to put javascript in your sub-title?)Thanks.I stupidly added a smiley javascript in the subtitle. Tried to edit it out but couldn't. Link to comment Share on other sites More sharing options...
fmen Posted September 6, 2006 Author Share Posted September 6, 2006 (edited) I've been trying to make the progressbar so that the window can be moved and not always on top but nothing I do seems to work.ProgressOn("Progress Meter", "ShutDown Time Requested: " & Round($min/60, 1) & " Hours", "0 Mins Gone So Far, -1, -1, 18")This should make the progressbar moveable, according to the help file. It doesn't.Can someone help?Thanks in advance. Edited September 6, 2006 by fmen Link to comment Share on other sites More sharing options...
GaryFrost Posted September 6, 2006 Share Posted September 6, 2006 I've been trying to make the progressbar so that the window can be moved and not always on top but nothing I do seems to work. ProgressOn("Progress Meter", "ShutDown Time Requested: " & Round($min/60, 1) & " Hours", "0 Mins Gone So Far, -1, -1, 18") This should make the progressbar moveable, according to the help file. It doesn't. Can someone help? Thanks in advance. quotes in the wrong place. ProgressOn("Progress Meter", "ShutDown Time Requested: " & Round($min/60, 1) & " Hours", "0 Mins Gone So Far", -1, -1, 18) SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
fmen Posted September 6, 2006 Author Share Posted September 6, 2006 quotes in the wrong place. ProgressOn("Progress Meter", "ShutDown Time Requested: " & Round($min/60, 1) & " Hours", "0 Mins Gone So Far", -1, -1, 18) Wow, that was fast. Thank you so much! It works. I'ma push my luck but I have to ask. Do you know of any way that the progressbar can be minimized to tray? Link to comment Share on other sites More sharing options...
fmen Posted September 6, 2006 Author Share Posted September 6, 2006 OK, I know no one cares much about my simple little program, but as a non-coder I am proud of piecing together this stuff. None of it is original, nevertheless..... I found a way to toggle the progressbar off and on. I didn't know that you could treat a progressbar like a gui.: Func Hide() $state = WinGetState("Progress Meter", "") If BitAND($state, 2) Then WinSetState("Progress Meter", "", @SW_HIDE) Else WinSetState("Progress Meter", "", @SW_SHOW) EndIf EndFunc ;==>HideoÝ÷ ØÚ0Êjy¨½æ§vá׿²0¦º ë,mªð)^×(º{lv'¶!º×hÂ{bæ®¶sb6æ6ÇVFRfÇC´uT6öç7FçG2æS2fwC°¢6æ6ÇVFRfÇCµô5&W76VBæS2fwC°¤÷BgV÷CµvåFFÆTÖF6ÖöFRgV÷C²ÂB¤vÆö&Âb33c·6ÆFW#Âb33c¶ÖâÂb33c¶âÂb33c¶Æ7BÂb33c·6V0 ¤÷D¶W6WBgV÷Cµâ·gV÷C²ÂgV÷Cµ7F÷gV÷C²¤÷F¶W6WBgV÷Cµâ·¢gV÷C²ÂgV÷C´FRgV÷C² ¤bW'&÷"ÒFVà¢7F÷¤VæD` ¢b33cµ6ÆFW"ÒuT7&VFRgV÷Cµ6ÆFR&"Fò6ö÷6RFÖRgV÷C²Â##R²6ÆFW"Fò7F'BB¤uT6WD&´6öÆ÷"#2¤wV6WE7FFR ¢b33c·6ÆFW#ÒwV7G&Ä7&VFU6ÆFW"ÃÃ#Ã# ¤uT7G&Å6WDÆÖBb33c·6ÆFW#Ã3câb33c¶'WGFöâÒuT7G&Ä7&VFT'WGFöâgV÷Cµ7F'BFÖW"gV÷C²ÃsRÃsÃsÃ#¤uT6WE7FFR¤uT7G&Å6WDFFb33c·6ÆFW#ò6ÆFW"Fò7F'BBà £²âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââà ¥vÆR¢6ÆVW¢bô5&W76VBb33³Bb33²ÒFVâ6ÆÂgV÷C´5"gV÷C²³#ÖVçFW ¢b33c¶ÖâÒwV7G&Å&VBb33c·6ÆFW#¢bb33c¶Æ7BÒb33c¶ÖâFVà¢VÇ6P¢vå6WEFFÆRgV÷C¶æFÆSÒgV÷C²fײb33cµ6ÆFW"ÂgV÷C²gV÷C²Âb33c¶ÖâfײgV÷C²Öâ÷"gV÷C²fײ&÷VæBb33c¶ÖâócÂ"fײgV÷C²"FòvògV÷C²¢b33c¶Æ7BÒb33c¶Öà¢VæD` ¢b33c¶âÒuTvWD×6r¢¢bb33c¶âÒb33c¶'WGFöâFVà¢wVFVÆWFR¢6ÆÂgV÷Cµ&öw&W72gV÷C²¢VæD`¥vVæ@ £²ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââà ¤gVæ2&öw&W72¢b33c¶"Òb33c¶Öâóc¢b33c·6V2Òb33c¶Öâ¢c¢b33c·7FWÒòb33c·6V0¥&öw&W74öâgV÷Cµ&öw&W72ÖWFW"gV÷C²ÂgV÷Cµ6WDF÷vâFÖR&WVW7FVC¢gV÷C²fײ&÷VæBb33c¶ÖâócÂfײgV÷C²÷W'2gV÷C²ÂgV÷C³Öç2vöæR6òf"gV÷C²ÂÓÂÓÂb¤f÷"b33c¶ÒFò7FWb33c·7FW¢b33c·6V2Òb33c·6V2Ò¢b33c¶ÖâÒ&÷VæBb33c¶ÖâÒócÂ"¢6ÆVW¢bb33c¶ÖâfwC²"FVà¢&öw&W756WBb33c¶Âb33c¶ÖâfײgV÷C²ÖçWFW2ÆVgB&Vf÷&R6WFF÷vââgV÷C²fײ5$Äbfײ5$ÄbfײgV÷C´7FÂÕ6×Ò&÷'B7FÂÕ6×¢Ò6÷rôFR '¶öâgV÷C²¢VÇ6P¢&öw&W756WBb33c¶Âb33c·6V2fײgV÷C²6V6öæG2ÆVgB&Vf÷&R6WFF÷vââgV÷C²fײ5$Äbfײ5$ÄbfײgV÷C´7FÂÕ6×Ò&÷'B7FÂÕ6×¢Ò6÷rôFR '¶öâgV÷C²¢VæDb¤æW@¥6WFF÷vâ¤W@¤VæDgVæ3³ÓÒfwCµ&öw&W70 ¤gVæ27F÷¢væ7FfFRgV÷Cµ&öw&W72ÖWFW"gV÷C²¢WB¤VæDgVæ2³ÓÒfwCµ7F÷ ¤gVæ25"¢6ÆVW¢6VæBgV÷C··F'×¶ÆVgG×·F"'×¶VçFW'ÒgV÷C²¤VæDgVæ2³ÓÒfwC´5 ¤gVæ2FR¢b33c·7FFRÒvävWE7FFRgV÷Cµ&öw&W72ÖWFW"gV÷C²ÂgV÷C²gV÷C²¢b&DäBb33c·7FFRÂ"FVà¢vå6WE7FFRgV÷Cµ&öw&W72ÖWFW"gV÷C²ÂgV÷C²gV÷C²Â5uôDR¢VÇ6P¢vå6WE7FFRgV÷Cµ&öw&W72ÖWFW"gV÷C²ÂgV÷C²gV÷C²Â5uõ4õr¢VæD`¤VæDgVæ2³ÓÒfwC´FPShutDown_Slider.au3 Link to comment Share on other sites More sharing options...
dandymcgee Posted September 6, 2006 Share Posted September 6, 2006 Ummm. the file is #include <Misc.au3> on my computer not #include <_IsPressed.au3>... I'm not sure if yours is different? - Dan [Website] Link to comment Share on other sites More sharing options...
sstanfie Posted September 7, 2006 Share Posted September 7, 2006 Yeah, where can I get _IsPressed.au3?Thanks in advance,ScottUmmm. the file is #include <Misc.au3> on my computer not #include <_IsPressed.au3>... I'm not sure if yours is different? Link to comment Share on other sites More sharing options...
fmen Posted September 8, 2006 Author Share Posted September 8, 2006 Yeah, where can I get _IsPressed.au3?Thanks in advance,ScottHere's the script with full explanation.You can also use Misc.au3 but you need to update to the latest bersion of autoit3._IsPressed.au3 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