evilelf Posted July 6, 2009 Share Posted July 6, 2009 (edited) I know im doing something dumb but i just cant find out what it is.;;================================================================================;; The Kick Ass Delay;;;================================================================================; -- The Kick Ass DelayFunc _DelayThatShit()TrayTip("*HINT*", "StandBy Starts NOW",5, 1)Do $Delaysleep = Sleep(100)Sleep(500)$msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit 0 Case $msg = $Button_Stop Shutdown1() EndSelect ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $Delaysleep2 = $Delaysleep + 900 ;;;; or maybe $Delaysleep2 = $Delaysleep += 900 ;;;Until $DelayTimer < $Delaysleep2 ;;;;;;;; or maybe Until $DelayTimer <= $Delaysleep2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EndFunc Edited July 6, 2009 by evilelf Link to comment Share on other sites More sharing options...
Richard Robertson Posted July 6, 2009 Share Posted July 6, 2009 Lets start from the top. Sleep has no return value. You just called sleep two lines in a row for no reason. Shutdown1 isn't a function. I have no idea where $DelayTimer was declared. Link to comment Share on other sites More sharing options...
picea892 Posted July 6, 2009 Share Posted July 6, 2009 This is just a code snippet that doesn't work on it's own and you have provided no explanation of your problem. One thought for you. $Delaysleep = Sleep(100) will result in $Delaysleep=1 not 100. so your $Delaysleep2 = $Delaysleep + 900 will result in $delaysleep2=901 Is this what you want? Link to comment Share on other sites More sharing options...
evilelf Posted July 6, 2009 Author Share Posted July 6, 2009 $DelayTimer = InputBox("Delay Time", " The Delay For Each Message Sent,60Seconds=1Minute 120Seconds=2Minutes " , "Insert Here!, In Seconds")*1000 Picea, No sir. What im trying to do is, find the users input and then after my sleep timer is higher then users input we can move on. more of a custom sleep but the user is able to still end the app right away. Link to comment Share on other sites More sharing options...
jbc1 Posted July 6, 2009 Share Posted July 6, 2009 If you want to be taken seriously I would recommend not having function names like "_DelayThatShit()" Link to comment Share on other sites More sharing options...
picea892 Posted July 6, 2009 Share Posted July 6, 2009 okay, one more try. Is this what you are looking for? CODE$DelayTimer = InputBox("Delay Time", " The Delay For Each Message Sent,60Seconds=1Minute 120Seconds=2Minutes " , "Insert Here!, In Seconds")*1000 ;;================================================================================ ;; The Kick Ass Delay; ;;================================================================================ ; -- The Kick Ass Delay Func _DelayThatShit() TrayTip("*HINT*", "StandBy Starts NOW",5, 1) $Delaysleep = 0 Do Sleep(100) $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit 0 Case $msg = $Button_Stop Shutdown1() EndSelect $Delaysleep = $Delaysleep +100 Until $DelayTimer < $Delaysleep/100;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; EndFunc Link to comment Share on other sites More sharing options...
Mat Posted July 6, 2009 Share Posted July 6, 2009 I have no idea what you want. but play with this. Its never a good thing when your example doesn't work. GUICreate ("Testing Delay") $hLbl = GUICtrlCreateLabel ("", 2, 2, 100, 100) $hInp = GUICtrlCreateInput ("500", 2, 104, 100, 20) $hBtn = GUICtrlCreateButton ("Delay", 104, 104, 50, 20) GUISetState () $i = 0 While 1 Switch GUIGetMsg () Case -3 Exit Case $hBtn _Delay (GUICtrlRead ($hInp)) Case Else GUICtrlSetData ($hLbl, $i) $i += 1 EndSwitch WEnd Func _Delay ($delayTimer) TrayTip("*HINT*", "StandBy Starts NOW",5, 1) $hTimer = TimerInit () Do Sleep (100) Until $DelayTimer < TimerDiff ($hTimer) TrayTip("", "",5, 1) EndFunc MDiesel AutoIt Project Listing Link to comment Share on other sites More sharing options...
OchoNueve Posted July 6, 2009 Share Posted July 6, 2009 okay, one more try. Is this what you are looking for? $DelayTimer = InputBox("Delay Time", " The Delay For Each Message Sent,60Seconds=1Minute 120Seconds=2Minutes " , "Insert Here!, In Seconds")*1000 ;;================================================================================ ;; The Kick Ass Delay; ;;================================================================================ ; -- The Kick Ass Delay Func _DelayThatShit() TrayTip("*HINT*", "StandBy Starts NOW",5, 1) $Delaysleep = 0 Do Sleep(100) $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit 0 Case $msg = $Button_Stop Shutdown(1) EndSelect $Delaysleep = $Delaysleep +100 Until $DelayTimer < $Delaysleep/100;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; EndFunc Just changed the Shutdown command. Works for me. [font="Times New Roman"]Ocho.[/font] Link to comment Share on other sites More sharing options...
evilelf Posted July 6, 2009 Author Share Posted July 6, 2009 (edited) Still not working but your return for 20 would be 0.02 on my calculator i need $Delaysleep +1000 so 20000(20) returns as 20. you should understand. Its just not moving on to the next task. should be this under code delay Func _DelayThatShit() TrayTip("*HINT*", "StandBy Starts NOW",5, 1) $Delaysleep = 0 Do Sleep(100) $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit 0 Case $msg = $Button_Stop Shutdown1() EndSelect $Delaysleep = $Delaysleep +1000 Until $DelayTimer < $Delaysleep/100;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; EndFunc Hope you understand it Do;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; CheckConnection() ; ; more code _DelayThatShit() ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $HowmanyCount = $HowmanyCount - 1;;;;;;;;;;;;; Until $HowmanyCount = 0;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; _FileWriteLog($logname,"Our Application is closing.") Shutdown1() EndFunc;==>Task Its my app and people arnt going to see it, so its whatever. Yes my bad it has a funky name but its my code... I think your what im looking for, ill try this out. Thanks Edit; Mdiesel Your code works some what the way i want it to work like, so ill play with this more. Edited July 6, 2009 by evilelf Link to comment Share on other sites More sharing options...
Mat Posted July 6, 2009 Share Posted July 6, 2009 ... I think your what im looking for, ill try this out. Thanks Edit; Mdiesel Your code works some what the way i want it to work like, so ill play with this more. There are more efficient methods to code that if you'd prefer. For example, using a global variable allows you to have only one loop. Global $bPause = False ; code here While 1 If $bPause then continueLoop ; rest of loop here WEnd Func _SetPaused () $bPause = Not $bPause EndFunc ; ==> _SetPaused There are many more examples around the forum. So check them out. Also, I don't care, but any code that has the potential to offend someone is not wanted. In future, if you are going to get us to help with code, then write a seperate script, ideally as small as possible, that outlines the problem. This code SHOULD WORK and be usable by EVERYONE. That way people like you, and want to help. Simple. On to more general principles. sleep always returns 1, so capturing this return value is pointless. To write my code I actual just started from scratch, as I could not read yours. Code examples should be in a similar format to the one i've posted here. Claerly declared variables, simple commenting and easy layout. its easy, so do it. MDiesel AutoIt Project Listing Link to comment Share on other sites More sharing options...
evilelf Posted July 6, 2009 Author Share Posted July 6, 2009 (edited) I understand all of what you have said, thats why i said sorry.i should have renamed it but,I forgot and i just took his post as a flame.really i should have never said a thing back and just gone on. Thank you again and ill look into the global pause, so whenever the buttion is pressedon my gui it will pause or exit.Edit:At the end of the day heres my code.;;================================================================================ ;; NewName; ;;================================================================================ ; -- The NewName Delay Func _NewName($DelayTimer) TrayTip("*HINT*", "StandBy Starts NOW",5, 1) $hTimer = TimerInit () Do $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit 0 Case $msg = $Button_Stop Shutdown1() EndSelect CheckIfConnectionoffline() Sleep (100) Until $DelayTimer < TimerDiff ($hTimer) TrayTip("", "",5, 1) EndFunc Edited July 6, 2009 by evilelf 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