I wrote an automated code that basically takes some text from a PDF and then pastes it in a different program. This involves controlling my mouse and keyboard in order to work properly. The code runs fine, but sometimes my computer, or I guess the program I'm using (it's a program run through Citrix) lags a little. When this happens, my code still runs, but because the program is momentarily frozen, it can't click and type correctly. Is there a way to detect when the program is lagging so that I can pause the code for a few seconds to allow the program to unfreeze? I couldn't find anything similar online
Asked
Active
Viewed 412 times
1 Answers
0
I have done something similar (albeit not from python) and if you know that your lag spikes normally last, say, 3 seconds, you may need to implement a waiting time of 4 seconds between actions, so there is a very good chance that your action has been accepted by the receiving software.
This of course will slow down the actions even when there is no spikes, and won't protect you against larger than usual spikes, but it's a start.

pygri
- 647
- 6
- 17
-
The thing is the lagging is kind of random and the duration isn't always constant. I've already slowed down the program by making it wait a little after each action but I can't increase that otherwise it would just be inefficient – ATP May 24 '19 at 19:48