Tulos Posted August 31, 2008 Posted August 31, 2008 (edited) Hello, First let me thank you for taking the time to read, and reply. I have written a script mostly from trial and error and searching, Now I wish to add a feature I cannot find a search result for. My script loops, at the moment untill I stop it in the taskbar. I want to add a feature before the script begins to check the system time and if the system time is between 6am and 8am I want the script to terminate. The goal is to be able to start the script manually anytime after 8am and let it run continuously untill 6am then self terminate. It maximises the program from the taskbar, runs some automated point & click steps and loops, currently set to 100 but it never runs enough times to end itself before I end it. For Example: WinWait("Program Being Used","") If Not WinActive("Program Being Used","") Then WinActivate("Program Being Used","") WinWaitActive("Program Being Used","") While 1;100 :: Several point and click mouse codes for different tasks which involve commands like:: Mouse Move (loc, loc) Mouse Down Mouse Up Sleep (time) etc... wend Your help would be greatly appreciated, thank you. Huserx Edited August 31, 2008 by Huserx
muhmuuh Posted August 31, 2008 Posted August 31, 2008 Did you check the Time and Date macros? You can do something like this If @HOUR>=6 and @HOUR<=8 Then Exit and welcome to the forum I ran. I ran until my muscles burned and my veins pumped battery acid. Then I ran some more.
Tulos Posted August 31, 2008 Author Posted August 31, 2008 (edited) Thank you, And no I was using a general search... Does it matter which line I place it? Would I need to change anything or just stick it in anywhere like this..? Oh and does that differentiate between 6 and 8 pm? //////// WinWait("Program Being Used","") If Not WinActive("Program Being Used","") Then WinActivate("Program Being Used","") WinWaitActive("Program Being Used","") While 1;100 If @HOUR>=6 and @HOUR<=8 Then Exit :: Several point and click mouse codes for different tasks which involve commands like:: Mouse Move (loc, loc) Mouse Down Mouse Up Sleep (time) etc... wend ////////// Edited August 31, 2008 by Huserx
Tulos Posted September 1, 2008 Author Posted September 1, 2008 Also how would I write it for a specific hour and minute? Does it matter which line I place it in for it to work? Does that differentiate between 6 and 8 pm?
bogQ Posted September 1, 2008 Posted September 1, 2008 (edited) Also how would I write it for a specific hour and minute? Does it matter which line I place it in for it to work? Does that differentiate between 6 and 8 pm?Also how would I write it for a specific hour and minute? this is what you can do (this is only exsample) $my1time="0730" ;<== 07:30 $my2time="1600" ;<== 14:00 $exittime="0630" ;<== 06:30 $comptime = @HOUR&@MIN If $my1time <= $comptime And $my2time >= $comptime Then Else ToolTip("You cant start program a this time, only from "&StringLeft($my1time, 2)&":"&StringRight($my1time, 2)&" to "&StringLeft($my2time, 2)&":"&StringRight($my2time, 2),0,0) Sleep(3000) Exit EndIf While 1 _myfunc() Sleep(50) WEnd Func _myfunc() If @HOUR&@MIN = $exittime Then Exit Else ToolTip("IM RUNING THE SCRIPT Until "&StringLeft($exittime, 2)&":"&StringRight($exittime, 2),0,0) EndIf EndFunc Does that differentiate between 6 and 8 pm? 6AM = 06h on @HOUR 8PM = 20h on @HOUR Does it matter which line I place it in for it to work? to work propartly it probably does, i sugest that you put exit on top of the main loop, (and you did that so dont woory) This will work only if your starting time is hier then your exit time If you need other way around i sugest that you involve @MDAY (look 4 it in a help file if you need it) in your script so that you can detect tomoro Edited September 1, 2008 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.
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