EhJay Posted June 18, 2006 Share Posted June 18, 2006 Ok. My dearest script that I've been working on for the past month is done except one problem. Here is the script. expandcollapse popupHotKeySet("{End}", "request_status") HotKeySet("{PGDN}", "request_add_time") $timerchoose = 0 $addtime1 = 0 $addtime2 = 0 $timeout = 0 $answer = MsgBox ( 3, "Shutdown or Hibernate?", "Press Yes to shutdown and No to hibernate.") If $answer = 6 Then ;sets time to wait in minutes. $timeout = InputBox("Wait x Minutes","Give minutes to wait before shutting down. Press End to get time until shutdown. Press Pagedown to add time to the countdown.")*1000*60 If @error then exit endif $timeinit = TimerInit() $timerchoose = $timerchoose+1 While (TimerDiff($timeinit) < $timeout) sleep(100) $timerequest1 = ($timeout-TimerDiff($timeinit))/1000/60 Wend ;1 for shutdown, 64 for hibernate, Shutdown(1) EndIf If $answer = 7 Then ;sets time to wait in minutes. $timeout = InputBox("Wait x Minutes","Give minutes to wait before hibernating. Press End to get time until hibernate. Press Pagedown to add time to the countdown.")*1000*60 If @error then exit endif $timeinit = TimerInit() $timerchoose = 0 While (TimerDiff($timeinit) < $timeout) sleep(100) $timerequest2 = ($timeout-TimerDiff($timeinit))/1000/60 Wend ;1 for shutdown, 64 for hibernate, Shutdown(64) EndIf If $answer = 2 Then Exit EndIf Func request_status() If $timerchoose = 1 then $stoporgo1 = MsgBox(4, "Waiting Until Shutdown Paused", "Time until shutdown is " & $timerequest1 &" minutes. Continue counting down until shutdown?") If $stoporgo1 = 7 then MsgBox(0, "Shutdown Aborted", "You computer will no longer shutdown in " & $timerequest1 &" minutes.") exit endif endif If $timerchoose = 0 then $stoporgo2 = MsgBox(4, "Waiting Until Hibernate Paused", "Time until hibernate is " & $timerequest2 &" minutes. Continue counting down until hibernate?") If $stoporgo2 = 7 then MsgBox(0, "Hibernate Aborted", "You computer will no longer hibernate in " & $timerequest2 &" minutes.") exit endif endif endfunc Func request_add_time() If $timerchoose = 1 then $addtime1 = MsgBox(4, "Add Time To Countdown?", "Would you like to add time to the countdown before shutdown which is currently at "& $timerequest1 &" minutes?") endif If $addtime1 = 7 then MsgBox(0, "Countdown Will Continue", "No time has been added to the shutdown countdown.") endif If $addtime1 = 6 then $timeout = $timeout+(Inputbox("Enter Time To Add", "Enter time to add to the shutdown countdown in minutes.")*1000*60) request_status() If @error then MsgBox(0, "Countdown Will Continue","Countdown will continue from "& $timerequest1 &" minutes.") endif endif If $timerchoose = 0 then $addtime2 = MsgBox(4, "Change Countdown Time?", "Would you like to add time before hibernation which is currently at "& $timerequest2 &" minutes?") endif If $addtime2 = 7 then MsgBox(0, "Countdown Will Continue", "No time has been added to the countdown to hibernate.") endif If $addtime2 = 6 then $timeout = $timeout+(Inputbox("Enter Time To Add", "Enter time to add to the countdown in minutes.")*1000*60) request_status() If @error then MsgBox(0, "Countdown Will Continue","Countdown will continue from "& $timerequest2 &" minutes to hibernate.") endif endif endfuncoÝ÷ ØZ+²æ¬¢{ayº-¶ºw-Ý¡ë'ßÛjºZuÛbꮢÛh¶¢éív')Ýý²Ë©¢Ç¡«¢+ÙÕ¹ÉÅÕÍÑ}}Ñ¥µ ¤(%%ÀÌØíÑ¥µÉ¡½½ÍôÄÑ¡¸($ÀÌØíÑ¥µÄô5Í ½à аÅÕ½ÐíQ¥µQ¼ ½Õ¹Ñ½Ý¸üÅÕ½Ðì°ÅÕ½Ðí]½Õ±å½Ô±¥Ñ¼Ñ¥µÑ¼Ñ¡½Õ¹Ñ½Ý¸½ÉÍ¡Õѽݸݡ¥ ¥ÌÕÉɹѱäÐÅÕ½ÐìµÀìÀÌØíÑ¥µÉÅÕÍÐĵÀìÅÕ½Ðìµ¥¹ÕÑÌüÅÕ½Ðì¤)¹¥(%%ÀÌØíÑ¥µÄôÜÑ¡¸(%5Í ½à À°ÅÕ½Ðí ½Õ¹Ñ½Ý¸]¥±° ½¹Ñ¥¹ÕÅÕ½Ðì°ÅÕ½Ðí9¼Ñ¥µ¡Ì¸Ñ¼Ñ¡Í¡Õѽݸ½Õ¹Ñ½Ý¸¸ÅÕ½Ðì¤)¹¥(%%ÀÌØíÑ¥µÄôØÑ¡¸($ÀÌØíÑ¥µ½ÕÐôÀÌØíÑ¥µ½ÕЬ¡%¹ÁÕѽà ÅÕ½Ðí¹ÑÈQ¥µQ¼ÅÕ½Ðì°ÅÕ½Ðí¹ÑÈÑ¥µÑ¼Ñ¼Ñ¡Í¡Õѽݸ½Õ¹Ñ½Ý¸¥¸µ¥¹ÕÑ̸ÅÕ½Ð줨ÄÀÀÀ¨ØÀ¤(%ÉÅÕÍÑ}ÍÑÑÕÌ ¤(%%ÉɽÈÑ¡¸(%5Í ½à À°ÅÕ½Ðí ½Õ¹Ñ½Ý¸]¥±° ½¹Ñ¥¹ÕÅÕ½Ðì°ÅÕ½Ðí ½Õ¹Ñ½Ý¸Ý¥±°½¹Ñ¥¹Õɽ´ÅÕ½ÐìµÀìÀÌØíÑ¥µÉÅÕÍÐĵÀìÅÕ½Ðìµ¥¹ÕÑ̸ÅÕ½Ðì¤(%¹¥)¹¥(((%%ÀÌØíÑ¥µÉ¡½½ÍôÀÑ¡¸(ÀÌØíÑ¥µÈô5Í ½à аÅÕ½Ðí ¡¹ ½Õ¹Ñ½Ý¸Q¥µüÅÕ½Ðì°ÅÕ½Ðí]½Õ±å½Ô±¥Ñ¼Ñ¥µ½É¡¥É¹Ñ¥½¸Ý¡¥ ¥ÌÕÉɹѱäÐÅÕ½ÐìµÀìÀÌØíÑ¥µÉÅÕÍÐȵÀìÅÕ½Ðìµ¥¹ÕÑÌüÅÕ½Ðì¤)¹¥(%%ÀÌØíÑ¥µÈôÜÑ¡¸(%5Í ½à À°ÅÕ½Ðí ½Õ¹Ñ½Ý¸]¥±° ½¹Ñ¥¹ÕÅÕ½Ðì°ÅÕ½Ðí9¼Ñ¥µ¡Ì¸Ñ¼Ñ¡½Õ¹Ñ½Ý¸Ñ¼¡¥É¹Ñ¸ÅÕ½Ðì¤)¹¥(%%ÀÌØíÑ¥µÈôØÑ¡¸($ÀÌØíÑ¥µ½ÕÐôÀÌØíÑ¥µ½ÕЬ¡%¹ÁÕѽà ÅÕ½Ðí¹ÑÈQ¥µQ¼ÅÕ½Ðì°ÅÕ½Ðí¹ÑÈÑ¥µÑ¼Ñ¼Ñ¡½Õ¹Ñ½Ý¸¥¸µ¥¹ÕÑ̸ÅÕ½Ð줨ÄÀÀÀ¨ØÀ¤(%ÉÅÕÍÑ}ÍÑÑÕÌ ¤(%%ÉɽÈÑ¡¸(%5Í ½à À°ÅÕ½Ðí ½Õ¹Ñ½Ý¸]¥±° ½¹Ñ¥¹ÕÅÕ½Ðì°ÅÕ½Ðí ½Õ¹Ñ½Ý¸Ý¥±°½¹Ñ¥¹Õɽ´ÅÕ½ÐìµÀìÀÌØíÑ¥µÉÅÕÍÐȵÀìÅÕ½Ðìµ¥¹ÕÑÌѼ¡¥É¹Ñ¸ÅÕ½Ðì¤(%¹¥)¹¥oÝ÷ Øay"¶¬²¶§Ú£Øb²X§y»!Ú'ßÛd0«HÂ¥uÈZ¡ø±Ö®¶sbb33c·FÖV÷WBÒb33c·FÖV÷WB²çWF&÷gV÷C´VçFW"FÖRFòFBgV÷C²ÂgV÷C´VçFW"FÖRFòFBFòFR6÷VçFF÷vââÖçWFW2âgV÷C²££c Thank you for any help you could give. Link to comment Share on other sites More sharing options...
nfwu Posted June 18, 2006 Share Posted June 18, 2006 Try $timeout += Number(Inputbox("Enter Time To Add", "Enter time to add to the countdown in minutes.")) * 1000 * 60 Just an idea... #) TwitterOut of date stuff:Scripts: Sudoku Solver | Webserver | 3D library (Pure AutoIt) | Wood's GadgetsUDFs: _WoodUniqueID() | _DialogEditIni() | _Console*() | _GetIPConfigData() | _URLEncode/Decode() Link to comment Share on other sites More sharing options...
EhJay Posted June 18, 2006 Author Share Posted June 18, 2006 Nope. I still can't add time to the countdown. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 18, 2006 Moderators Share Posted June 18, 2006 Nope. I still can't add time to the countdown.What happens when you make these GlobalGlobal $timerchoose = 0 Global $addtime1 = 0 Global $addtime2 = 0 Global $timeout = 0 Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
EhJay Posted June 18, 2006 Author Share Posted June 18, 2006 I don't know what that means but it still does not add time to the countdown when you input it. Thanks for trying though. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 18, 2006 Moderators Share Posted June 18, 2006 Ahh, I see... well Jdeb gives an example here: http://www.autoitscript.com/forum/index.ph...ndpost&p=197113 on how to "pause" time, but that $savediff = $savediff + whatever (addtime for you) would be something that you would need to look at, you would need to make $timeinit a global variable, and do something like that. That same theory should work for you here. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
EhJay Posted June 18, 2006 Author Share Posted June 18, 2006 Ok, so at the top of my script I would put Global $timeinit = 0 But then what would I do? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 18, 2006 Moderators Share Posted June 18, 2006 Ok, so at the top of my script I would put Global $timeinit = 0 But then what would I do?Try to work your code example out like Jdeb did there until it works? That sounds like a good start to me Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Paulie Posted June 18, 2006 Share Posted June 18, 2006 Ok, so at the top of my script I would put Global $timeinit = 0 But then what would I do?Global just means that that variable can be used in functions other then the one it was declared in. so to declare your varibles as global, just leave script as is and where you declare variables in the firs script, replace with Global $Timeout=0 For each variable Link to comment Share on other sites More sharing options...
EhJay Posted June 18, 2006 Author Share Posted June 18, 2006 Ok... I did that and tried the script. It now looks like this: expandcollapse popupHotKeySet("{End}", "request_status") HotKeySet("{PGDN}", "request_add_time") Global $timerchoose = 0 Global $addtime1 = 0 Global $addtime2 = 0 Global $timeout = 0 Global $timeinit = 0 $answer = MsgBox ( 3, "Shutdown or Hibernate?", "Press Yes to shutdown and No to hibernate.") If $answer = 6 Then ;sets time to wait in minutes. $timeout = InputBox("Wait x Minutes","Give minutes to wait before shutting down. Press End to get time until shutdown. Press Pagedown to add time to the countdown.")*1000*60 If @error then exit endif $timeinit = TimerInit() $timerchoose = $timerchoose+1 While (TimerDiff($timeinit) < $timeout) sleep(100) $timerequest1 = ($timeout-TimerDiff($timeinit))/1000/60 Wend ;1 for shutdown, 64 for hibernate, Shutdown(1) EndIf If $answer = 7 Then ;sets time to wait in minutes. $timeout = InputBox("Wait x Minutes","Give minutes to wait before hibernating. Press End to get time until hibernate. Press Pagedown to add time to the countdown.")*1000*60 If @error then exit endif $timeinit = TimerInit() $timerchoose = 0 While (TimerDiff($timeinit) < $timeout) sleep(100) $timerequest2 = ($timeout-TimerDiff($timeinit))/1000/60 Wend ;1 for shutdown, 64 for hibernate, Shutdown(64) EndIf If $answer = 2 Then Exit EndIf Func request_status() If $timerchoose = 1 then $stoporgo1 = MsgBox(4, "Waiting Until Shutdown Paused", "Time until shutdown is " & $timerequest1 &" minutes. Continue counting down until shutdown?") If $stoporgo1 = 7 then MsgBox(0, "Shutdown Aborted", "You computer will no longer shutdown in " & $timerequest1 &" minutes.") exit endif endif If $timerchoose = 0 then $stoporgo2 = MsgBox(4, "Waiting Until Hibernate Paused", "Time until hibernate is " & $timerequest2 &" minutes. Continue counting down until hibernate?") If $stoporgo2 = 7 then MsgBox(0, "Hibernate Aborted", "You computer will no longer hibernate in " & $timerequest2 &" minutes.") exit endif endif endfunc Func request_add_time() If $timerchoose = 1 then $addtime1 = MsgBox(4, "Add Time To Countdown?", "Would you like to add time to the countdown before shutdown which is currently at "& $timerequest1 &" minutes?") endif If $addtime1 = 7 then MsgBox(0, "Countdown Will Continue", "No time has been added to the shutdown countdown.") endif If $addtime1 = 6 then $timeout = $timeout+(Inputbox("Enter Time To Add", "Enter time to add to the shutdown countdown in minutes.")*1000*60) request_status() If @error then MsgBox(0, "Countdown Will Continue","Countdown will continue from "& $timerequest1 &" minutes.") endif endif If $timerchoose = 0 then $addtime2 = MsgBox(4, "Change Countdown Time?", "Would you like to add time before hibernation which is currently at "& $timerequest2 &" minutes?") endif If $addtime2 = 7 then MsgBox(0, "Countdown Will Continue", "No time has been added to the countdown to hibernate.") endif If $addtime2 = 6 then $timeout = $timeout+(Inputbox("Enter Time To Add", "Enter time to add to the countdown in minutes.")*1000*60) request_status() If @error then MsgBox(0, "Countdown Will Continue","Countdown will continue from "& $timerequest2 &" minutes to hibernate.") endif endif endfunc Run it and press Pagedown (if you havn't already) and you will see what I'm having trouble with. It still will not add time to the countdown when I input it. Did I do something wrong? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 18, 2006 Moderators Share Posted June 18, 2006 I don't see where you ever call to: request_add_time() to add the time? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Paulie Posted June 18, 2006 Share Posted June 18, 2006 I don't see where you ever call to: request_add_time() to add the time?isn't that in the hotkey? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 18, 2006 Moderators Share Posted June 18, 2006 (edited) isn't that in the hotkey?Yep ... Edit: I'm getting big on this self help thing, but I added a simple debugging method, to help you understand what is going on (Watch the count down and then look at what $timeout = (It does add to it, so that would say what about whatever your issue is (I don't know that issue because you said it wasn't adding and it is)))expandcollapse popupHotKeySet("{End}", "request_status") HotKeySet("{PGDN}", "request_add_time") Global $timerchoose = 0 Global $addtime1 = 0 Global $addtime2 = 0 Global $timeout = 0 Global $timeinit = 0 $answer = MsgBox( 3, "Shutdown or Hibernate?", "Press Yes to shutdown and No to hibernate.") If $answer = 6 Then ;sets time to wait in minutes. $timeout = InputBox("Wait x Minutes","Give minutes to wait before shutting down. Press End to get time until shutdown. Press Pagedown to add time to the countdown.")*1000*60 If @error Then Exit EndIf $timeinit = TimerInit() $timerchoose = $timerchoose+1 While (TimerDiff($timeinit) < $timeout) Sleep(100) $timerequest1 = ($timeout-TimerDiff($timeinit))/1000/60 ;~ ============ You should look at this and use it to figure out your issue ================== ToolTip('$timerrequest1 = ' & $timerequest1 & @CR _ & '$timeout = ' & $timeout, 0, 0) ;~ =========================================================================================== WEnd ;1 for shutdown, 64 for hibernate, Shutdown(1) EndIf If $answer = 7 Then ;sets time to wait in minutes. $timeout = InputBox("Wait x Minutes","Give minutes to wait before hibernating. Press End to get time until hibernate. Press Pagedown to add time to the countdown.")*1000*60 If @error Then Exit EndIf $timeinit = TimerInit() $timerchoose = 0 While (TimerDiff($timeinit) < $timeout) Sleep(100) $timerequest2 = ($timeout-TimerDiff($timeinit))/1000/60 ;~ ============ You should look at this and use it to figure out your issue ================== ToolTip('$timerrequest2 = ' & $timerequest2 & @CR _ & '$timeout = ' & $timeout, 0, 0) ;~ =========================================================================================== WEnd ;1 for shutdown, 64 for hibernate, Shutdown(64) EndIf If $answer = 2 Then Exit EndIf Func request_status() If $timerchoose = 1 Then $stoporgo1 = MsgBox(4, "Waiting Until Shutdown Paused", "Time until shutdown is " & $timerequest1 &" minutes. Continue counting down until shutdown?") If $stoporgo1 = 7 Then MsgBox(0, "Shutdown Aborted", "You computer will no longer shutdown in " & $timerequest1 &" minutes.") Exit EndIf EndIf If $timerchoose = 0 Then $stoporgo2 = MsgBox(4, "Waiting Until Hibernate Paused", "Time until hibernate is " & $timerequest2 &" minutes. Continue counting down until hibernate?") If $stoporgo2 = 7 Then MsgBox(0, "Hibernate Aborted", "You computer will no longer hibernate in " & $timerequest2 &" minutes.") Exit EndIf EndIf EndFunc ;==>request_status Func request_add_time() If $timerchoose = 1 Then $addtime1 = MsgBox(4, "Add Time To Countdown?", "Would you like to add time to the countdown before shutdown which is currently at "& $timerequest1 &" minutes?") EndIf If $addtime1 = 7 Then MsgBox(0, "Countdown Will Continue", "No time has been added to the shutdown countdown.") EndIf If $addtime1 = 6 Then $timeout = $timeout+ (InputBox("Enter Time To Add", "Enter time to add to the shutdown countdown in minutes.")*1000*60) request_status() If @error Then MsgBox(0, "Countdown Will Continue","Countdown will continue from "& $timerequest1 &" minutes.") EndIf EndIf If $timerchoose = 0 Then $addtime2 = MsgBox(4, "Change Countdown Time?", "Would you like to add time before hibernation which is currently at "& $timerequest2 &" minutes?") EndIf If $addtime2 = 7 Then MsgBox(0, "Countdown Will Continue", "No time has been added to the countdown to hibernate.") EndIf If $addtime2 = 6 Then $timeout = $timeout+ (InputBox("Enter Time To Add", "Enter time to add to the countdown in minutes.")*1000*60) request_status() If @error Then MsgBox(0, "Countdown Will Continue","Countdown will continue from "& $timerequest2 &" minutes to hibernate.") EndIf EndIf EndFunc ;==>request_add_timeHa, even let it hibernate me. Edited June 18, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
EhJay Posted June 18, 2006 Author Share Posted June 18, 2006 Right ok thank you for that nice little thingy you made there. I found the problem because of that! For some reason that request_status I had there was giving the information from before the time was added, giving me faulse impressions. I can simply remove that. Thank you for your help. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 18, 2006 Moderators Share Posted June 18, 2006 Right ok thank you for that nice little thingy you made there. I found the problem because of that! For some reason that request_status I had there was giving the information from before the time was added, giving me faulse impressions. I can simply remove that. Thank you for your help. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. 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