Jump to content

ControlFocus return = 1 but control does NOT have focus


HeidiR
 Share

Recommended Posts

In the script below, I am opening an html file in an enbedded IE object (UDF) and selecting all text in the object and copyiing to the clipboard.

Unfortunately, the select all and copy does not work because the ControlFocus function (line #22 below) is failing. Actually, the ControlFocus return code = 1, which indicates success, but the control does NOT have focus. The ControlGetFocus (line #23 below) shows button1 having the focus.

What am I missing???

#include <ie.au3>

Opt("GuiOnEventMode", 1)

Global $oIE, $Button1

GUICreate("Embedded IE", 600, 400)

GUISetOnEvent(-3, "quit")

$oIE = _IECreateEmbedded()

GUICtrlCreateObj($oIE, 10, 10, 580, 340)

$Button1 = GUICtrlCreateButton("Open", 125, 360, 100, 30)

GUICtrlSetOnEvent(-1, "go")

_IENavigate($oIE, "about:blank", 0)

GUISetState()

While 1

Sleep(1000)

WEnd

Func go()

_IENavigate($oIE, "label.html", 0)

msgbox(0,"ControlFocus", ControlFocus ("Embedded IE", "", $oIE))

msgbox(0,"ControlGetFocus", ControlGetFocus ("Embedded IE"))

send("^a") ;Select all

send("^c") ;Copy

EndFunc

Func quit()

Exit

EndFunc

HeidiRFind free applications, code examples and more on my site at:http://heidisdownloads.com/
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...