Sycondaman Posted April 8, 2013 Share Posted April 8, 2013 (edited) I'm writing some code to automatically patch a few games, and for the game Firefall I am using AutoIt to automatically click on the patch/launch game button. Unfortunately, this button is not a control object so I have to use mouse coordinates. Here is my code: Func WinWaitActivate($title,$text,$timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc Opt("MouseCoordMode", 0) While True WinWaitActivate("[REGEXPCLASS:HwndWrapper\[(Launcher|FirefallPatcher)\.exe.*]","") MouseClick("left", 775, 475) Sleep(15000) WEnd The problem I am experiencing is that the mouse coordinates are inconsistent. If I let this script run for 30 seconds, the first two clicks will usually click on the wrong location, but the third click and beyond will select the right location. Any ideas? I have seen this for other launcher type applications as well. EDIT: I have also tried using absolute coordinates in conjunction with the position of the window. This runs into the same problem. Edited April 8, 2013 by Sycondaman Link to comment Share on other sites More sharing options...
Tripredacus Posted April 8, 2013 Share Posted April 8, 2013 FirefallPatcher is a game file for the game Firefall? http://www.firefallthegame.com/about-firefall/ Twitter | MSFN | VGCollect Link to comment Share on other sites More sharing options...
Sycondaman Posted April 10, 2013 Author Share Posted April 10, 2013 FirefallPatcher is a game file for the game Firefall?http://www.firefallthegame.com/about-firefall/Correct. There are actually two files that it switches between, Launcher and FirefallPatcher. The window regex works fine (the window will move to the foreground when behind other windows), but the clicking will happen twice at the wrong location and then in the correct location. I have also seen this behavior with the same code but with different windows.For now I think I'm going to separate click and move and only click when I detect the mouse coordinates are in the correct position, but I'm still curious as to why this would be inconsistent. Link to comment Share on other sites More sharing options...
Tripredacus Posted April 11, 2013 Share Posted April 11, 2013 You won't find the help you are looking for here. http://www.autoitscript.com/forum/index.php?app=forums&module=extras§ion=boardrules Twitter | MSFN | VGCollect Link to comment Share on other sites More sharing options...
Developers Jos Posted April 11, 2013 Developers Share Posted April 11, 2013 Please read our forum rules about Game automation. *click* SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts