I was hoping mousegetpos() would also give me the Width/Height (in the window) for the mouse position (not just X/Y for the screen , hence I was using the print code for windowRect(getWin()). A bit of a Frankenstein I know but I was trying my luck…
But I know see I can see the difference between the cords for mouseGetPos() And windowRect(getWin()) which allows me to calculate the Width/Height in the Window.
So I will just put the X/Y cords in Excel to calculate the Window Width/Height coords for the script.
Therefore the final script would be this (it actually works!):
Code: Select all
local windowList = findWindowList("*","TvnWindowClass");
if( #windowList == 0 ) then
print("You need to run Some App first!");
return 0;
end
function getWin()
if( __WIN == nil ) then
__WIN = windowList[1]
end
return __WIN;
end
function getProc()
if( __PROC == nil or not windowValid(__WIN) ) then
if( __PROC ) then closeProcess(__PROC) end;
__PROC = openProcess( findProcessByWindow(getWin()) );
end
return __PROC;
end
--add code after here to do what you want.
local wx, wy, ww, wh = windowRect(getWin());
mouseSet(wx + ww-300, wy+ wh-270);
mouseLClick();
yrest(5000);
mouseSet(wx + ww-297, wy+ wh-458);
mouseLClick();
yrest(5000);
1/ At some point I need to click and drag the screen, I guees I need to use mouseLhold() but not sure what after that
2/ yrest: As it is a phone game there are loading times, generally fast but sometimes a few seconds, is there a way to , instead of putting a high yrest number, it could recognise the window is not loaded yet and when loaded perform the action? Or maybe that is cheat engine and for another day?