Jump to content

learn to use DateDiff


myspacee
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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
Link to comment
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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...