Reputation: 91
I have an auto-send script which works in 2 steps:
This is working ok, but it is too slow - up to 10-15 seconds after the db update. Is there a way to speed up WinWaitNotActive? Instead of WinWait I tried using Sleep for 8 seconds, but sometimes the second command ran before the db update had finished.
Is it possible to monitor the process activity, and run the second command once it drops below a certain level?
Here is the code:
send !w::
Run "Target"
/'Update Command'
WinWaitNotActive, Target, , ,
Run "Target"
/'Search Command' "Search Term"
return
Upvotes: 2
Views: 386
Reputation: 528
You can use SetTimer
with your desired interval to check the window status.
Run "Target"
; /'Update Command'
SetTimer, CheckWindow, -200 ; this check the window every 200 milliseconds
return
CheckWindow:
if WinActive, Target
return
Run "Target"
; /'Search Command' "Search Term"
SetTimer, % A_ThisLabel, Off ; stop the timer
Return
Upvotes: 1