TFM Posted April 22, 2016 Posted April 22, 2016 Hello, I have looked through the forums and documentation but have not found anything on this. In .NET, using the System.Windows.Forms assembly, you can use: Sendkeys.SendWait To send key strokes. It: Sends the given keys to the active application, and then waits for the messages to be processed. When using the AutoItScript Send function, it seems to not wait for the messages to be processed because when automating my application, there is a timing issue where tabs are occuring before text is finished sending etc. Does anyone know if there is a wait to use AutoIt same as SendWait? I know you can set the speed between keypresses but that seems kind of a potential for errors if the system or app slows down. Thanks in advance.
alien4u Posted April 22, 2016 Posted April 22, 2016 You should look in to: AutoItSetOption ( "option" [, param] ) Option: SendKeyDelay: Alters the length of the brief pause in between sent keystrokes. A value of 0 removes the delay completely. Time in milliseconds to pause (default=5). This probably help you with your problem.
mikell Posted April 22, 2016 Posted April 22, 2016 I would use Send/ControlSend + WinWait/ProcessWait
Moderators JLogan3o13 Posted April 22, 2016 Moderators Posted April 22, 2016 @alien4u the OP specifically states he is looking for a "wait for response" behavior, not SendKeyDelay. @TFM I think mikell is closest on this, if you want to do this natively. IIRC, Sendkeys first tries to establish a keyboard hook into the other process. Only then will it operate as expected. If it cannot, it simply uses SendInput. I don't believe you're going to be able to hook into the other process in the same manner natively with AutoIt (someone could very well come along and prove me completely wrong), and are going to be forced to rely on the method mikell lays out above. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
alien4u Posted April 22, 2016 Posted April 22, 2016 @JLogan3o13 I'm just wondering here because I'm a beginner. If he increment the delay between sent keystrokes then maybe it could fix the timing issue? Example: Sent TAB 3 times but with delay between keystrokes of 1 second, then that will give enough time to the application to react? I'm right here even if is not the best way? or I'm missing something? I'm just curious about. Regards Alien.
Moderators JLogan3o13 Posted April 23, 2016 Moderators Posted April 23, 2016 @alien4u read the MSDN article on SendKeys.SendWait to see what the OP is looking to do. Specifically: Quote use this method to send keystrokes to an application and wait for any processes that are started by the keystrokes to be completed "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
alien4u Posted April 23, 2016 Posted April 23, 2016 6 hours ago, JLogan3o13 said: @alien4u read the MSDN article on SendKeys.SendWait to see what the OP is looking to do. Specifically: Hi @JLogan3o13 thanks you. As incredible as it sound is really difficult for me to access Microsoft MSDN or Technet because is slow like hell for me, near impossible to open from my Dial-Up connection. Anyways I will look in to this. Regards Alien.
TFM Posted May 13, 2016 Author Posted May 13, 2016 Hi mikell, Do you have an example of what you were thinking when using: I would use Send/ControlSend + WinWait/ProcessWait It looks to me like the 2 Wait calls pause until the application is active. Not sure how the effects keystrokes and possible application delay between each? I am still a little hesitant to use SendKeysDelay option as it sets a fixed delay rather than waiting until the system is ready to process addition keystrokes.
mikell Posted May 13, 2016 Posted May 13, 2016 Given the requirements from post #1, it seems to me that after the SendKeys you want to wait for something to change - this could be the content of an application window or a process existence (reason why I mentioned WinWait and ProcessWait) With both, unless you specifically define a timeout the default delay is "wait indefinitely"
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