MattHiggs Posted June 4, 2019 Posted June 4, 2019 Hello all. So I am trying to write what I thought was going to be a simple script, but I am having a surprisingly hard time with it. I want to have this script just hold down the enter key for a particular length of time. That is it. I was initially thinking about using something like this: Send ( "{ENTER DOWN}", 0 ) Sleep ( 10000 ) Send ( "{ENTER UP}", 0 ) Seemed like something that would work in theory, but in practice (using a notepad document to test) the key does not appear to be held down at all, but simply pressed, as only one line is added to the notepad document. I even tried something like this hoping it might work: Opt ("SendKeyDownDelay", 15000) Send ( "{ENTER DOWN}", 0 ) Sleep ( 5000 ) Send ( "{ENTER UP}", 0 ) But it does the same thing: adding only one line to the notepad document as you would expect when the enter key is pressed, not held down. Am I doing something wrong/misunderstanding something as to how to do this?
Developers Jos Posted June 4, 2019 Developers Posted June 4, 2019 There is a big difference between the auto-repeat function of the keyboard when a key is pressed and the DOWN function. Simply make a for...next loop with a Send enter and a Sleep() for the appropriate period to simulate what a keyboard does. Jos 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.
MattHiggs Posted June 5, 2019 Author Posted June 5, 2019 (edited) On 6/4/2019 at 9:10 PM, Jos said: There is a big difference between the auto-repeat function of the keyboard when a key is pressed and the DOWN function. Simply make a for...next loop with a Send enter and a Sleep() for the appropriate period to simulate what a keyboard does. Jos Expand Would you mind explaining the difference? I guess i want to understand why the "down" function is even available if the actions which are normally associated with holding the key down (the auto-repeat) aren't emulated too. What's the use?😕 Edited June 5, 2019 by MattHiggs
Nine Posted June 5, 2019 Posted June 5, 2019 On 6/5/2019 at 1:58 AM, MattHiggs said: What's the use? Expand Try to imagine how you would implement this : while key A is pressed, press key B. Without the "down" function it would not be possible to implement it with the Send function. You would need to use some more sophisticated ways to do it like hooks or messages. “They did not know it was impossible, so they did it” ― Mark Twain Reveal hidden contents Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Developers Jos Posted June 5, 2019 Developers Posted June 5, 2019 As stated: The auto repeat is a keyboard function not a system function, so the keyboard sends the repeated keydown/up when holding a key down. Since you emulate the keystrokes now with AutoIt3, you need to implement the repeat function in the program. Jos 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.
Exit Posted June 5, 2019 Posted June 5, 2019 To get the Keyboard settings press Win+R and enter main.cpl @1 App: Au3toCmd UDF: _SingleScript()
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