Saaharjit Posted September 20, 2018 Share Posted September 20, 2018 Hi I am using the autoit recorder to run a daily process. It's an exe file that needs to execute. Sometimes it runs fine but sometimes when the execution begins, it opens up the application but then the application becomes inactive. i need to then click on the application to make it active and then it proceeds with the rest of the execution. Here's my script #region --- Internal functions Au3Recorder Start --- Func _Au3RecordSetup() Opt('WinWaitDelay',100) Opt('WinDetectHiddenText',1) Opt('MouseCoordMode',0) Local $aResult = DllCall('User32.dll', 'int', 'GetKeyboardLayoutNameW', 'wstr', '') If $aResult[1] <> '00000409' Then MsgBox(64, 'Warning', 'Recording has been done under a different Keyboard layout' & @CRLF & '(00000409->' & $aResult[1] & ')') EndIf EndFunc Func WinWaitActivate($title,$text,$timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc _AU3RecordSetup() #endregion --- Internal functions Au3Recorder End --- Run('file path') WinWaitActivate("exe name","") MouseClick("left",36,72,1) MouseClick("left",35,254,1) MouseClick("left",33,323,1) MouseClick("left",31,349,1) MouseClick("left",209,557,1) Link to comment Share on other sites More sharing options...
Zedna Posted September 21, 2018 Share Posted September 21, 2018 Try to use ControlClick() instead of MouseClick(). This will be working also in situation when other application steal focus/active status of your target application. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now