Hi everybody.
I`m running the Live for speed cargame using four AutoHotkey scripts.
I´m using three of the games windows and Ahk is "jumping" between these.
The problem is to know "the state" of the windows.
Sometimes a timer of 2000millisec is enough, but sometimes it would require 5 seconds to load a graphic element.
If you press a key before the window has been loaded, the script jumps to another script, but the window doesnt, and the Ahk script is "in wrong window".
So, my question is:
Is there any way of getting information when a window has finisched loading, and is in a "waiting state" ??
Thanks,
SimPlayer
Wait for a window to finish loading
Re: Wait for a window to finish loading
One way is to use pixel and image search to find some visual indication that the process isn't busy.
The downside to this approach is that it need to be customised to every application, and if the application is inconsistent in its visual indicators, the script becomes messy.
There may well be a better way to determine if a window is busy, but if I understand your problem it is really processes behind the window that are interesting. I believe these processes would need to implement a way to determine if they are busy themself.
The downside to this approach is that it need to be customised to every application, and if the application is inconsistent in its visual indicators, the script becomes messy.
There may well be a better way to determine if a window is busy, but if I understand your problem it is really processes behind the window that are interesting. I believe these processes would need to implement a way to determine if they are busy themself.
Please excuse my spelling I am dyslexic.
Re: Wait for a window to finish loading
Hi, and thank you for your answer.
I have tried to use the pixel and image search, but I didnt get it to work at all.
It could be possible since its only in one part of the screen that the image changes when an image of a track is coming up. And its that process that varies with different tracks. If it would be possible to wait on that part of the screen being "idle", meaning no pixels are changing colours, than it would work.
SimPlayer
I have tried to use the pixel and image search, but I didnt get it to work at all.
It could be possible since its only in one part of the screen that the image changes when an image of a track is coming up. And its that process that varies with different tracks. If it would be possible to wait on that part of the screen being "idle", meaning no pixels are changing colours, than it would work.
SimPlayer
- Almost_there
- Posts: 404
- Joined: 30 Sep 2014, 10:32
Re: Wait for a window to finish loading
One real ugly way to accomplish is (given that the window does not respond on attempts to move the window under loading) to grap at top of the window (loop) and have a loop to determine when the wondow has actually changed position.
Re: Wait for a window to finish loading
Hi all.
In right corner there is a "run" button that you click when you enter race, could it be possible to find this RUN text ?
SimPlayer
In right corner there is a "run" button that you click when you enter race, could it be possible to find this RUN text ?
SimPlayer
- Almost_there
- Posts: 404
- Joined: 30 Sep 2014, 10:32
Re: Wait for a window to finish loading
Yes it would be possible:
You need to fill out the blanks:
You need to fill out the blanks:
Code: Select all
While, windowsStillLoading()
Sleep 200
windowsStillLoading() {
imageSearch, foundX, foundY, x1, y1, x2, y2, imagefile.bmp
If !errorlevel
Return 1
}
Who is online
Users browsing this forum: AHKStudent, ameyrick, Arsonistic, Bing [Bot], Haan, hotkeyuser1234, Jose Hidalgo, mikeyww and 70 guests