myspacee Posted February 16, 2009 Share Posted February 16, 2009 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 More sharing options...
AdmiralAlkex Posted February 16, 2009 Share Posted February 16, 2009 There is no need to use _DateDiff() here, you can use the macro @hour .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
myspacee Posted February 16, 2009 Author Share Posted February 16, 2009 thank you for reply, can you explain with small code ? m. Link to comment Share on other sites More sharing options...
myspacee Posted February 16, 2009 Author Share Posted February 16, 2009 solved using @hour thank you. m. Link to comment Share on other sites More sharing options...
myspacee Posted February 17, 2009 Author Share Posted February 17, 2009 (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 February 17, 2009 by myspacee Link to comment Share on other sites More sharing options...
BrettF Posted February 17, 2009 Share Posted February 17, 2009 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 Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! 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