Tripoz Posted July 2, 2015 Share Posted July 2, 2015 Hello.i have problem to make it right my code,i want to Running some Function in specific time (local/computer time)example : from : 1.01 PM to 17.55PM my Func will Stop, beside that my FUnc will running.i try this code but when the time is come, it wont work : While 1 If Not (@HOUR > 13 And @HOUR < 17) Or (@HOUR = 13 And @MIN > 01) Or (@HOUR = 17 And @MIN < 56) Then Endif wendcan anyone help me with time func? Link to comment Share on other sites More sharing options...
water Posted July 2, 2015 Share Posted July 2, 2015 Func _YourFunc() ; Do not run the function between 13:01 and 17:55 If (@HOUR > 13 And @HOUR < 17) Or (@HOUR = 13 And @MIN > 01) Or (@HOUR = 17 And @MIN < 56) Then Return ; Run the function ; Your code goes here EndFunc My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
TheSaint Posted July 2, 2015 Share Posted July 2, 2015 @water - Actually, it might be he is just missing the ExitLoop command?I'm guessing he has just cut the rest of his function out for simplicity, but it needs to run in a loop.@Tripoz - You could also benefit from running a function from within your While...Wend loop, which water has given you a clue to. Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
water Posted July 2, 2015 Share Posted July 2, 2015 As he was talking about a functioni want to Running some Function in specific timeI gave him a function TheSaint 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
TheSaint Posted July 2, 2015 Share Posted July 2, 2015 I think it was likely a misuse of the word function, but hopefully we've both set him on the right path. Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
Gianni Posted July 2, 2015 Share Posted July 2, 2015 (edited) one more wayLocal $iFrom_HHMMSS = "13:01:00" ; use h24 time format Local $iTill_HHMMSS = "17:55:00" ; $iFrom_HHMMSS = StringReplace($iFrom_HHMMSS, ":", "") ; remove ":" $iTill_HHMMSS = StringReplace($iTill_HHMMSS, ":", "") ; remove ":" While 1 $iNow = @HOUR & @MIN & @SEC ; only one of below functions is executed in an mutually exclusive way If $iNow >= $iFrom_HHMMSS and $iNow <= $iTill_HHMMSS Then ; -- put here the function to run within the lapse (or leave empty) ; ConsoleWrite("Now we are IN the period" & @CRLF) Else ; -- put here the function to run outside the lapse (or leave empty) ; ConsoleWrite("Now we are OUT of period" & @CRLF) Endif Sleep(1000) wend Edited July 2, 2015 by Chimp Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
Tripoz Posted July 2, 2015 Author Share Posted July 2, 2015 wow...so much thx @water, @TheSaint, n @Chimp...want to asking 1 more question, but its not relevant of this thread... would i make new thread??just a simple question.how to make like "If A = B = C = D Then ..... ??? Link to comment Share on other sites More sharing options...
water Posted July 2, 2015 Share Posted July 2, 2015 If (A = B ) and (A = C) and (A = D) Then ..... My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Tripoz Posted July 2, 2015 Author Share Posted July 2, 2015 If (A = B ) and (A = C) and (A = D) Then .....thx alot..thats what i need...ur the best bro.. 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