Jump to content
Tripoz

Confuse with time for running the FUnc

Recommended Posts

Tripoz

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
wend

can anyone help me with time func?

Share this post


Link to post
Share on other sites
water
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 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
TheSaint

@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.


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

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)

userbar.png

Share this post


Link to post
Share on other sites
water

 As he was talking about a function

i want to Running some Function in specific time

I gave him a function ;) 

  • Like 1

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
TheSaint

I think it was likely a misuse of the word function, but hopefully we've both set him on the right path. :D


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

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)

userbar.png

Share this post


Link to post
Share on other sites
Chimp

one more way

Local $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 by Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites
Tripoz

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 ..... ???

Share this post


Link to post
Share on other sites
water

If (A = B ) and (A = C) and (A = D) Then .....


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Tripoz

If (A = B ) and (A = C) and (A = D) Then .....

thx alot..thats what i need...ur the best bro..

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×