I've got a basic script that does some ImageSearch clicks of a PC as part of a routine function to bridge a few programs' datasets. It's just on a windows scheduler event every day to make this occur.
I don't mind leaving the PC on and logged in 24/7, so it shouldn't have to wake the computer or any fancy stuff, but I would be open to any ideas too
Basically I just want to control some GUI's with mouseclicks on a headless PC. I seem to be able to do this fine with remote desktop as the Windows GUI is updates as it's pushing a display. The problem comes when I disconnect RDP, or turn a connected screen off (I want to run headless). The Windows GUI does not draw.
I'm looking to get around this by forcing the screen to update between my image searches & program launches.
Here is a snippet, it's basically a bunch of ImageSearches on an IF error logic. My question is, how would I go about making the Windows GUI forcibly refresh to allow image searches to continue? Where would I put these refreshes? Also I'm calling other .exe's to run certain things in-between, which would need to refresh the GUI afterwards too, because I'll be doing even more searches after that.
Code: Select all
{
Sleep 5000
{
CoordMode, Pixel, Window
ImageSearch, X1, X2, 1, 0, 1920, 1080, *50 excelopen.PNG
If ErrorLevel = 0
{
sleep 100
Random, Random1, 1, 10
MouseClick, right, X1+1, X2+10,, 0
}
Else If ErrorLevel > 0
{
Sleep 200
ImageSearch, X1, X2, 1, 0, 1920, 1080, *50 open.PNG
If ErrorLevel = 0
{
sleep 10
Random, Random1, 1, 10
MouseClick, right, X1+1, X2+10,, 0
}
}
{
CoordMode, Pixel, Window
ImageSearch, X1, X2, 1, 0, 1920, 1080, *50 master.PNG
If ErrorLevel > 0
{
sleep 1000
CoordMode, Pixel, Window
ImageSearch, X1, X2, 1, 0, 1920, 1080, *50 master2.PNG
If ErrorLevel > 0
{
sleep 100
Random, Random1, 1, 10
MouseClick, left, X1+1, X2+10,, 0
}
}
Else If ErrorLevel = 0
{
Random, Random1, 1, 10
MouseClick, left, X1+1, X2+1,, 0
sleep 500
}
}
etc
etc
etc