Looney11 Posted May 29, 2017 Posted May 29, 2017 Basically my script is the following: #include <AutoItConstants.au3> #include <Misc.au3> HotKeySet("{F1}", "Start") HotKeySet("{ESC}", "Pause") Global $Paused Func Pause() $Paused = NOT $Paused While $Paused sleep(0) WEnd EndFunc Func Start() While 1 $point = MouseGetPos() Opt("WinTitleMatchMode", 4) ControlClick("Hotel - Habbo - Google Chrome", "Chrome Legacy Window", "", "left", 2, $point[0], $point[1]) < I want a delay here let's say a minute then control click again > ControlClick("Hotel - Habbo - Google Chrome", "Chrome Legacy Window", "", "left", 2, $point[0], $point[1]) WEnd EndFunc While 1 Sleep(0) WEnd as you can see I just want to know how to delay between two controlclicks. I tried putting sleep but it doesn't delay it at all. Perhaps for controlclick it's a different line? Please help me.
Floops Posted May 29, 2017 Posted May 29, 2017 5 minutes ago, Looney11 said: Hotel - Habbo - Google Chrome It looks like you are trying to automate a game. If that is the case then please read the rules. Please correct me if I'm wrong and your script has nothing to do with game automation.
Looney11 Posted May 29, 2017 Author Posted May 29, 2017 That's just an example of the script, It has nothing to do with game automation what so ever.
KickStarter15 Posted May 29, 2017 Posted May 29, 2017 @Looney11, What are you trying to accomplish here. Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare.
Looney11 Posted May 29, 2017 Author Posted May 29, 2017 A key so when I click it it clicks record and then after couple seconds it clicks another coordinate, pause. I just don't know to insert delay
KickStarter15 Posted May 29, 2017 Posted May 29, 2017 @Looney11, Let's say you want to perform ControlClick() after 1 minute, right? or did I missed to understand your problem (just let me know). Try: Local $Shell = ObjCreate("shell.application") Global $delays $TimeInput = "1" ; minimum value is 1. $delays = $TimeInput * 60 ; set amount of time 60(one minute), 30(30 seconds) $delays = $delays * 1000 ; set seconds cound 1000(one minute), 500(half minute) sleep($delays) Send("{ENTER}"); you can add ControlClick() here and do something. Or Local $Shell = ObjCreate("shell.application") Global $tots $TimeInput = "1" $delays = $TimeInput * 60 ; set amount of time 60(one minute), 30(30 seconds) $delays = $delays * 1000 ; set seconds cound 1000(one minute), 500(half minute) sleep($delays) ControlClick("Hotel - Habbo - Google Chrome", "Chrome Legacy Window", "", "left", 2, $point[0], $point[1]) WEnd EndFunc This function add time interval of which you desired amount of time before running the code. Hope this is what you want. KS15 Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare.
Looney11 Posted May 29, 2017 Author Posted May 29, 2017 13 minutes ago, KickStarter15 said: @Looney11, Let's say you want to perform ControlClick() after 1 minute, right? or did I missed to understand your problem (just let me know). Try: Local $Shell = ObjCreate("shell.application") Global $delays $TimeInput = "1" ; minimum value is 1. $delays = $TimeInput * 60 ; set amount of time 60(one minute), 30(30 seconds) $delays = $delays * 1000 ; set seconds cound 1000(one minute), 500(half minute) sleep($delays) Send("{ENTER}"); you can add ControlClick() here and do something. Or Local $Shell = ObjCreate("shell.application") Global $tots $TimeInput = "1" $delays = $TimeInput * 60 ; set amount of time 60(one minute), 30(30 seconds) $delays = $delays * 1000 ; set seconds cound 1000(one minute), 500(half minute) sleep($delays) ControlClick("Hotel - Habbo - Google Chrome", "Chrome Legacy Window", "", "left", 2, $point[0], $point[1]) WEnd EndFunc This function add time interval of which you desired amount of time before running the code. Hope this is what you want. KS15 Yes! I wanted there to be a control click then delay then another control click. How would that be like because the way you made it is the delay before te control click. i wanted controlclick then delay 1 minute ten another controlclick
KickStarter15 Posted May 29, 2017 Posted May 29, 2017 (edited) On 5/29/2017 at 1:10 PM, Looney11 said: < I want a delay here let's say a minute then control click again > In your post above, you wanted the delay between the two ControlClick() for 1 minute idle time. So, just insert this code between them as see. Here's the simplest way of using this code. Local $Shell = ObjCreate("shell.application") Global $delays $TimeInput = "1" ; value 1 $delays = $TimeInput * 10 ; 10 seconds delay $delays = $delays * 200 ; miliseconds count/second Example() Func Example() Run("notepad.exe"); running notepad Local $hWnd = WinWait("[CLASS:Notepad]", "", $delays) ; wait until the delayed time reached. ControlClick($hWnd, "", "Edit1") ; first ControlClick() sleep($delays) ; delaying second ControlClick() WinClose($hWnd);close notepad Run("notepad.exe") ControlClick($hWnd, "", "Edit1") sleep($delays) EndFunc ;==>Example Where ever you wanted the delayed time, just add "sleep($delays)" in every ControlClick() you wanted. Edited June 1, 2017 by KickStarter15 Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare.
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