Jump to content
Kogan

Autoit - lost focus after child window pops up

Recommended Posts

Kogan

I am trying to click on an item from combobox control from parent window. once I click, a new child window pops up, then I need to click on OK button in the child window.

Problem here is, when the child window pops up, the autoit script loses its focus. I have used WinGetTitle, WinWaitActive, WinActivate to get control of child window, but none are working.

Any help in this is highly appreciated. Thanks!

Share this post


Link to post
Share on other sites
funkey

Without your code we are not able to see what is going wrong.

  • Like 1

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Share this post


Link to post
Share on other sites
Kogan

Hi Funkey,
I am trying to automate PDF advanced search using autoit, below is the code am using which gets stuck after control command.

The script never exits.

#include <Constants.au3>
 #include <GuiMenu.au3>
 #include <WinAPI.au3>
#include <Array.au3>
#include <GuiComboBox.au3>

PdfOpen()
Func PdfOpen ()


Run("C:\Program Files (x86)\Adobe\Acrobat 2015\Acrobat\Acrobat.exe")
Sleep(500)

Send("^+{F}")
WinWaitActive('Search',"", 10)
Sleep(1000)

 $hWnd = ControlGetHandle(WinGetHandle("Search"),"","[CLASS:ComboBox; INSTANCE:11]")
if ($hWnd) Then
 $RtArray = _GUICtrlComboBox_GetListArray($hWnd)
 EndIf

Local $computer="Bro"
$sColumn=0
$iPosition=_ArraySearch($RtArray,$computer, 0, 0, 0, 1, 1, $sColumn)

                ControlCommand("Search", "", "[CLASS:ComboBox; INSTANCE:11]", "SetCurrentSelection", $iPosition-1)
            ConsoleWrite("Success")

Sleep(200)
EndFunc


 

Edited by Kogan
Inserted the code used

Share this post


Link to post
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

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.