Jump to content

Application goes to the background once autoit starts executing


Saaharjit
 Share

Recommended Posts

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...