Sign in to follow this  
Followers 0
myspacee

learn to use DateDiff

6 posts in this topic

hello to all,

try to learn use DateDiff func with no luck.

I've a script that monitor directory and move files.

Script watch directory for all day, but my boss want that script pause its job

between 4 AM to 7 PM. How can I code pause between 2 given hours ?

Can't code this:

while 1

   if time > 4AM and time < 7PM then
      sleep
   else

      do things

   endif

wend

i feel so stupid :)

m.

Share this post


Link to post
Share on other sites



thank you for reply,

can you explain with small code ?

m.

Share this post


Link to post
Share on other sites

solved using @hour thank you.

m.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

sorry for post again but i wrong something...

what i want :

- when @hour = 18 flag = 1

- when @hour between = 19 and 2 flag = 2

- other case flag = 0

dim $f_go = 0

while 1
    if @hour = 18 Then 
        
        $f_go = 1
        
    Elseif @hour >= 19 and @hour <= 2 Then
        
        $f_go = 2
        
    Else

        $f_go = 0
        
    EndIf


   tooltip(@hour & "      flag : " & $f_go)
   
wend

Try also to transform @hour using number(@hour) but can't works.

Can anyone help me?

thank you,

m.

___ edit

FIND error :

Elseif @hour >= 19 and @hour <= 2 Then

Elseif @hour >= 19 OR @hour <= 2 Then

thank you all

Edited by myspacee

Share this post


Link to post
Share on other sites

Why not just

While 1
    Switch @hour
        Case 4 to 18
            MsgBox (0, "", "Hour is between 4am and 7pm")
        Case Else
            MsgBox (0, "", "Some other time!")
    EndSwitch
    Sleep (500);Lets sleep
WEnd

Cheers,

Brett

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
Sign in to follow this  
Followers 0