Flemingjp Posted June 2, 2011 Share Posted June 2, 2011 I want to create a script where a arrow keys a press with delays for how long its held and when to press them. E.G Script Started Up arrow held down > Wait 500 > Left Arrow held down > Wait 250 > Left Arrow Up > Script Stopped I've tried it using Sleep(100), but it doesn't keep the Up arrow held down constantly as it pause the script. Not delay an action. Thanks Flemingjp Link to comment Share on other sites More sharing options...
Developers Jos Posted June 2, 2011 Developers Share Posted June 2, 2011 Should work fine when done correctly.... post your script to see what you are doing. By the way, welcome and hope you did take the time to read our forum rules. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Flemingjp Posted June 2, 2011 Author Share Posted June 2, 2011 MouseClick("Left", 300, 350, 1, 5) sleep(2990) Send("{UP down}") sleep(550) Send("{LEFT down}") sleep(350) Send("{LEFT up}") Link to comment Share on other sites More sharing options...
realshyfox Posted June 2, 2011 Share Posted June 2, 2011 (edited) MouseClick("Left", 300, 350, 1, 5) sleep(2990) Send("{UP down}") sleep(550) Send("{LEFT down}") sleep(350) Send("{LEFT up}") The sleep is for pausing script. It won´t work. This is what you´re after: #include <Timers.au3> _Timer() Func _Timer() Send("#r") WinWaitActive("Run") Send("notepad.exe{Enter}") WinWaitActive("[CLASS:Notepad]") Global $starttime = _Timer_Init() While _Timer_Diff($starttime)<1000 Send("Hello ... Is just an example") WEnd EndFunc ;==>_Timer Edited June 2, 2011 by realshyfox Learn, learn and ... learn Link to comment Share on other sites More sharing options...
Developers Jos Posted June 2, 2011 Developers Share Posted June 2, 2011 The sleep is for pausing script. It won´t work.It works fine to keep the KeyDown, but it will not repeatedly press it.Slight difference here SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
realshyfox Posted June 2, 2011 Share Posted June 2, 2011 (edited) It works fine to keep the KeyDown, but it will not repeatedly press it. Slight difference here Well, let´s change a little: #include <Timers.au3> _Timer() Func _Timer() Send("#r") WinWaitActive("Run") Send("notepad.exe{Enter}") WinWaitActive("[CLASS:Notepad]") Global $starttime = _Timer_Init() While _Timer_Diff($starttime)<5000 Send("Hello ... Is just an example") Sleep(500) $iIdleTime = _Timer_GetIdleTime() $starttime = $starttime + $iIdleTime WEnd EndFunc ;==>_Timer Edited June 2, 2011 by realshyfox Learn, learn and ... learn 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