Lazarus
Programming => General => Topic started by: xinyiman on July 11, 2019, 09:32:58 am
-
Hi guys, I have the following problem on ubuntu 19.04
I have a program that simulates the user iteration with mouse and keyboard (LazMouseInputKey package). Sometimes it happens that I execute commands in succession but they are executed incorrectly. I give an example
KeyInput.Apply ([ssCtrl]);
KeyInput.Press ('V');
KeyInput.UnApply ([ssCtrl]);
KeyInput.Apply ([ssCtrl]);
KeyInput.Press ('A');
KeyInput.UnApply ([ssCtrl]);
KeyInput.Apply ([ssCtrl]);
KeyInput.Press ('C');
KeyInput.UnApply ([ssCtrl]);
This code should paste, select everything and then copy the content. Sometimes it happens that first select everything, then paste and then copy. As if the calls were asynchronous. Does anyone know how to make these calls synchronous?
-
You can try to put sleep(10) between the command. I'm not shure how long the Keyboard buffer and the clipboard needs to get/put the data.
-
maybe a caching issue...
In windows you can insert keys into the keyboard buffer and they come out in sync of course, I don't
know how that would work on the other targets?
Try using a Applications.ProcessMessages between.